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