Review Board

beta

post-review: allow user to supply password on cmdline

Updated 4 months, 2 weeks ago

Zach Carter Reviewers
reviewboard
None Review Board SVN
post-review: allow user to supply password on cmdline
submitted this review with the modified script

Diff revision 3 (Latest)

1 2 3
1 2 3

  1. /trunk/reviewboard/contrib/tools/post-review: 4 changes [ 1 2 3 4 ]
/trunk/reviewboard/contrib/tools/post-review
Revision 1433 New Change
160
        if self.has_valid_cookie():
160
        if self.has_valid_cookie():
161
            return
161
            return
162
162
163
        print "==> Review Board Login Required"
163
        print "==> Review Board Login Required"
164
        print "Enter username and password for Review Board at %s" % self.url
164
        print "Enter username and password for Review Board at %s" % self.url
165
        if not options.submit_as:
165
        username = raw_input('Username: ')
166
            username = raw_input('Username: ')
167
        else:
168
            username = options.submit_as
169
170
        if not options.password:
166
        password = getpass.getpass('Password: ')
171
            password = getpass.getpass('Password: ')
172
        else:
173
            password = options.password
167
174
168
        debug('Logging in with username "%s"' % username)
175
        debug('Logging in with username "%s"' % username)
169
        try:
176
        try:
170
            self.api_post('api/json/accounts/login/', {
177
            self.api_post('api/json/accounts/login/', {
171
                'username': username,
178
                'username': username,
1441
                           "revision range")
1448
                           "revision range")
1442
    parser.add_option("--submit-as",
1449
    parser.add_option("--submit-as",
1443
                      dest="submit_as", default=SUBMIT_AS, metavar="USERNAME",
1450
                      dest="submit_as", default=SUBMIT_AS, metavar="USERNAME",
1444
                      help="user name to be recorded as the author of the "
1451
                      help="user name to be recorded as the author of the "
1445
                           "review request, instead of the logged in user")
1452
                           "review request, instead of the logged in user")
1453
    parser.add_option("--password",
1454
                      dest="password", default=None, metavar="PASSWORD",
1455
                      help="password to be supplied to the reviewboard server")
1446
1456
1447
    if repository_info:
1457
    if repository_info:
1448
        if repository_info.supports_changesets:
1458
        if repository_info.supports_changesets:
1449
            parser.add_option("--change-only",
1459
            parser.add_option("--change-only",
1450
                              dest="change_only", action="store_true",
1460
                              dest="change_only", action="store_true",
  1. /trunk/reviewboard/contrib/tools/post-review: 4 changes [ 1 2 3 4 ]