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

Pierre-Yves David pierre-yves.david at ens-lyon.org
Tue Jun 16 21:09:21 CDT 2015


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at 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 = []


More information about the Mercurial-devel mailing list