# HG changeset patch # User Matt Mackall # Date 2010-04-30 03:14:14 # Node ID bf7e63fedca12ab725af8a5cb0d0eced403bc7ec # Parent 5d35f7d93514566fbc53d93dbcdae71495ba61df # Parent e4f911ce21de5f8cee669da95774d4d8af261e96 Merge with stable diff --git a/mercurial/help/templates.txt b/mercurial/help/templates.txt --- a/mercurial/help/templates.txt +++ b/mercurial/help/templates.txt @@ -6,8 +6,9 @@ template-style (--style). 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 diff --git a/mercurial/url.py b/mercurial/url.py --- a/mercurial/url.py +++ b/mercurial/url.py @@ -11,17 +11,28 @@ import urllib, urllib2, urlparse, httpli 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.'''