branchmap: move __init__ up in branchcache class
authorPulkit Goyal <pulkit@yandex-team.ru>
Mon, 11 Feb 2019 15:34:35 +0300
changeset 41677 bfc49f1df615
parent 41676 0531dff73d0b
child 41678 9d0d8793e847
branchmap: move __init__ up in branchcache class Making __init__ the first function defined helps understanding the class much better. Differential Revision: https://phab.mercurial-scm.org/D5931
mercurial/branchmap.py
--- a/mercurial/branchmap.py	Sat Feb 09 22:50:53 2019 -0800
+++ b/mercurial/branchmap.py	Mon Feb 11 15:34:35 2019 +0300
@@ -148,6 +148,21 @@
     This field can be used to avoid changelog reads when determining if a
     branch head closes a branch or not.
     """
+
+    def __init__(self, entries=(), tipnode=nullid, tiprev=nullrev,
+                 filteredhash=None, closednodes=None):
+        super(branchcache, self).__init__(entries)
+        self.tipnode = tipnode
+        self.tiprev = tiprev
+        self.filteredhash = filteredhash
+        # closednodes is a set of nodes that close their branch. If the branch
+        # cache has been updated, it may contain nodes that are no longer
+        # heads.
+        if closednodes is None:
+            self._closednodes = set()
+        else:
+            self._closednodes = closednodes
+
     @classmethod
     def fromfile(cls, repo):
         f = None
@@ -207,20 +222,6 @@
             filename = '%s-%s' % (filename, repo.filtername)
         return filename
 
-    def __init__(self, entries=(), tipnode=nullid, tiprev=nullrev,
-                 filteredhash=None, closednodes=None):
-        super(branchcache, self).__init__(entries)
-        self.tipnode = tipnode
-        self.tiprev = tiprev
-        self.filteredhash = filteredhash
-        # closednodes is a set of nodes that close their branch. If the branch
-        # cache has been updated, it may contain nodes that are no longer
-        # heads.
-        if closednodes is None:
-            self._closednodes = set()
-        else:
-            self._closednodes = closednodes
-
     def validfor(self, repo):
         """Is the cache content valid regarding a repo