Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.9.3, 2.0, and 2.0.1

stable sync: use the user's existing [auth] configuration when possible

This requires some changes just recently made to Mercurial

Changeset 6664735dc4fe

Parent bff59844892c

by Steve Borho

Changes to one file · Browse files at 6664735dc4fe Showing diff from parent bff59844892c Diff from another changeset...

 
495
496
497
498
499
500
501
 
502
503
504
505
 
506
507
508
 
988
989
990
991
 
992
993
994
 
998
999
1000
 
1001
1002
1003
1004
 
 
 
 
 
 
 
1005
1006
1007
 
1008
1009
1010
1011
1012
 
1055
1056
1057
1058
1059
 
1060
1061
1062
 
1064
1065
1066
1067
1068
 
1069
1070
1071
 
1079
1080
1081
1082
1083
 
1084
1085
1086
1087
1088
1089
1090
 
1091
1092
1093
 
495
496
497
 
 
 
 
498
499
500
 
 
501
502
503
504
 
984
985
986
 
987
988
989
990
 
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
 
1011
1012
 
1013
1014
1015
 
1058
1059
1060
 
 
1061
1062
1063
1064
 
1066
1067
1068
 
 
1069
1070
1071
1072
 
1080
1081
1082
 
 
1083
1084
1085
1086
1087
1088
 
 
1089
1090
1091
1092
@@ -495,14 +495,10 @@
  self.curalias = hglib.fromunicode(dlg.aliasentry.text())     def secureclicked(self): - host = hglib.fromunicode(self.hostentry.text()) - user = self.curuser or '' - pw = self.curpw or '' - dlg = SecureDialog(self.repo, host, user, pw, self) + dlg = SecureDialog(self.repo, self.currentUrl(False), self)   dlg.setWindowFlags(Qt.Sheet)   dlg.setWindowModality(Qt.WindowModal) - if dlg.exec_() == QDialog.Accepted: - self.curuser, self.curpw = '', '' + dlg.exec_()     def commandStarted(self):   for b in self.opbuttons: @@ -988,7 +984,7 @@
  super(SaveDialog, self).reject()    class SecureDialog(QDialog): - def __init__(self, repo, host, user, pw, parent): + def __init__(self, repo, origurl, parent):   super(SecureDialog, self).__init__(parent)     def genfingerprint(): @@ -998,15 +994,22 @@
  pretty = ":".join([hash[x:x + 2] for x in xrange(0, len(hash), 2)])   le.setText(pretty)   + user, host, port, folder, passwd, scheme = parseurl(origurl)   uhost = hglib.tounicode(host)   self.setWindowTitle(_('Security: ') + uhost)   self.setWindowFlags(self.windowFlags() & \   ~Qt.WindowContextHelpButtonHint) + + # if the already user has an [auth] configuration for this URL, use it + res = url.readauthforuri(repo.ui, origurl) + if res: + self.alias, auth = res + else: + self.alias = host, {}   self.repo = repo   self.host = host - self.alias = host.replace('.', '') +   self.setLayout(QVBoxLayout()) -   self.layout().addWidget(QLabel(_('<b>Host:</b> %s') % uhost))     securebox = QGroupBox(_('Secure HTTPS Connection')) @@ -1055,8 +1058,7 @@
  authbox.setLayout(form)   self.layout().addWidget(authbox)   - cfg = repo.ui.config('auth', self.alias+'.username', '') - self.userentry = QLineEdit(user or cfg) + self.userentry = QLineEdit(user or auth.get('username', ''))   self.userentry.setToolTip(  _('''Optional. Username to authenticate with. If not given, and the remote  site requires basic or digest authentication, the user will be prompted for @@ -1064,8 +1066,7 @@
 foo.username = $USER.'''))   form.addRow(_('Username'), self.userentry)   - cfg = repo.ui.config('auth', self.alias+'.password', '') - self.pwentry = QLineEdit(pw or cfg) + self.pwentry = QLineEdit(passwd or auth.get('password', ''))   self.pwentry.setEchoMode(QLineEdit.Password)   self.pwentry.setToolTip(  _('''Optional. Password to authenticate with. If not given, and the remote @@ -1079,15 +1080,13 @@
  'Passwords will be stored in platform native '   'cryptographically secure method.'))   - cfg = repo.ui.config('auth', self.alias+'.key', '') - self.keyentry = QLineEdit(cfg) + self.keyentry = QLineEdit(auth.get('key', ''))   self.keyentry.setToolTip(  _('''Optional. PEM encoded client certificate key file. Environment variables  are expanded in the filename.'''))   form.addRow(_('User Certificate Key File'), self.keyentry)   - cfg = repo.ui.config('auth', self.alias+'.cert', '') - self.chainentry = QLineEdit(cfg) + self.chainentry = QLineEdit(auth.get('cert', ''))   self.chainentry.setToolTip(  _('''Optional. PEM encoded client certificate chain file. Environment variables  are expanded in the filename.'''))