Rev 464: Support more syntaxes for externals. in file:///data/jelmer/bzr-svn/nestedtrees/
Jelmer Vernooij
jelmer at samba.org
Tue Jul 8 14:17:11 BST 2008
At file:///data/jelmer/bzr-svn/nestedtrees/
------------------------------------------------------------
revno: 464
revision-id: jelmer at samba.org-20080708131708-yxt38sxb793y2907
parent: jelmer at samba.org-20080708041503-8dyqwzy8sl3pc9ei
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: nestedtrees
timestamp: Tue 2008-07-08 15:17:08 +0200
message:
Support more syntaxes for externals.
modified:
properties.py util.py-20080502170127-o220e9py99vt69s6-1
tests/test_properties.py test_properties.py-20080703215223-t5ydp87wwi7dtyas-1
=== modified file 'properties.py'
--- a/properties.py 2008-07-08 03:02:15 +0000
+++ b/properties.py 2008-07-08 13:17:08 +0000
@@ -62,17 +62,29 @@
for l in val.splitlines():
if l == "" or l[0] == "#":
continue
- pts = l.rsplit(None, 2)
- if len(pts) == 3:
- if not pts[1].startswith("-r"):
+ pts = l.rsplit(None, 3)
+ if len(pts) == 4:
+ if pts[0] == "-r": # -r X URL DIR
+ revno = int(pts[1])
+ path = pts[3]
+ relurl = pts[2]
+ elif pts[1] == "-r": # DIR -r X URL
+ revno = int(pts[2])
+ path = pts[0]
+ relurl = pts[3]
+ else:
raise InvalidExternalsDescription()
- revno = int(pts[1][2:])
- if not is_url(pts[0]):
+ elif len(pts) == 3:
+ if pts[1].startswith("-r"): # DIR -rX URL
+ revno = int(pts[1][2:])
+ path = pts[0]
relurl = pts[2]
- path = pts[0]
- else:
- relurl = pts[0]
+ elif pts[0].startswith("-r"): # -rX URL DIR
+ revno = int(pts[0][2:])
path = pts[2]
+ relurl = pts[1]
+ else:
+ raise InvalidExternalsDescription()
elif len(pts) == 2:
if not is_url(pts[0]):
relurl = pts[1]
=== modified file 'tests/test_properties.py'
--- a/tests/test_properties.py 2008-07-08 03:02:15 +0000
+++ b/tests/test_properties.py 2008-07-08 13:17:08 +0000
@@ -48,6 +48,12 @@
third-party/skins http://skins.red-bean.com/repositories/skinproj
third-party/skins/toolkit -r21 http://svn.red-bean.com/repos/skin-maker"""))
+ def test_parse_externals_space_revno(self):
+ self.assertEqual({
+ 'third-party/skins/toolkit': (21, "http://svn.red-bean.com/repos/skin-maker")},
+ properties.parse_externals_description("http://example.com",
+"""third-party/skins/toolkit -r 21 http://svn.red-bean.com/repos/skin-maker"""))
+
def test_parse_externals_swapped(self):
self.assertEqual({'third-party/sounds': (None, "http://sounds.red-bean.com/repos")},
properties.parse_externals_description("http://example.com",
More information about the bazaar-commits
mailing list