Patchwork [4,of,4] phase: remove a 'for x in "foo bar".split()' idioms in phasecache.replace

login
register
mail settings
Submitter Pierre-Yves David
Date June 17, 2015, 2:09 a.m.
Message ID <224d65155c89858817fd.1434506961@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/9689/
State Accepted
Headers show

Comments

Pierre-Yves David - June 17, 2015, 2:09 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1434409577 25200
#      Mon Jun 15 16:06:17 2015 -0700
# Node ID 224d65155c89858817fdf2dc48402dc3519fb117
# Parent  18cc713258b6240bc0543aa5ceb537a80a8a85e5
phase: remove a 'for x in "foo bar".split()' idioms in phasecache.replace

I find this idioms fairly horrible.
Laurent Charignon - June 17, 2015, 5:44 p.m.
This series of patches looks good to me.
Thanks for doing that Pierre-Yves!


> On Jun 16, 2015, at 7:09 PM, Pierre-Yves David <pierre-yves.david@ens-lyon.org> wrote:
> 
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@fb.com>
> # Date 1434409577 25200
> #      Mon Jun 15 16:06:17 2015 -0700
> # Node ID 224d65155c89858817fdf2dc48402dc3519fb117
> # Parent  18cc713258b6240bc0543aa5ceb537a80a8a85e5
> phase: remove a 'for x in "foo bar".split()' idioms in phasecache.replace
> 
> I find this idioms fairly horrible.
> 
> diff --git a/mercurial/phases.py b/mercurial/phases.py
> --- a/mercurial/phases.py
> +++ b/mercurial/phases.py
> @@ -170,11 +170,11 @@ class phasecache(object):
>         ph._phasesets = self._phasesets
>         return ph
> 
>     def replace(self, phcache):
>         """replace all values in 'self' with content of phcache"""
> -        for a in 'phaseroots dirty opener _phaserevs _phasesets'.split():
> +        for a in ('phaseroots', 'dirty', 'opener', '_phaserevs', '_phasesets'):
>             setattr(self, a, getattr(phcache, a))
> 
>     def _getphaserevsnative(self, repo):
>         repo = repo.unfiltered()
>         nativeroots = []
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel
Matt Mackall - June 17, 2015, 9:42 p.m.
On Tue, 2015-06-16 at 19:09 -0700, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@fb.com>
> # Date 1434409577 25200
> #      Mon Jun 15 16:06:17 2015 -0700
> # Node ID 224d65155c89858817fdf2dc48402dc3519fb117
> # Parent  18cc713258b6240bc0543aa5ceb537a80a8a85e5
> phase: remove a 'for x in "foo bar".split()' idioms in phasecache.replace

These are queued for default, thanks.

Patch

diff --git a/mercurial/phases.py b/mercurial/phases.py
--- a/mercurial/phases.py
+++ b/mercurial/phases.py
@@ -170,11 +170,11 @@  class phasecache(object):
         ph._phasesets = self._phasesets
         return ph
 
     def replace(self, phcache):
         """replace all values in 'self' with content of phcache"""
-        for a in 'phaseroots dirty opener _phaserevs _phasesets'.split():
+        for a in ('phaseroots', 'dirty', 'opener', '_phaserevs', '_phasesets'):
             setattr(self, a, getattr(phcache, a))
 
     def _getphaserevsnative(self, repo):
         repo = repo.unfiltered()
         nativeroots = []