[PATCH 1 of 5] workingctx: introduce new unlinkadded parameter on remove()
Adrian Buehlmann
adrian at cadifra.com
Mon May 23 09:56:09 CDT 2011
# HG changeset patch
# User Adrian Buehlmann <adrian at cadifra.com>
# Date 1306140176 -7200
# Node ID 647a8cde6157b77484e7074e295bd84415b57cd5
# Parent 2c9f5897d4b7e163502b6ce56287d400da738d89
workingctx: introduce new unlinkadded parameter on remove()
and don't warn about still existing added files
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -851,9 +851,11 @@
*[p.rev() for p in self._parents]):
yield changectx(self._repo, a)
- def remove(self, list, unlink=False):
+ def remove(self, list, unlink=False, unlinkadded=True):
if unlink:
for f in list:
+ if not unlinkadded and self._repo.dirstate[f] == 'a':
+ continue
try:
util.unlinkpath(self._repo.wjoin(f))
except OSError, inst:
@@ -862,10 +864,10 @@
wlock = self._repo.wlock()
try:
for f in list:
- if unlink and os.path.lexists(self._repo.wjoin(f)):
+ if self._repo.dirstate[f] == 'a':
+ self._repo.dirstate.forget(f)
+ elif unlink and os.path.lexists(self._repo.wjoin(f)):
self._repo.ui.warn(_("%s still exists!\n") % f)
- elif self._repo.dirstate[f] == 'a':
- self._repo.dirstate.forget(f)
elif f not in self._repo.dirstate:
self._repo.ui.warn(_("%s not tracked!\n") % f)
else:
More information about the Mercurial-devel
mailing list