##// END OF EJS Templates
Merge with stable
Matt Mackall -
r11051:bf7e63fe merge default
parent child Browse files
Show More
@@ -6,8 +6,9 b' template-style (--style).'
6 6 You can customize output for any "log-like" command: log,
7 7 outgoing, incoming, tip, parents, heads and glog.
8 8
9 Three styles are packaged with Mercurial: default (the style used
10 when no explicit preference is passed), compact and changelog.
9 Four styles are packaged with Mercurial: default (the style used
10 when no explicit preference is passed), compact, changelog,
11 and xml.
11 12 Usage::
12 13
13 14 $ hg log -r1 --style changelog
@@ -11,17 +11,28 b' import urllib, urllib2, urlparse, httpli'
11 11 from i18n import _
12 12 import keepalive, util
13 13
14 def _urlunparse(scheme, netloc, path, params, query, fragment, url):
15 '''Handle cases where urlunparse(urlparse(x://)) doesn't preserve the "//"'''
16 result = urlparse.urlunparse((scheme, netloc, path, params, query, fragment))
17 if (scheme and
18 result.startswith(scheme + ':') and
19 not result.startswith(scheme + '://') and
20 url.startswith(scheme + '://')
21 ):
22 result = scheme + '://' + result[len(scheme + ':'):]
23 return result
24
14 25 def hidepassword(url):
15 26 '''hide user credential in a url string'''
16 27 scheme, netloc, path, params, query, fragment = urlparse.urlparse(url)
17 28 netloc = re.sub('([^:]*):([^@]*)@(.*)', r'\1:***@\3', netloc)
18 return urlparse.urlunparse((scheme, netloc, path, params, query, fragment))
29 return _urlunparse(scheme, netloc, path, params, query, fragment, url)
19 30
20 31 def removeauth(url):
21 32 '''remove all authentication information from a url string'''
22 33 scheme, netloc, path, params, query, fragment = urlparse.urlparse(url)
23 34 netloc = netloc[netloc.find('@')+1:]
24 return urlparse.urlunparse((scheme, netloc, path, params, query, fragment))
35 return _urlunparse(scheme, netloc, path, params, query, fragment, url)
25 36
26 37 def netlocsplit(netloc):
27 38 '''split [user[:passwd]@]host[:port] into 4-tuple.'''
General Comments 0
You need to be logged in to leave comments. Login now