##// END OF EJS Templates
convert: make subversion revsplit more stable when meeting revisions without @...
Mads Kiilerich -
r20419:e61a8395 default
parent child Browse files
Show More
@@ -41,13 +41,30 class SvnPathNotFound(Exception):
41 41 pass
42 42
43 43 def revsplit(rev):
44 """Parse a revision string and return (uuid, path, revnum)."""
45 url, revnum = rev.rsplit('@', 1)
46 parts = url.split('/', 1)
44 """Parse a revision string and return (uuid, path, revnum).
45 >>> revsplit('svn:a2147622-4a9f-4db4-a8d3-13562ff547b2'
46 ... '/proj%20B/mytrunk/mytrunk@1')
47 ('a2147622-4a9f-4db4-a8d3-13562ff547b2', '/proj%20B/mytrunk/mytrunk', 1)
48 >>> revsplit('svn:8af66a51-67f5-4354-b62c-98d67cc7be1d@1')
49 ('', '', 1)
50 >>> revsplit('@7')
51 ('', '', 7)
52 >>> revsplit('7')
53 ('', '', 0)
54 >>> revsplit('bad')
55 ('', '', 0)
56 """
57 parts = rev.rsplit('@', 1)
58 revnum = 0
59 if len(parts) > 1:
60 revnum = int(parts[1])
61 parts = parts[0].split('/', 1)
62 uuid = ''
47 63 mod = ''
48 if len(parts) > 1:
64 if len(parts) > 1 and parts[0].startswith('svn:'):
65 uuid = parts[0][4:]
49 66 mod = '/' + parts[1]
50 return parts[0][4:], mod, int(revnum)
67 return uuid, mod, revnum
51 68
52 69 def quote(s):
53 70 # As of svn 1.7, many svn calls expect "canonical" paths. In
@@ -103,3 +103,14 hg back to svn should do nothing
103 103 scanning source...
104 104 sorting...
105 105 converting...
106
107 verify which shamap format we are storing and must be able to handle
108
109 $ cat svn-repo-hg/.hg/shamap
110 svn:????????-????-????-????-????????????@1 ???????????????????????????????????????? (glob)
111 svn:????????-????-????-????-????????????@2 ???????????????????????????????????????? (glob)
112 svn:????????-????-????-????-????????????@2 ???????????????????????????????????????? (glob)
113 $ cat svn-repo-wc/.svn/hg-shamap
114 ???????????????????????????????????????? 1 (glob)
115 ???????????????????????????????????????? svn:????????-????-????-????-????????????@2 (glob)
116 ???????????????????????????????????????? svn:????????-????-????-????-????????????@2 (glob)
@@ -27,3 +27,4 testmod('mercurial.util')
27 27 testmod('mercurial.util', testtarget='platform')
28 28 testmod('hgext.convert.cvsps')
29 29 testmod('hgext.convert.filemap')
30 testmod('hgext.convert.subversion')
General Comments 0
You need to be logged in to leave comments. Login now