Patchwork [8,of,8] bookmarks: move variable initialisation earlier

login
register
mail settings
Submitter Pierre-Yves David
Date June 8, 2017, 7:44 p.m.
Message ID <0ea8caea02219027225e.1496951064@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/21258/
State Accepted
Headers show

Comments

Pierre-Yves David - June 8, 2017, 7:44 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@octobus.net>
# Date 1496860336 -3600
#      Wed Jun 07 19:32:16 2017 +0100
# Node ID 0ea8caea02219027225e88cc67c6d4608f606b0f
# Parent  991d87aea4949f735920ef486aea59e1f727d18d
# EXP-Topic perf
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r 0ea8caea0221
bookmarks: move variable initialisation earlier

Since we no longer set '_clean = False' during the initialization loop, we can
move the attribute assignment earlier in the function for clarity.

(no speed improvement expected or measured ;-) )

Patch

diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py
--- a/mercurial/bookmarks.py
+++ b/mercurial/bookmarks.py
@@ -50,6 +50,8 @@  class bmstore(dict):
     def __init__(self, repo):
         dict.__init__(self)
         self._repo = repo
+        self._clean = True
+        self._aclean = True
         nm = repo.changelog.nodemap
         tonode = bin #force local lookup
         setitem = dict.__setitem__
@@ -74,9 +76,7 @@  class bmstore(dict):
         except IOError as inst:
             if inst.errno != errno.ENOENT:
                 raise
-        self._clean = True
         self._active = _readactive(repo, self)
-        self._aclean = True
 
     @property
     def active(self):