Patchwork D6837: cleanup: fix leakage of dirstate._map to client code

login
register
mail settings
Submitter phabricator
Date Sept. 12, 2019, 6:27 a.m.
Message ID <86ae8ddd9a592685e4b829d7e6466303@localhost.localdomain>
Download mbox | patch
Permalink /patch/41648/
State Not Applicable
Headers show

Comments

phabricator - Sept. 12, 2019, 6:27 a.m.
Closed by commit rHG34ed651ba7e4: cleanup: fix leakage of dirstate._map to client code (authored by durin42).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6837?vs=16505&id=16521

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6837/new/

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

AFFECTED FILES
  hgext/largefiles/reposetup.py
  mercurial/debugcommands.py
  mercurial/scmutil.py

CHANGE DETAILS




To: durin42, #hg-reviewers, indygreg, pulkit
Cc: mharbison72, mercurial-devel

Patch

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -319,7 +319,7 @@ 
     def __init__(self, ui, abort, dirstate):
         self._ui = ui
         self._abort = abort
-        allfiles = '\0'.join(dirstate._map)
+        allfiles = '\0'.join(dirstate)
         self._loweredfiles = set(encoding.lower(allfiles).split('\0'))
         self._dirstate = dirstate
         # The purpose of _newfiles is so that we don't complain about
diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -751,7 +751,7 @@ 
         keyfunc = lambda x: (x[1][3], x[0]) # sort by mtime, then by filename
     else:
         keyfunc = None # sort by filename
-    for file_, ent in sorted(repo.dirstate._map.iteritems(), key=keyfunc):
+    for file_, ent in sorted(repo.dirstate.iteritems(), key=keyfunc):
         if ent[3] == -1:
             timestr = 'unset               '
         elif nodates:
diff --git a/hgext/largefiles/reposetup.py b/hgext/largefiles/reposetup.py
--- a/hgext/largefiles/reposetup.py
+++ b/hgext/largefiles/reposetup.py
@@ -234,7 +234,7 @@ 
                     result[2] = [f for f in result[2]
                                  if f not in lfdirstate]
 
-                    lfiles = set(lfdirstate._map)
+                    lfiles = set(lfdirstate)
                     # Unknown files
                     result[4] = set(result[4]).difference(lfiles)
                     # Ignored files