##// END OF EJS Templates
Make removal check more complete and informative.
Bryan O'Sullivan -
r1189:4cbcc546 default
parent child Browse files
Show More
@@ -1265,18 +1265,19 b' def recover(ui, repo):'
1265 def remove(ui, repo, pat, *pats, **opts):
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 names = []
1267 names = []
1268 def okaytoremove(abs, rel, exact):
1269 c, a, d, u = repo.changes(files = [abs])
1270 reason = None
1271 if c: reason = 'is modified'
1272 elif a: reason = 'has been marked for add'
1273 elif u: reason = 'not managed'
1274 if reason and exact:
1275 ui.warn('not removing %s: file %s\n' % (rel, reason))
1276 else:
1277 return True
1268 for src, abs, rel, exact in walk(repo, (pat,) + pats, opts):
1278 for src, abs, rel, exact in walk(repo, (pat,) + pats, opts):
1269 if exact:
1279 if okaytoremove(abs, rel, exact):
1270 skip = {'m': 'file has pending merge',
1280 if not exact: ui.status('removing %s\n' % rel)
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 names.append(abs)
1281 repo.remove(names)
1282 repo.remove(names)
1282
1283
General Comments 0
You need to be logged in to leave comments. Login now