This is a functional NOP other than reducing some of the duplication
in that method.
Details
Details
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Branch
- default
- Lint
No Linters Available - Unit
No Unit Test Coverage
This is a functional NOP other than reducing some of the duplication
in that method.
No Linters Available |
No Unit Test Coverage |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/phases.py (59 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
7036807158a3 | 8e09551206f5 | Rodrigo Damazio Bovendorp | Jan 13 2020, 10:06 PM |
self._phasesets = None | self._phasesets = None | ||||
self.filterunknown(repo) | self.filterunknown(repo) | ||||
self.opener = repo.svfs | self.opener = repo.svfs | ||||
def getrevset(self, repo, phases, subset=None): | def getrevset(self, repo, phases, subset=None): | ||||
"""return a smartset for the given phases""" | """return a smartset for the given phases""" | ||||
self.loadphaserevs(repo) # ensure phase's sets are loaded | self.loadphaserevs(repo) # ensure phase's sets are loaded | ||||
phases = set(phases) | phases = set(phases) | ||||
publicphase = public in phases | |||||
if publicphase: | |||||
# In this case, phases keeps all the *other* phases. | |||||
phases = set(allphases).difference(phases) | |||||
if not phases: | |||||
return smartset.fullreposet(repo) | |||||
if public not in phases: | |||||
# fast path: _phasesets contains the interesting sets, | # fast path: _phasesets contains the interesting sets, | ||||
# might only need a union and post-filtering. | # might only need a union and post-filtering. | ||||
if len(phases) == 1: | if len(phases) == 1: | ||||
[p] = phases | [p] = phases | ||||
revs = self._phasesets[p] | revs = self._phasesets[p] | ||||
else: | else: | ||||
# revs has the revisions in all *other* phases. | |||||
revs = set.union(*[self._phasesets[p] for p in 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: | |||||
# 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 | |||||
# included (or filtered out). | |||||
wdirrevs.add(wdirrev) | |||||
return wdirrevs | |||||
if not publicphase: | |||||
if repo.changelog.filteredrevs: | if repo.changelog.filteredrevs: | ||||
revs = revs - repo.changelog.filteredrevs | revs = revs - repo.changelog.filteredrevs | ||||
if subset is None: | if subset is None: | ||||
return smartset.baseset(revs) | return smartset.baseset(revs) | ||||
else: | else: | ||||
if wdirrev in subset and repo[None].phase() in phases: | revs = _addwdir(subset, revs) | ||||
# The working dir would never be in the cache, but it was | |||||
# in the subset being filtered for its phase, so add it to | |||||
# the output. | |||||
revs.add(wdirrev) | |||||
return subset & smartset.baseset(revs) | return subset & smartset.baseset(revs) | ||||
else: | else: | ||||
# phases keeps all the *other* phases. | |||||
phases = set(allphases).difference(phases) | |||||
if not phases: | |||||
return smartset.fullreposet(repo) | |||||
# revs has the revisions in all *other* phases. | |||||
if len(phases) == 1: | |||||
[p] = phases | |||||
revs = self._phasesets[p] | |||||
else: | |||||
revs = set.union(*[self._phasesets[p] for p in phases]) | |||||
if subset is None: | if subset is None: | ||||
subset = smartset.fullreposet(repo) | subset = smartset.fullreposet(repo) | ||||
if wdirrev in subset and repo[None].phase() in phases: | revs = _addwdir(subset, revs) | ||||
# The working dir is in the subset being filtered, and its | |||||
# phase is in the phases *not* being returned, so add it to the | |||||
# set of revisions to filter out. | |||||
revs.add(wdirrev) | |||||
if not revs: | if not revs: | ||||
return subset | return subset | ||||
return subset.filter(lambda r: r not in revs) | return subset.filter(lambda r: r not in revs) | ||||
def copy(self): | def copy(self): | ||||
# Shallow copy meant to ensure isolation in | # Shallow copy meant to ensure isolation in | ||||
# advance/retractboundary(), nothing more. | # advance/retractboundary(), nothing more. |