Patchwork D7854: phases: make phasecache._phasesets immutable

login
register
mail settings
Submitter phabricator
Date Jan. 14, 2020, 2:22 p.m.
Message ID <19fc4386e4e76f29fd06c8420fb3c3e6@localhost.localdomain>
Download mbox | patch
Permalink /patch/44312/
State Not Applicable
Headers show

Comments

phabricator - Jan. 14, 2020, 2:22 p.m.
Closed by commit rHGc31ec768d70a: phases: make phasecache._phasesets immutable (authored by rdamazio).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7854?vs=19195&id=19206

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

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

AFFECTED FILES
  mercurial/phases.py

CHANGE DETAILS




To: rdamazio, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/phases.py b/mercurial/phases.py
--- a/mercurial/phases.py
+++ b/mercurial/phases.py
@@ -253,15 +253,19 @@ 
 
         # fast path: _phasesets contains the interesting sets,
         # might only need a union and post-filtering.
+        revsneedscopy = False
         if len(phases) == 1:
             [p] = phases
             revs = self._phasesets[p]
+            revsneedscopy = True  # Don't modify _phasesets
         else:
             # revs has the revisions in all *other* phases.
             revs = set.union(*[self._phasesets[p] for p in phases])
 
         def _addwdir(wdirsubset, wdirrevs):
             if wdirrev in wdirsubset and repo[None].phase() in phases:
+                if revsneedscopy:
+                    wdirrevs = wdirrevs.copy()
                 # The working dir would never be in the # cache, but it was in
                 # the subset being filtered for its phase (or filtered out,
                 # depending on publicphase), so add it to the output to be