revert: prefix variable names for dirstate status with "ds"
authorPierre-Yves David <pierre-yves.david@fb.com>
Tue, 24 Jun 2014 15:35:43 +0100
changeset 22154 fc422de25773
parent 22153 fc8bc2787528
child 22155 530390629842
revert: prefix variable names for dirstate status with "ds" As we are going to introduce status again other revision we needs to distinguish between data from dirstate status and the other one. We prefix the existing data with "ds" to highlight this.
mercurial/cmdutil.py
--- a/mercurial/cmdutil.py	Tue Jun 24 15:28:22 2014 +0100
+++ b/mercurial/cmdutil.py	Tue Jun 24 15:35:43 2014 +0100
@@ -2369,14 +2369,14 @@
         # Find status of all file in `names`. (Against working directory parent)
         m = scmutil.matchfiles(repo, names)
         changes = repo.status(node1=parent, match=m)[:4]
-        modified, added, removed, deleted = map(set, changes)
+        dsmodified, dsadded, dsremoved, dsdeleted = map(set, changes)
 
         # if f is a rename, update `names` to also revert the source
         cwd = repo.getcwd()
-        for f in added:
+        for f in dsadded:
             src = repo.dirstate.copied(f)
             if src and src not in names and repo.dirstate[src] == 'r':
-                removed.add(src)
+                dsremoved.add(src)
                 names[src] = (repo.pathto(src, cwd), True)
 
         ## computation of the action to performs on `names` content.
@@ -2389,14 +2389,14 @@
         # split between files known in target manifest and the others
         smf = set(mf)
 
-        missingmodified = modified - smf
-        modified -= missingmodified
-        missingadded = added - smf
-        added -= missingadded
-        missingremoved = removed - smf
-        removed -= missingremoved
-        missingdeleted = deleted - smf
-        deleted -= missingdeleted
+        missingmodified = dsmodified - smf
+        dsmodified -= missingmodified
+        missingadded = dsadded - smf
+        dsadded -= missingadded
+        missingremoved = dsremoved - smf
+        dsremoved -= missingremoved
+        missingdeleted = dsdeleted - smf
+        dsdeleted -= missingdeleted
 
         # action to be actually performed by revert
         # (<list of file>, message>) tuple
@@ -2410,13 +2410,13 @@
             #   file state
             #   action
             #   make backup
-            (modified,         (actions['revert'],   True)),
+            (dsmodified,       (actions['revert'],   True)),
             (missingmodified,  (actions['remove'],   True)),
-            (added,            (actions['revert'],   True)),
+            (dsadded,          (actions['revert'],   True)),
             (missingadded,     (actions['remove'],   False)),
-            (removed,          (actions['undelete'], True)),
+            (dsremoved,        (actions['undelete'], True)),
             (missingremoved,   (None,                False)),
-            (deleted,          (actions['revert'],   False)),
+            (dsdeleted,        (actions['revert'],   False)),
             (missingdeleted,   (actions['remove'],   False)),
             )