Commits

mdelagra committed 45bdc0f Merge
  • Participants
  • Parent commits 01944c3, f49c7c4

Comments (0)

Files changed (1)

File mercurial_reviewboard/reviewboard.py

 def make_rbclient(url, username, password, proxy=None, apiver=''):
     httpclient = HttpClient(url, proxy)
 
-    if not username and not password:
-            if httpclient.has_valid_cookie():
-                return
-    
-    if not username:
-        username = mercurial.ui.ui().prompt('Username: ')
-    if not password:
-        password = getpass.getpass('Password: ')
+    if not httpclient.has_valid_cookie():
+        if not username:
+            username = mercurial.ui.ui().prompt('Username: ')
+        if not password:
+            password = getpass.getpass('Password: ')
 
-    httpclient.set_credentials(username, password)
+        httpclient.set_credentials(username, password)
 
     if not apiver:
         # Figure out whether the server supports API version 2.0
             apiver = '1.0'
 
     if apiver == '2.0':
-        return Api20Client(httpclient)
+        cli = Api20Client(httpclient)
+        cli.login(username, password)
+        return cli
     elif apiver == '1.0':
         cli = Api10Client(httpclient)
         cli.login(username, password)