comparison mercurial/subrepo.py @ 16596:95ca6c8b38da stable

subrepo: do not traceback on .hgsubstate parsing errors Note that aborting in subrepo.state() prevents "repairing" commands like revert to be issued. The user will have to edit the .hgsubstate manually (but he probably had already otherwise this would not be failing). The same behaviour already happens with invalid .hgsub entries.
author Patrick Mezard <patrick@mezard.eu>
date Fri, 04 May 2012 14:19:55 +0200
parents 2de6ac4ac17c
children 525fdb738975 33b057778cd2
comparison
equal deleted inserted replaced
16595:2de6ac4ac17c 16596:95ca6c8b38da
41 p.set('subpaths', path, src, ui.configsource('subpaths', path)) 41 p.set('subpaths', path, src, ui.configsource('subpaths', path))
42 42
43 rev = {} 43 rev = {}
44 if '.hgsubstate' in ctx: 44 if '.hgsubstate' in ctx:
45 try: 45 try:
46 for l in ctx['.hgsubstate'].data().splitlines(): 46 for i, l in enumerate(ctx['.hgsubstate'].data().splitlines()):
47 l = l.lstrip() 47 l = l.lstrip()
48 if not l: 48 if not l:
49 continue 49 continue
50 revision, path = l.split(" ", 1) 50 try:
51 revision, path = l.split(" ", 1)
52 except ValueError:
53 raise util.Abort(_("invalid subrepository revision "
54 "specifier in .hgsubstate line %d")
55 % (i + 1))
51 rev[path] = revision 56 rev[path] = revision
52 except IOError, err: 57 except IOError, err:
53 if err.errno != errno.ENOENT: 58 if err.errno != errno.ENOENT:
54 raise 59 raise
55 60