equal
deleted
inserted
replaced
3 # Copyright 2009-2010 Olivia Mackall <olivia@selenic.com> |
3 # Copyright 2009-2010 Olivia Mackall <olivia@selenic.com> |
4 # |
4 # |
5 # This software may be used and distributed according to the terms of the |
5 # This software may be used and distributed according to the terms of the |
6 # GNU General Public License version 2 or any later version. |
6 # GNU General Public License version 2 or any later version. |
7 |
7 |
8 from __future__ import absolute_import |
8 |
9 |
|
10 import errno |
|
11 import os |
9 import os |
12 import posixpath |
10 import posixpath |
13 import re |
11 import re |
14 |
12 |
15 from .i18n import _ |
13 from .i18n import _ |
62 |
60 |
63 def read(f, sections=None, remap=None): |
61 def read(f, sections=None, remap=None): |
64 if f in ctx: |
62 if f in ctx: |
65 try: |
63 try: |
66 data = ctx[f].data() |
64 data = ctx[f].data() |
67 except IOError as err: |
65 except FileNotFoundError: |
68 if err.errno != errno.ENOENT: |
|
69 raise |
|
70 # handle missing subrepo spec files as removed |
66 # handle missing subrepo spec files as removed |
71 ui.warn( |
67 ui.warn( |
72 _(b"warning: subrepo spec file \'%s\' not found\n") |
68 _(b"warning: subrepo spec file \'%s\' not found\n") |
73 % repo.pathto(f) |
69 % repo.pathto(f) |
74 ) |
70 ) |
101 b"specifier in \'%s\' line %d" |
97 b"specifier in \'%s\' line %d" |
102 ) |
98 ) |
103 % (repo.pathto(b'.hgsubstate'), (i + 1)) |
99 % (repo.pathto(b'.hgsubstate'), (i + 1)) |
104 ) |
100 ) |
105 rev[path] = revision |
101 rev[path] = revision |
106 except IOError as err: |
102 except FileNotFoundError: |
107 if err.errno != errno.ENOENT: |
103 pass |
108 raise |
|
109 |
104 |
110 def remap(src): |
105 def remap(src): |
111 # type: (bytes) -> bytes |
106 # type: (bytes) -> bytes |
112 for pattern, repl in p.items(b'subpaths'): |
107 for pattern, repl in p.items(b'subpaths'): |
113 # Turn r'C:\foo\bar' into r'C:\\foo\\bar' since re.sub |
108 # Turn r'C:\foo\bar' into r'C:\\foo\\bar' since re.sub |
189 if r: |
184 if r: |
190 r = b"%s:%s:%s" % r |
185 r = b"%s:%s:%s" % r |
191 repo.ui.debug(b" subrepo %s: %s %s\n" % (s, msg, r)) |
186 repo.ui.debug(b" subrepo %s: %s %s\n" % (s, msg, r)) |
192 |
187 |
193 promptssrc = filemerge.partextras(labels) |
188 promptssrc = filemerge.partextras(labels) |
194 for s, l in sorted(pycompat.iteritems(s1)): |
189 for s, l in sorted(s1.items()): |
195 a = sa.get(s, nullstate) |
190 a = sa.get(s, nullstate) |
196 ld = l # local state with possible dirty flag for compares |
191 ld = l # local state with possible dirty flag for compares |
197 if wctx.sub(s).dirty(): |
192 if wctx.sub(s).dirty(): |
198 ld = (l[0], l[1] + b"+") |
193 ld = (l[0], l[1] + b"+") |
199 if wctx == actx: # overwrite |
194 if wctx == actx: # overwrite |