dirstate: rename forget to drop
authorMatt Mackall <mpm@selenic.com>
Thu, 26 May 2011 17:15:35 -0500
changeset 14434 cc8c09855d19
parent 14433 7658221da551
child 14435 5f6090e559fa
dirstate: rename forget to drop It has substantially different semantics from forget at the command layer, so change it to avoid confusion. We can't simply combine it with remove because we need to explicitly drop non-added files in some cases like commit.
hgext/mq.py
mercurial/commands.py
mercurial/context.py
mercurial/dirstate.py
mercurial/localrepo.py
mercurial/merge.py
--- a/hgext/mq.py	Thu May 26 10:46:34 2011 +0200
+++ b/hgext/mq.py	Thu May 26 17:15:35 2011 -0500
@@ -1302,7 +1302,7 @@
                     except OSError, e:
                         if e.errno != errno.ENOENT:
                             raise
-                    repo.dirstate.forget(f)
+                    repo.dirstate.drop(f)
                 for f in m + r:
                     fctx = ctx[f]
                     repo.wwrite(f, fctx.data(), fctx.flags())
@@ -1480,7 +1480,7 @@
                 for f in mm:
                     repo.dirstate.normallookup(f)
                 for f in forget:
-                    repo.dirstate.forget(f)
+                    repo.dirstate.drop(f)
 
                 if not msg:
                     if not ph.message:
@@ -2617,7 +2617,7 @@
         wlock = r.wlock()
         try:
             if r.dirstate[patch] == 'a':
-                r.dirstate.forget(patch)
+                r.dirstate.drop(patch)
                 r.dirstate.add(name)
             else:
                 if r.dirstate[name] == 'r':
--- a/mercurial/commands.py	Thu May 26 10:46:34 2011 +0200
+++ b/mercurial/commands.py	Thu May 26 17:15:35 2011 -0500
@@ -4264,7 +4264,7 @@
             audit_path = scmutil.pathauditor(repo.root)
             for f in remove[0]:
                 if repo.dirstate[f] == 'a':
-                    repo.dirstate.forget(f)
+                    repo.dirstate.drop(f)
                     continue
                 audit_path(f)
                 try:
--- a/mercurial/context.py	Thu May 26 10:46:34 2011 +0200
+++ b/mercurial/context.py	Thu May 26 17:15:35 2011 -0500
@@ -842,7 +842,7 @@
                 if self._repo.dirstate[f] != 'a':
                     self._repo.ui.warn(_("%s not added!\n") % f)
                 else:
-                    self._repo.dirstate.forget(f)
+                    self._repo.dirstate.drop(f)
         finally:
             wlock.release()
 
@@ -863,7 +863,7 @@
                             raise
             for f in list:
                 if self._repo.dirstate[f] == 'a':
-                    self._repo.dirstate.forget(f)
+                    self._repo.dirstate.drop(f)
                 elif f not in self._repo.dirstate:
                     self._repo.ui.warn(_("%s not tracked!\n") % f)
                 else:
--- a/mercurial/dirstate.py	Thu May 26 10:46:34 2011 +0200
+++ b/mercurial/dirstate.py	Thu May 26 17:15:35 2011 -0500
@@ -365,14 +365,11 @@
         if f in self._copymap:
             del self._copymap[f]
 
-    def forget(self, f):
-        '''Forget a file.'''
+    def drop(self, f):
+        '''Drop a file from the dirstate'''
         self._dirty = True
-        try:
-            self._droppath(f)
-            del self._map[f]
-        except KeyError:
-            self._ui.warn(_("not in dirstate: %s\n") % f)
+        self._droppath(f)
+        del self._map[f]
 
     def _normalize(self, path, isknown):
         normed = os.path.normcase(path)
--- a/mercurial/localrepo.py	Thu May 26 10:46:34 2011 +0200
+++ b/mercurial/localrepo.py	Thu May 26 17:15:35 2011 -0500
@@ -1037,7 +1037,7 @@
             for f in changes[0] + changes[1]:
                 self.dirstate.normal(f)
             for f in changes[2]:
-                self.dirstate.forget(f)
+                self.dirstate.drop(f)
             self.dirstate.setparents(ret)
             ms.reset()
         finally:
--- a/mercurial/merge.py	Thu May 26 10:46:34 2011 +0200
+++ b/mercurial/merge.py	Thu May 26 17:15:35 2011 -0500
@@ -390,12 +390,12 @@
             if branchmerge:
                 repo.dirstate.remove(f)
             else:
-                repo.dirstate.forget(f)
+                repo.dirstate.drop(f)
         elif m == "a": # re-add
             if not branchmerge:
                 repo.dirstate.add(f)
         elif m == "f": # forget
-            repo.dirstate.forget(f)
+            repo.dirstate.drop(f)
         elif m == "e": # exec change
             repo.dirstate.normallookup(f)
         elif m == "g": # get
@@ -425,7 +425,7 @@
                 if f2 == fd: # file not locally copied/moved
                     repo.dirstate.normallookup(fd)
                 if move:
-                    repo.dirstate.forget(f)
+                    repo.dirstate.drop(f)
         elif m == "d": # directory rename
             f2, fd, flag = a[2:]
             if not f2 and f not in repo.dirstate:
@@ -441,7 +441,7 @@
             else:
                 repo.dirstate.normal(fd)
                 if f:
-                    repo.dirstate.forget(f)
+                    repo.dirstate.drop(f)
 
 def update(repo, node, branchmerge, force, partial, ancestor=None):
     """