Submitter | Pierre-Yves David |
---|---|
Date | April 11, 2017, 10:47 p.m. |
Message ID | <d597e0ce2aaaab926589.1491950868@nodosa.octopoid.net> |
Download | mbox | patch |
Permalink | /patch/20120/ |
State | Accepted |
Headers | show |
Comments
On 4/11/17 11:47 PM, Pierre-Yves David wrote: > # HG changeset patch > # User Pierre-Yves David <pierre-yves.david@ens-lyon.org> > # Date 1491583167 -7200 > # Fri Apr 07 18:39:27 2017 +0200 > # Node ID d597e0ce2aaaab926589a648caaf2cc6de0c14ce > # Parent 0ac92cae04221762209a3e58ef95ef7c0092c764 > # EXP-Topic upgraderepo > upgrade: simplify 'determineactions' > > Since we only takes 'deficiencies', we can simplify the function and clarify its s/takes/take > arguments. > > diff --git a/mercurial/upgrade.py b/mercurial/upgrade.py > --- a/mercurial/upgrade.py > +++ b/mercurial/upgrade.py > @@ -261,7 +261,7 @@ def findoptimizations(repo): > > return optimizations > > -def determineactions(repo, improvements, sourcereqs, destreqs): > +def determineactions(repo, deficiencies, sourcereqs, destreqs): > """Determine upgrade actions that will be performed. > > Given a list of improvements as returned by ``finddeficiencies`` and > @@ -278,16 +278,15 @@ def determineactions(repo, improvements, > > knownreqs = supporteddestrequirements(repo) > > - for i in improvements: > - name = i.name > + for d in deficiencies: > + name = d.name > > # If the action is a requirement that doesn't show up in the > # destination requirements, prune the action. > if name in knownreqs and name not in destreqs: > continue > > - if i.type == deficiency: > - newactions.append(name) > + newactions.append(name) > > # FUTURE consider adding some optimizations here for certain transitions. > # e.g. adding generaldelta could schedule parent redeltas. >
Patch
diff --git a/mercurial/upgrade.py b/mercurial/upgrade.py --- a/mercurial/upgrade.py +++ b/mercurial/upgrade.py @@ -261,7 +261,7 @@ def findoptimizations(repo): return optimizations -def determineactions(repo, improvements, sourcereqs, destreqs): +def determineactions(repo, deficiencies, sourcereqs, destreqs): """Determine upgrade actions that will be performed. Given a list of improvements as returned by ``finddeficiencies`` and @@ -278,16 +278,15 @@ def determineactions(repo, improvements, knownreqs = supporteddestrequirements(repo) - for i in improvements: - name = i.name + for d in deficiencies: + name = d.name # If the action is a requirement that doesn't show up in the # destination requirements, prune the action. if name in knownreqs and name not in destreqs: continue - if i.type == deficiency: - newactions.append(name) + newactions.append(name) # FUTURE consider adding some optimizations here for certain transitions. # e.g. adding generaldelta could schedule parent redeltas.