[MERGE] Allow appending path segments to the :<name> style aliases.
John Arbash Meinel
john at arbash-meinel.com
Thu Aug 14 04:01:35 BST 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Michael Hudson wrote:
> This simple patch extends the directory service to allow path segments
> after the name of a branch location alias. For example you could do
> this in a lightweight checkout of a loom to push a non-loomified version
> of the current thread of the loom to its default location:
>
> bzr export-loom :this; bzr push -d :this/`bzr nick`
>
> Cheers,
> mwh
>
+ if '/' in url:
+ name = url[1:url.find('/')]
+ extra = url[url.find('/') + 1:]
+ else:
+ name = url[1:]
+ extra = None
^- This seems like a really inefficient way of saying:
name, extra = url[1:].split('/', 1)
- -
+from bzrlib.urlutils import join
class FooService(object):
"""A directory service that maps the name to a FILE url"""
@@ -83,6 +83,11 @@
branch = self.make_branch('.')
self.assertEqual(branch.base, directories.dereference(':this'))
+ def test_extra_path(self):
+ branch = self.make_branch('.')
+ self.assertEqual(
+ join(branch.base, 'arg'), directories.dereference(':this/arg'))
^- I'd really rather see
from bzrlib import urlutils
...
self.assertEqual(urlutils.join(branch.base, 'arg'),
...)
A raw 'join()' function with no context could be a lot of different functions.
BB:tweak
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD4DBQFIo6APJdeBCYSNAAMRAoUeAJ9+DYDLoUIY8L2KKv6W43irGMsyBACYlV2g
RLQlp5D6PvnxdrsYzC8n9w==
=u9tE
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list