context: make forget work like commands.forget
Switch users of wctx.delete(..., False) to forget.
--- a/hgext/mq.py Thu May 26 17:15:35 2011 -0500
+++ b/hgext/mq.py Thu May 26 17:15:35 2011 -0500
@@ -735,10 +735,9 @@
if not keep:
r = self.qrepo()
if r:
- r[None].remove(patches, True)
- else:
- for p in patches:
- os.unlink(self.join(p))
+ r[None].forget(patches)
+ for p in patches:
+ os.unlink(self.join(p))
if numrevs:
qfinished = self.applied[:numrevs]
@@ -2623,7 +2622,7 @@
if r.dirstate[name] == 'r':
wctx.undelete([name])
wctx.copy(patch, name)
- wctx.remove([patch], False)
+ wctx.forget([patch])
finally:
wlock.release()
--- a/mercurial/commands.py Thu May 26 17:15:35 2011 -0500
+++ b/mercurial/commands.py Thu May 26 17:15:35 2011 -0500
@@ -2269,7 +2269,7 @@
if ui.verbose or not m.exact(f):
ui.status(_('removing %s\n') % m.rel(f))
- repo[None].remove(forget, unlink=False)
+ repo[None].forget(forget)
return errs
@command('grep',
--- a/mercurial/context.py Thu May 26 17:15:35 2011 -0500
+++ b/mercurial/context.py Thu May 26 17:15:35 2011 -0500
@@ -835,12 +835,14 @@
finally:
wlock.release()
- def forget(self, list):
+ def forget(self, files):
wlock = self._repo.wlock()
try:
- for f in list:
+ for f in files:
if self._repo.dirstate[f] != 'a':
- self._repo.ui.warn(_("%s not added!\n") % f)
+ self._repo.dirstate.remove(f)
+ elif f not in self._repo.dirstate:
+ self._repo.ui.warn(_("%s not tracked!\n") % f)
else:
self._repo.dirstate.drop(f)
finally:
--- a/mercurial/patch.py Thu May 26 17:15:35 2011 -0500
+++ b/mercurial/patch.py Thu May 26 17:15:35 2011 -0500
@@ -489,7 +489,7 @@
scmutil.dirstatecopy(self.ui, self.repo, wctx, src, dst)
addremoved.discard(src)
if (not self.similarity) and self.removed:
- wctx.remove(sorted(self.removed))
+ wctx.forget(sorted(self.removed))
if addremoved:
cwd = self.repo.getcwd()
if cwd:
--- a/mercurial/scmutil.py Thu May 26 17:15:35 2011 -0500
+++ b/mercurial/scmutil.py Thu May 26 17:15:35 2011 -0500
@@ -623,7 +623,7 @@
wctx = repo[None]
wlock = repo.wlock()
try:
- wctx.remove(deleted)
+ wctx.forget(deleted)
wctx.add(unknown)
for new, old in copies.iteritems():
wctx.copy(old, new)