Mercurial > hg
comparison mercurial/commands.py @ 1188:b3ceb2d470fc
Fix up remove command to use walk code.
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Thu, 01 Sep 2005 07:48:14 -0700 |
parents | 120aa5fc7ced |
children | 4cbcc54695b2 |
comparison
equal
deleted
inserted
replaced
1187:120aa5fc7ced | 1188:b3ceb2d470fc |
---|---|
1260 | 1260 |
1261 def recover(ui, repo): | 1261 def recover(ui, repo): |
1262 """roll back an interrupted transaction""" | 1262 """roll back an interrupted transaction""" |
1263 repo.recover() | 1263 repo.recover() |
1264 | 1264 |
1265 def remove(ui, repo, file1, *files): | 1265 def remove(ui, repo, pat, *pats, **opts): |
1266 """remove the specified files on the next commit""" | 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 def revert(ui, repo, *names, **opts): | 1283 def revert(ui, repo, *names, **opts): |
1270 """revert modified files or dirs back to their unmodified states""" | 1284 """revert modified files or dirs back to their unmodified states""" |
1271 node = opts['rev'] and repo.lookup(opts['rev']) or \ | 1285 node = opts['rev'] and repo.lookup(opts['rev']) or \ |
1272 repo.dirstate.parents()[0] | 1286 repo.dirstate.parents()[0] |
1695 ('m', 'message', "", 'commit message'), | 1709 ('m', 'message', "", 'commit message'), |
1696 ('t', 'text', "", 'commit message (deprecated: use -m)'), | 1710 ('t', 'text', "", 'commit message (deprecated: use -m)'), |
1697 ('l', 'logfile', "", 'commit message file')], | 1711 ('l', 'logfile', "", 'commit message file')], |
1698 'hg rawcommit [OPTION]... [FILE]...'), | 1712 'hg rawcommit [OPTION]... [FILE]...'), |
1699 "recover": (recover, [], "hg recover"), | 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 "^revert": | 1718 "^revert": |
1702 (revert, | 1719 (revert, |
1703 [("n", "nonrecursive", None, "don't recurse into subdirs"), | 1720 [("n", "nonrecursive", None, "don't recurse into subdirs"), |
1704 ("r", "rev", "", "revision")], | 1721 ("r", "rev", "", "revision")], |
1705 "hg revert [-n] [-r REV] [NAME]..."), | 1722 "hg revert [-n] [-r REV] [NAME]..."), |