Show More
@@ -80,10 +80,10 b' password_store = PasswordStore()' | |||||
80 | ############################################################ |
|
80 | ############################################################ | |
81 |
|
81 | |||
82 | def _debug(ui, msg): |
|
82 | def _debug(ui, msg): | |
83 | ui.debug("[HgKeyring] " + msg) |
|
83 | ui.debug("[HgKeyring] " + msg + "\n") | |
84 |
|
84 | |||
85 | def _debug_reply(ui, msg, url, user, pwd): |
|
85 | def _debug_reply(ui, msg, url, user, pwd): | |
86 |
_debug(ui, "%s. Url: %s, user: %s, passwd: %s |
|
86 | _debug(ui, "%s. Url: %s, user: %s, passwd: %s" % ( | |
87 | msg, url, user, pwd and '*' * len(pwd) or 'not set')) |
|
87 | msg, url, user, pwd and '*' * len(pwd) or 'not set')) | |
88 |
|
88 | |||
89 |
|
89 | |||
@@ -114,6 +114,7 b' class HTTPPasswordHandler(object):' | |||||
114 | after_bad_auth = (self.last_reply \ |
|
114 | after_bad_auth = (self.last_reply \ | |
115 | and (self.last_reply['realm'] == realm) \ |
|
115 | and (self.last_reply['realm'] == realm) \ | |
116 | and (self.last_reply['authuri'] == authuri)) |
|
116 | and (self.last_reply['authuri'] == authuri)) | |
|
117 | _debug(ui, _("Working after bad authentication, cached passwords not used")) | |||
117 |
|
118 | |||
118 | # Strip arguments to get actual remote repository url. |
|
119 | # Strip arguments to get actual remote repository url. | |
119 | base_url = self.canonical_url(authuri) |
|
120 | base_url = self.canonical_url(authuri) | |
@@ -135,7 +136,7 b' class HTTPPasswordHandler(object):' | |||||
135 | keyring_url = prefix_url |
|
136 | keyring_url = prefix_url | |
136 | else: |
|
137 | else: | |
137 | keyring_url = base_url |
|
138 | keyring_url = base_url | |
138 |
_debug(ui, _("Keyring URL: %s |
|
139 | _debug(ui, _("Keyring URL: %s") % keyring_url) | |
139 |
|
140 | |||
140 | # Checking the memory cache (there may be many http calls per command) |
|
141 | # Checking the memory cache (there may be many http calls per command) | |
141 | cache_key = (realm, keyring_url) |
|
142 | cache_key = (realm, keyring_url) | |
@@ -159,7 +160,7 b' class HTTPPasswordHandler(object):' | |||||
159 | self.last_reply = dict(realm=realm,authuri=authuri,user=user) |
|
160 | self.last_reply = dict(realm=realm,authuri=authuri,user=user) | |
160 | return user, pwd |
|
161 | return user, pwd | |
161 | else: |
|
162 | else: | |
162 |
_debug(ui, _("Username found in .hg/hgrc: %s |
|
163 | _debug(ui, _("Username found in .hg/hgrc: %s") % user) | |
163 |
|
164 | |||
164 | # Loading password from keyring. |
|
165 | # Loading password from keyring. | |
165 | # Only if username is known (so we know the key) and we are |
|
166 | # Only if username is known (so we know the key) and we are | |
@@ -174,7 +175,7 b' class HTTPPasswordHandler(object):' | |||||
174 | self.last_reply = dict(realm=realm,authuri=authuri,user=user) |
|
175 | self.last_reply = dict(realm=realm,authuri=authuri,user=user) | |
175 | return user, pwd |
|
176 | return user, pwd | |
176 | else: |
|
177 | else: | |
177 |
_debug(ui, _("Password not present in the keyring |
|
178 | _debug(ui, _("Password not present in the keyring")) | |
178 |
|
179 | |||
179 | # Is the username permanently set? |
|
180 | # Is the username permanently set? | |
180 | fixed_user = (user and True or False) |
|
181 | fixed_user = (user and True or False) | |
@@ -199,7 +200,7 b' class HTTPPasswordHandler(object):' | |||||
199 | # It is done only if username is permanently set. |
|
200 | # It is done only if username is permanently set. | |
200 | # Otherwise we won't be able to find the password so it |
|
201 | # Otherwise we won't be able to find the password so it | |
201 | # does not make much sense to preserve it |
|
202 | # does not make much sense to preserve it | |
202 |
_debug(ui, _("Saving password for %s to keyring |
|
203 | _debug(ui, _("Saving password for %s to keyring") % user) | |
203 | password_store.set_http_password(keyring_url, user, pwd) |
|
204 | password_store.set_http_password(keyring_url, user, pwd) | |
204 |
|
205 | |||
205 | # Saving password to the memory cache |
|
206 | # Saving password to the memory cache |
General Comments 0
You need to be logged in to leave comments.
Login now