Patch: Allow Mercurial (hg) scmtools back end to utilize repository credentials when accessing HTTP/HTTPS paths
Submitted
Updated 4 months, 1 week ago
| Derek Slager | Reviewers | ||
| reviewboard | |||
| 536 | |||
| None | Review Board SVN | ||
A relatively simple change that seems to work ... that said, I don't really know Python at all, so it's rather likely that there's something "not quite right" here.
Tested on Debian and Windows, Python 2.5.2. It also seems to work alright with unauthenticated remote servers, though that has only been tested lightly.
Posted 4 months, 1 week ago (July 10th, 2008, 10:54 p.m.)
-
trunk/reviewboard/scmtools/hg.py (Diff revision 1) 85 f = urllib2.urlopen('%s/raw-file/%s/%s' % (self.url, rev, path))
89 passman = urllib2.HTTPPasswordMgrWithDefaultRealm()
90 passman.add_password(None, self.url, self.username, self.password)
91 authhandler = urllib2.HTTPBasicAuthHandler(passman)
92 opener = urllib2.build_opener(authhandler)
-
What if the username and/or password are blank? Maybe we should only do this if one or both are set.
In that case, this looks good. Committed as r1401. Thanks!