##// END OF EJS Templates
add: support adding explicit files in subrepos...
David M. Carr -
r15410:9e99d2bb default
parent child Browse files
Show More
@@ -1165,15 +1165,19 b' def add(ui, repo, match, dryrun, listsub'
1165 1165 if ui.verbose or not exact:
1166 1166 ui.status(_('adding %s\n') % match.rel(join(f)))
1167 1167
1168 if listsubrepos:
1169 for subpath in wctx.substate:
1170 sub = wctx.sub(subpath)
1171 try:
1172 submatch = matchmod.narrowmatcher(subpath, match)
1168 for subpath in wctx.substate:
1169 sub = wctx.sub(subpath)
1170 try:
1171 submatch = matchmod.narrowmatcher(subpath, match)
1172 if listsubrepos:
1173 1173 bad.extend(sub.add(ui, submatch, dryrun, prefix))
1174 except error.LookupError:
1175 ui.status(_("skipping missing subrepository: %s\n")
1176 % join(subpath))
1174 else:
1175 for f in sub.walk(submatch):
1176 if submatch.exact(f):
1177 bad.extend(sub.add(ui, submatch, dryrun, prefix))
1178 except error.LookupError:
1179 ui.status(_("skipping missing subrepository: %s\n")
1180 % join(subpath))
1177 1181
1178 1182 if not dryrun:
1179 1183 rejected = wctx.add(names, prefix)
@@ -73,7 +73,9 b' Interaction with Mercurial Commands'
73 73 -----------------------------------
74 74
75 75 :add: add does not recurse in subrepos unless -S/--subrepos is
76 specified. Subversion subrepositories are currently silently
76 specified. However, if you specify the full path of a file in a
77 subrepo, it will be added even without -S/--subrepos specified.
78 Subversion subrepositories are currently silently
77 79 ignored.
78 80
79 81 :archive: archive does not recurse in subrepositories unless
@@ -353,6 +353,12 b' class abstractsubrepo(object):'
353 353 unit=_('files'), total=total)
354 354 ui.progress(_('archiving (%s)') % relpath, None)
355 355
356 def walk(self, match):
357 '''
358 walk recursively through the directory tree, finding all files
359 matched by the match function
360 '''
361 pass
356 362
357 363 class hgsubrepo(abstractsubrepo):
358 364 def __init__(self, ctx, path, state):
@@ -543,6 +549,9 b' class hgsubrepo(abstractsubrepo):'
543 549 ctx = self._repo[rev]
544 550 return ctx.flags(name)
545 551
552 def walk(self, match):
553 ctx = self._repo[None]
554 return ctx.walk(match)
546 555
547 556 class svnsubrepo(abstractsubrepo):
548 557 def __init__(self, ctx, path, state):
@@ -892,7 +892,7 b' Test behavior of add for explicit path i'
892 892 $ hg init s
893 893 $ hg ci -m0
894 894 committing subrepository s
895 Adding with an explicit path in a subrepo currently fails silently
895 Adding with an explicit path in a subrepo adds the file
896 896 $ echo c1 > f1
897 897 $ echo c2 > s/f2
898 898 $ hg st -S
@@ -900,14 +900,13 b' Adding with an explicit path in a subrep'
900 900 ? s/f2
901 901 $ hg add s/f2
902 902 $ hg st -S
903 A s/f2
903 904 ? f1
904 ? s/f2
905 $ hg ci -R s -Am0
906 adding f2
905 $ hg ci -R s -m0
907 906 $ hg ci -Am1
908 907 adding f1
909 908 committing subrepository s
910 Adding with an explicit path in a subrepo with -S adds the file
909 Adding with an explicit path in a subrepo with -S has the same behavior
911 910 $ echo c3 > f3
912 911 $ echo c4 > s/f4
913 912 $ hg st -S
General Comments 0
You need to be logged in to leave comments. Login now