diff options
author | Krzysztof Pawlik <nelchael@gentoo.org> | 2007-12-25 19:44:41 +0000 |
---|---|---|
committer | Krzysztof Pawlik <nelchael@gentoo.org> | 2007-12-25 19:44:41 +0000 |
commit | 77c73437a10373458ffad3c41aa2d1d35f0447df (patch) | |
tree | 2c77ca36a426f15697992dccd4dc01c335e35503 /dev-util/mercurial/files | |
parent | Add package to emacs herd. Remove old. (diff) | |
download | gentoo-2-77c73437a10373458ffad3c41aa2d1d35f0447df.tar.gz gentoo-2-77c73437a10373458ffad3c41aa2d1d35f0447df.tar.bz2 gentoo-2-77c73437a10373458ffad3c41aa2d1d35f0447df.zip |
Add upstream patch to hide passwords with http://user:password@.../ URLs.
(Portage version: 2.1.4_rc11)
Diffstat (limited to 'dev-util/mercurial/files')
-rw-r--r-- | dev-util/mercurial/files/digest-mercurial-0.9.5-r1 | 3 | ||||
-rw-r--r-- | dev-util/mercurial/files/mercurial-0.9.5-hide-passwords.diff | 103 |
2 files changed, 106 insertions, 0 deletions
diff --git a/dev-util/mercurial/files/digest-mercurial-0.9.5-r1 b/dev-util/mercurial/files/digest-mercurial-0.9.5-r1 new file mode 100644 index 000000000000..9db06dca2d90 --- /dev/null +++ b/dev-util/mercurial/files/digest-mercurial-0.9.5-r1 @@ -0,0 +1,3 @@ +MD5 a9dd54bcb87ca332315ce83293816e37 mercurial-0.9.5.tar.gz 670808 +RMD160 ea38d3142a4b1087e2777de3b70df8b4672cd237 mercurial-0.9.5.tar.gz 670808 +SHA256 cfe02baaa4e18c3af6bbaf1be4ad21c8570d4962b8cefb74dd83d9f309f564d8 mercurial-0.9.5.tar.gz 670808 diff --git a/dev-util/mercurial/files/mercurial-0.9.5-hide-passwords.diff b/dev-util/mercurial/files/mercurial-0.9.5-hide-passwords.diff new file mode 100644 index 000000000000..1a4db2455cca --- /dev/null +++ b/dev-util/mercurial/files/mercurial-0.9.5-hide-passwords.diff @@ -0,0 +1,103 @@ + +# HG changeset patch +# User Manuel Holtgrewe <purestorm@ggnore.net> +# Date 1194290972 -3600 +# Node ID dcbda0c4c3eb8e26e01343d44fc5a8fb41138073 +# Parent 453acf64f71f72158d5ee7e1d99a5e10cea5b3b5 +Do not display passwords with pull/push/incoming/outgoing + +Passwords specified in the repository URL are now displayed as '***' +when accessing the remote repository. + +--- a/mercurial/commands.py Fri Nov 09 20:21:35 2007 -0200 ++++ b/mercurial/commands.py Mon Nov 05 20:29:32 2007 +0100 +@@ -1652,7 +1652,7 @@ def incoming(ui, repo, source="default", + cmdutil.setremoteconfig(ui, opts) + + other = hg.repository(ui, source) +- ui.status(_('comparing with %s\n') % source) ++ ui.status(_('comparing with %s\n') % util.hidepassword(source)) + if revs: + revs = [other.lookup(rev) for rev in revs] + incoming = repo.findincoming(other, heads=revs, force=opts["force"]) +@@ -1962,7 +1962,7 @@ def outgoing(ui, repo, dest=None, **opts + revs = [repo.lookup(rev) for rev in revs] + + other = hg.repository(ui, dest) +- ui.status(_('comparing with %s\n') % dest) ++ ui.status(_('comparing with %s\n') % util.hidepassword(dest)) + o = repo.findoutgoing(other, force=opts['force']) + if not o: + ui.status(_("no changes found\n")) +@@ -2095,7 +2095,7 @@ def pull(ui, repo, source="default", **o + cmdutil.setremoteconfig(ui, opts) + + other = hg.repository(ui, source) +- ui.status(_('pulling from %s\n') % (source)) ++ ui.status(_('pulling from %s\n') % util.hidepassword(source)) + if revs: + try: + revs = [other.lookup(rev) for rev in revs] +@@ -2142,7 +2142,7 @@ def push(ui, repo, dest=None, **opts): + cmdutil.setremoteconfig(ui, opts) + + other = hg.repository(ui, dest) +- ui.status('pushing to %s\n' % (dest)) ++ ui.status('pushing to %s\n' % util.hidepassword(dest)) + if revs: + revs = [repo.lookup(rev) for rev in revs] + r = repo.push(other, opts['force'], revs=revs) +--- a/mercurial/util.py Fri Nov 09 20:21:35 2007 -0200 ++++ b/mercurial/util.py Mon Nov 05 20:29:32 2007 +0100 +@@ -15,6 +15,7 @@ from i18n import _ + from i18n import _ + import cStringIO, errno, getpass, popen2, re, shutil, sys, tempfile, strutil + import os, stat, threading, time, calendar, ConfigParser, locale, glob, osutil ++import re, urlparse + + try: + set = set +@@ -1698,3 +1699,33 @@ def uirepr(s): + def uirepr(s): + # Avoid double backslash in Windows path repr() + return repr(s).replace('\\\\', '\\') ++ ++def hidepassword(url): ++ '''replaces the password in the url string by three asterisks (***) ++ ++ >>> hidepassword('http://www.example.com/some/path#fragment') ++ 'http://www.example.com/some/path#fragment' ++ >>> hidepassword('http://me@www.example.com/some/path#fragment') ++ 'http://me@www.example.com/some/path#fragment' ++ >>> hidepassword('http://me:simplepw@www.example.com/path#frag') ++ 'http://me:***@www.example.com/path#frag' ++ >>> hidepassword('http://me:complex:pw@www.example.com/path#frag') ++ 'http://me:***@www.example.com/path#frag' ++ >>> hidepassword('/path/to/repo') ++ '/path/to/repo' ++ >>> hidepassword('relative/path/to/repo') ++ 'relative/path/to/repo' ++ >>> hidepassword('c:\\\\path\\\\to\\\\repo') ++ 'c:\\\\path\\\\to\\\\repo' ++ >>> hidepassword('c:/path/to/repo') ++ 'c:/path/to/repo' ++ >>> hidepassword('bundle://path/to/bundle') ++ 'bundle://path/to/bundle' ++ ''' ++ url_parts = list(urlparse.urlparse(url)) ++ host_with_pw_pattern = re.compile('^([^:]*):([^@]*)@(.*)$') ++ if host_with_pw_pattern.match(url_parts[1]): ++ url_parts[1] = re.sub(host_with_pw_pattern, r'\1:***@\3', ++ url_parts[1]) ++ return urlparse.urlunparse(url_parts) ++ +--- a/tests/test-doctest.py Fri Nov 09 20:21:35 2007 -0200 ++++ b/tests/test-doctest.py Mon Nov 05 20:29:32 2007 +0100 +@@ -7,3 +7,6 @@ doctest.testmod(mercurial.changelog) + + import mercurial.httprepo + doctest.testmod(mercurial.httprepo) ++ ++import mercurial.util ++doctest.testmod(mercurial.util) + |