##// END OF EJS Templates
subrepo: refactor state function
Martin Geisler -
r15149:eaec9cf9 default
parent child Browse files
Show More
@@ -50,15 +50,7 b' def state(ctx, ui):'
50 if err.errno != errno.ENOENT:
50 if err.errno != errno.ENOENT:
51 raise
51 raise
52
52
53 state = {}
53 def remap(src):
54 for path, src in p[''].items():
55 kind = 'hg'
56 if src.startswith('['):
57 if ']' not in src:
58 raise util.Abort(_('missing ] in subrepo source'))
59 kind, src = src.split(']', 1)
60 kind = kind[1:]
61
62 for pattern, repl in p.items('subpaths'):
54 for pattern, repl in p.items('subpaths'):
63 # Turn r'C:\foo\bar' into r'C:\\foo\\bar' since re.sub
55 # Turn r'C:\foo\bar' into r'C:\\foo\\bar' since re.sub
64 # does a string decode.
56 # does a string decode.
@@ -72,7 +64,17 b' def state(ctx, ui):'
72 except re.error, e:
64 except re.error, e:
73 raise util.Abort(_("bad subrepository pattern in %s: %s")
65 raise util.Abort(_("bad subrepository pattern in %s: %s")
74 % (p.source('subpaths', pattern), e))
66 % (p.source('subpaths', pattern), e))
67 return src
75
68
69 state = {}
70 for path, src in p[''].items():
71 kind = 'hg'
72 if src.startswith('['):
73 if ']' not in src:
74 raise util.Abort(_('missing ] in subrepo source'))
75 kind, src = src.split(']', 1)
76 kind = kind[1:]
77 src = remap(src)
76 state[path] = (src.strip(), rev.get(path, ''), kind)
78 state[path] = (src.strip(), rev.get(path, ''), kind)
77
79
78 return state
80 return state
General Comments 0
You need to be logged in to leave comments. Login now