Merge with stable
authorMatt Mackall <mpm@selenic.com>
Thu, 29 Apr 2010 22:14:14 -0500
changeset 11051 bf7e63fedca1
parent 11050 5d35f7d93514 (current diff)
parent 11035 e4f911ce21de (diff)
child 11054 355a7535bcac
child 11075 4b8fd86aba5e
Merge with stable
--- a/mercurial/help/templates.txt	Wed Apr 07 00:45:20 2010 +0900
+++ b/mercurial/help/templates.txt	Thu Apr 29 22:14:14 2010 -0500
@@ -6,8 +6,9 @@
 You can customize output for any "log-like" command: log,
 outgoing, incoming, tip, parents, heads and glog.
 
-Three styles are packaged with Mercurial: default (the style used
-when no explicit preference is passed), compact and changelog.
+Four styles are packaged with Mercurial: default (the style used
+when no explicit preference is passed), compact, changelog,
+and xml.
 Usage::
 
     $ hg log -r1 --style changelog
--- a/mercurial/url.py	Wed Apr 07 00:45:20 2010 +0900
+++ b/mercurial/url.py	Thu Apr 29 22:14:14 2010 -0500
@@ -11,17 +11,28 @@
 from i18n import _
 import keepalive, util
 
+def _urlunparse(scheme, netloc, path, params, query, fragment, url):
+    '''Handle cases where urlunparse(urlparse(x://)) doesn't preserve the "//"'''
+    result = urlparse.urlunparse((scheme, netloc, path, params, query, fragment))
+    if (scheme and
+        result.startswith(scheme + ':') and
+        not result.startswith(scheme + '://') and
+        url.startswith(scheme + '://')
+       ):
+        result = scheme + '://' + result[len(scheme + ':'):]
+    return result
+
 def hidepassword(url):
     '''hide user credential in a url string'''
     scheme, netloc, path, params, query, fragment = urlparse.urlparse(url)
     netloc = re.sub('([^:]*):([^@]*)@(.*)', r'\1:***@\3', netloc)
-    return urlparse.urlunparse((scheme, netloc, path, params, query, fragment))
+    return _urlunparse(scheme, netloc, path, params, query, fragment, url)
 
 def removeauth(url):
     '''remove all authentication information from a url string'''
     scheme, netloc, path, params, query, fragment = urlparse.urlparse(url)
     netloc = netloc[netloc.find('@')+1:]
-    return urlparse.urlunparse((scheme, netloc, path, params, query, fragment))
+    return _urlunparse(scheme, netloc, path, params, query, fragment, url)
 
 def netlocsplit(netloc):
     '''split [user[:passwd]@]host[:port] into 4-tuple.'''