comparison mercurial/subrepo.py @ 13172:84cec5895d01

subrepo: backout f02d7a562a21 backing out f02d7a562a21 because it introduced a bug in .hgsubstate handling.
author Erik Zielke <ez@aragost.com>
date Fri, 17 Dec 2010 13:38:15 +0100
parents 07d08c130892
children be7e8e9bc5e5
comparison
equal deleted inserted replaced
13171:b546db00cfd7 13172:84cec5895d01
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, err:
25 if err.errno != errno.ENOENT:
26 raise
27 return rev
28 15
29 def state(ctx, ui): 16 def state(ctx, ui):
30 """return a state dict, mapping subrepo paths configured in .hgsub 17 """return a state dict, mapping subrepo paths configured in .hgsub
31 to tuple: (source from .hgsub, revision from .hgsubstate, kind 18 to tuple: (source from .hgsub, revision from .hgsubstate, kind
32 (key in types dict)) 19 (key in types dict))
50 read('.hgsub') 37 read('.hgsub')
51 38
52 for path, src in ui.configitems('subpaths'): 39 for path, src in ui.configitems('subpaths'):
53 p.set('subpaths', path, src, ui.configsource('subpaths', path)) 40 p.set('subpaths', path, src, ui.configsource('subpaths', path))
54 41
55 rev = substate(ctx) 42 rev = {}
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
56 51
57 state = {} 52 state = {}
58 for path, src in p[''].items(): 53 for path, src in p[''].items():
59 kind = 'hg' 54 kind = 'hg'
60 if src.startswith('['): 55 if src.startswith('['):