Patchwork D5889: context: replace repeated "self._repo.dirstate" by "ds" variable

login
register
mail settings
Submitter phabricator
Date Feb. 8, 2019, 12:45 p.m.
Message ID <f55f8ab32542c05e8062c76178cb785d@localhost.localdomain>
Download mbox | patch
Permalink /patch/38549/
State Not Applicable
Headers show

Comments

phabricator - Feb. 8, 2019, 12:45 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGfbd4ce55bcbd: context: replace repeated &quot;self._repo.dirstate&quot; by &quot;ds&quot; variable (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5889?vs=13903&id=13913

REVISION DETAIL
  https://phab.mercurial-scm.org/D5889

AFFECTED FILES
  mercurial/context.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers, pulkit
Cc: mercurial-devel

Patch

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -1355,13 +1355,13 @@ 
             uipath = lambda f: ds.pathto(pathutil.join(prefix, f))
             rejected = []
             for f in files:
-                if f not in self._repo.dirstate:
+                if f not in ds:
                     self._repo.ui.warn(_("%s not tracked!\n") % uipath(f))
                     rejected.append(f)
-                elif self._repo.dirstate[f] != 'a':
-                    self._repo.dirstate.remove(f)
+                elif ds[f] != 'a':
+                    ds.remove(f)
                 else:
-                    self._repo.dirstate.drop(f)
+                    ds.drop(f)
             return rejected
 
     def copy(self, source, dest):
@@ -1379,11 +1379,12 @@ 
                                % self._repo.dirstate.pathto(dest))
         else:
             with self._repo.wlock():
-                if self._repo.dirstate[dest] in '?':
-                    self._repo.dirstate.add(dest)
-                elif self._repo.dirstate[dest] in 'r':
-                    self._repo.dirstate.normallookup(dest)
-                self._repo.dirstate.copy(source, dest)
+                ds = self._repo.dirstate
+                if ds[dest] in '?':
+                    ds.add(dest)
+                elif ds[dest] in 'r':
+                    ds.normallookup(dest)
+                ds.copy(source, dest)
 
     def match(self, pats=None, include=None, exclude=None, default='glob',
               listsubrepos=False, badfn=None):