##// END OF EJS Templates
Fix up remove command to use walk code.
Bryan O'Sullivan -
r1188:b3ceb2d4 default
parent child Browse files
Show More
@@ -403,7 +403,7 b' recover::'
403 403 This command tries to fix the repository status after an interrupted
404 404 operation. It should only be necessary when Mercurial suggests it.
405 405
406 remove [files ...]::
406 remove [options] [files ...]::
407 407 Schedule the indicated files for removal from the repository.
408 408
409 409 This command schedules the files to be removed at the next commit.
@@ -1262,9 +1262,23 b' def recover(ui, repo):'
1262 1262 """roll back an interrupted transaction"""
1263 1263 repo.recover()
1264 1264
1265 def remove(ui, repo, file1, *files):
1265 def remove(ui, repo, pat, *pats, **opts):
1266 1266 """remove the specified files on the next commit"""
1267 repo.remove(relpath(repo, (file1,) + files))
1267 names = []
1268 for src, abs, rel, exact in walk(repo, (pat,) + pats, opts):
1269 if exact:
1270 skip = {'m': 'file has pending merge',
1271 'a': 'file has been marked for add (use forget)',
1272 '?': 'file not managed'}
1273 reason = skip.get(repo.dirstate.state(abs))
1274 if reason:
1275 ui.warn('not removing %s: %s\n' % (rel, reason))
1276 else:
1277 names.append(abs)
1278 elif repo.dirstate.state(abs) == 'n':
1279 ui.status('removing %s\n' % rel)
1280 names.append(abs)
1281 repo.remove(names)
1268 1282
1269 1283 def revert(ui, repo, *names, **opts):
1270 1284 """revert modified files or dirs back to their unmodified states"""
@@ -1697,7 +1711,10 b' table = {'
1697 1711 ('l', 'logfile', "", 'commit message file')],
1698 1712 'hg rawcommit [OPTION]... [FILE]...'),
1699 1713 "recover": (recover, [], "hg recover"),
1700 "^remove|rm": (remove, [], "hg remove FILE..."),
1714 "^remove|rm": (remove,
1715 [('I', 'include', [], 'include path in search'),
1716 ('X', 'exclude', [], 'exclude path from search')],
1717 "hg remove [OPTION]... FILE..."),
1701 1718 "^revert":
1702 1719 (revert,
1703 1720 [("n", "nonrecursive", None, "don't recurse into subdirs"),
General Comments 0
You need to be logged in to leave comments. Login now