##// END OF EJS Templates
add: fix subrepo recursion for explicit path handling...
David M. Carr -
r15911:c654eac0 default
parent child Browse files
Show More
@@ -1162,7 +1162,7 b' def walkchangerevs(repo, match, opts, pr'
1162 1162 yield change(rev)
1163 1163 return iterate()
1164 1164
1165 def add(ui, repo, match, dryrun, listsubrepos, prefix):
1165 def add(ui, repo, match, dryrun, listsubrepos, prefix, explicitonly):
1166 1166 join = lambda f: os.path.join(prefix, f)
1167 1167 bad = []
1168 1168 oldbad = match.bad
@@ -1175,7 +1175,7 b' def add(ui, repo, match, dryrun, listsub'
1175 1175 cca = scmutil.casecollisionauditor(ui, abort, wctx)
1176 1176 for f in repo.walk(match):
1177 1177 exact = match.exact(f)
1178 if exact or f not in repo.dirstate:
1178 if exact or not explicitonly and f not in repo.dirstate:
1179 1179 if cca:
1180 1180 cca(f)
1181 1181 names.append(f)
@@ -1187,11 +1187,11 b' def add(ui, repo, match, dryrun, listsub'
1187 1187 try:
1188 1188 submatch = matchmod.narrowmatcher(subpath, match)
1189 1189 if listsubrepos:
1190 bad.extend(sub.add(ui, submatch, dryrun, prefix))
1190 bad.extend(sub.add(ui, submatch, dryrun, listsubrepos, prefix,
1191 False))
1191 1192 else:
1192 for f in sub.walk(submatch):
1193 if submatch.exact(f):
1194 bad.extend(sub.add(ui, submatch, dryrun, prefix))
1193 bad.extend(sub.add(ui, submatch, dryrun, listsubrepos, prefix,
1194 True))
1195 1195 except error.LookupError:
1196 1196 ui.status(_("skipping missing subrepository: %s\n")
1197 1197 % join(subpath))
@@ -174,7 +174,7 b' def add(ui, repo, *pats, **opts):'
174 174
175 175 m = scmutil.match(repo[None], pats, opts)
176 176 rejected = cmdutil.add(ui, repo, m, opts.get('dry_run'),
177 opts.get('subrepos'), prefix="")
177 opts.get('subrepos'), prefix="", explicitonly=False)
178 178 return rejected and 1 or 0
179 179
180 180 @command('addremove',
@@ -310,7 +310,7 b' class abstractsubrepo(object):'
310 310 """
311 311 raise NotImplementedError
312 312
313 def add(self, ui, match, dryrun, prefix):
313 def add(self, ui, match, dryrun, listsubrepos, prefix, explicitonly):
314 314 return []
315 315
316 316 def status(self, rev2, **opts):
@@ -396,9 +396,9 b' class hgsubrepo(abstractsubrepo):'
396 396 addpathconfig('default-push', defpushpath)
397 397 fp.close()
398 398
399 def add(self, ui, match, dryrun, prefix):
400 return cmdutil.add(ui, self._repo, match, dryrun, True,
401 os.path.join(prefix, self._path))
399 def add(self, ui, match, dryrun, listsubrepos, prefix, explicitonly):
400 return cmdutil.add(ui, self._repo, match, dryrun, listsubrepos,
401 os.path.join(prefix, self._path), explicitonly)
402 402
403 403 def status(self, rev2, **opts):
404 404 try:
@@ -193,11 +193,6 b' Test explicit path commands within subre'
193 193 $ hg status -S
194 194 ? foo/bar/z2.txt
195 195 $ hg add foo/bar/z2.txt
196 This is expected to add the file, but is currently broken
197 $ hg status -S
198 ? foo/bar/z2.txt
199 When fixed, remove the next two commands
200 $ hg add -R foo/bar foo/bar/z2.txt
201 196 $ hg status -S
202 197 A foo/bar/z2.txt
203 198 This is expected to forget the file, but is currently broken
General Comments 0
You need to be logged in to leave comments. Login now