Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/util.py @ 20108:af12f58e2aa0
merge with stable
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Mon, 25 Nov 2013 16:15:44 -0600 |
parents | 1e5b38a919dd c33d9217e99d |
children | a6014018ec28 |
comparison
equal
deleted
inserted
replaced
20102:04eaa8eec6a0 | 20108:af12f58e2aa0 |
---|---|
1632 <url path: 'c:\\foo\\bar'> | 1632 <url path: 'c:\\foo\\bar'> |
1633 >>> url(r'\\blah\blah\blah') | 1633 >>> url(r'\\blah\blah\blah') |
1634 <url path: '\\\\blah\\blah\\blah'> | 1634 <url path: '\\\\blah\\blah\\blah'> |
1635 >>> url(r'\\blah\blah\blah#baz') | 1635 >>> url(r'\\blah\blah\blah#baz') |
1636 <url path: '\\\\blah\\blah\\blah', fragment: 'baz'> | 1636 <url path: '\\\\blah\\blah\\blah', fragment: 'baz'> |
1637 >>> url(r'file:///C:\users\me') | |
1638 <url scheme: 'file', path: 'C:\\users\\me'> | |
1637 | 1639 |
1638 Authentication credentials: | 1640 Authentication credentials: |
1639 | 1641 |
1640 >>> url('ssh://joe:xyz@x/repo') | 1642 >>> url('ssh://joe:xyz@x/repo') |
1641 <url scheme: 'ssh', user: 'joe', passwd: 'xyz', host: 'x', path: 'repo'> | 1643 <url scheme: 'ssh', user: 'joe', passwd: 'xyz', host: 'x', path: 'repo'> |
1649 >>> url('http://host/a?b#c', parsequery=False, parsefragment=False) | 1651 >>> url('http://host/a?b#c', parsequery=False, parsefragment=False) |
1650 <url scheme: 'http', host: 'host', path: 'a?b#c'> | 1652 <url scheme: 'http', host: 'host', path: 'a?b#c'> |
1651 """ | 1653 """ |
1652 | 1654 |
1653 _safechars = "!~*'()+" | 1655 _safechars = "!~*'()+" |
1654 _safepchars = "/!~*'()+:" | 1656 _safepchars = "/!~*'()+:\\" |
1655 _matchscheme = re.compile(r'^[a-zA-Z0-9+.\-]+:').match | 1657 _matchscheme = re.compile(r'^[a-zA-Z0-9+.\-]+:').match |
1656 | 1658 |
1657 def __init__(self, path, parsequery=True, parsefragment=True): | 1659 def __init__(self, path, parsequery=True, parsefragment=True): |
1658 # We slowly chomp away at path until we have only the path left | 1660 # We slowly chomp away at path until we have only the path left |
1659 self.scheme = self.user = self.passwd = self.host = None | 1661 self.scheme = self.user = self.passwd = self.host = None |
1786 'file:///tmp/foo/bar' | 1788 'file:///tmp/foo/bar' |
1787 >>> str(url('file:///c:/tmp/foo/bar')) | 1789 >>> str(url('file:///c:/tmp/foo/bar')) |
1788 'file:///c:/tmp/foo/bar' | 1790 'file:///c:/tmp/foo/bar' |
1789 >>> print url(r'bundle:foo\bar') | 1791 >>> print url(r'bundle:foo\bar') |
1790 bundle:foo\bar | 1792 bundle:foo\bar |
1793 >>> print url(r'file:///D:\data\hg') | |
1794 file:///D:\data\hg | |
1791 """ | 1795 """ |
1792 if self._localpath: | 1796 if self._localpath: |
1793 s = self.path | 1797 s = self.path |
1794 if self.scheme == 'bundle': | 1798 if self.scheme == 'bundle': |
1795 s = 'bundle:' + s | 1799 s = 'bundle:' + s |