Mercurial > public > mercurial-scm > hg
comparison mercurial/util.py @ 14147:617483af1cc0
test: test that backslash is preserved by the url class
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Sun, 01 May 2011 15:49:13 +0200 |
parents | 1618c4f6f15b |
children | 0e4753807c93 |
comparison
equal
deleted
inserted
replaced
14146:1618c4f6f15b | 14147:617483af1cc0 |
---|---|
1471 if v is not None: | 1471 if v is not None: |
1472 attrs.append('%s: %r' % (a, v)) | 1472 attrs.append('%s: %r' % (a, v)) |
1473 return '<url %s>' % ', '.join(attrs) | 1473 return '<url %s>' % ', '.join(attrs) |
1474 | 1474 |
1475 def __str__(self): | 1475 def __str__(self): |
1476 """Join the URL's components back into a URL string. | 1476 r"""Join the URL's components back into a URL string. |
1477 | 1477 |
1478 Examples: | 1478 Examples: |
1479 | 1479 |
1480 >>> str(url('http://user:pw@host:80/?foo#bar')) | 1480 >>> str(url('http://user:pw@host:80/?foo#bar')) |
1481 'http://user:pw@host:80/?foo#bar' | 1481 'http://user:pw@host:80/?foo#bar' |
1491 'bundle:foo' | 1491 'bundle:foo' |
1492 >>> str(url('bundle://../foo')) | 1492 >>> str(url('bundle://../foo')) |
1493 'bundle:../foo' | 1493 'bundle:../foo' |
1494 >>> str(url('path')) | 1494 >>> str(url('path')) |
1495 'path' | 1495 'path' |
1496 >>> print url(r'bundle:foo\bar') | |
1497 bundle:foo\bar | |
1496 """ | 1498 """ |
1497 if self._localpath: | 1499 if self._localpath: |
1498 s = self.path | 1500 s = self.path |
1499 if self.scheme == 'bundle': | 1501 if self.scheme == 'bundle': |
1500 s = 'bundle:' + s | 1502 s = 'bundle:' + s |