equal
deleted
inserted
replaced
10 from i18n import _ |
10 from i18n import _ |
11 import config, util, node, error, cmdutil |
11 import config, util, node, error, cmdutil |
12 hg = None |
12 hg = None |
13 |
13 |
14 nullstate = ('', '', 'empty') |
14 nullstate = ('', '', 'empty') |
|
15 |
|
16 |
|
17 def substate(ctx): |
|
18 rev = {} |
|
19 if '.hgsubstate' in ctx: |
|
20 try: |
|
21 for l in ctx['.hgsubstate'].data().splitlines(): |
|
22 revision, path = l.split(" ", 1) |
|
23 rev[path] = revision |
|
24 except IOError as err: |
|
25 if err.errno != errno.ENOENT: |
|
26 raise |
|
27 return rev |
15 |
28 |
16 def state(ctx, ui): |
29 def state(ctx, ui): |
17 """return a state dict, mapping subrepo paths configured in .hgsub |
30 """return a state dict, mapping subrepo paths configured in .hgsub |
18 to tuple: (source from .hgsub, revision from .hgsubstate, kind |
31 to tuple: (source from .hgsub, revision from .hgsubstate, kind |
19 (key in types dict)) |
32 (key in types dict)) |
37 read('.hgsub') |
50 read('.hgsub') |
38 |
51 |
39 for path, src in ui.configitems('subpaths'): |
52 for path, src in ui.configitems('subpaths'): |
40 p.set('subpaths', path, src, ui.configsource('subpaths', path)) |
53 p.set('subpaths', path, src, ui.configsource('subpaths', path)) |
41 |
54 |
42 rev = {} |
55 rev = substate(ctx) |
43 if '.hgsubstate' in ctx: |
|
44 try: |
|
45 for l in ctx['.hgsubstate'].data().splitlines(): |
|
46 revision, path = l.split(" ", 1) |
|
47 rev[path] = revision |
|
48 except IOError, err: |
|
49 if err.errno != errno.ENOENT: |
|
50 raise |
|
51 |
56 |
52 state = {} |
57 state = {} |
53 for path, src in p[''].items(): |
58 for path, src in p[''].items(): |
54 kind = 'hg' |
59 kind = 'hg' |
55 if src.startswith('['): |
60 if src.startswith('['): |