D5931: branchmap: move __init__ up in branchcache class

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

D5931: branchmap: move __init__ up in branchcache class

pulkit (Pulkit Goyal)
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Making __init__ the first function defined helps understanding the class much
  better.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5931

AFFECTED FILES
  mercurial/branchmap.py

CHANGE DETAILS

diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py
--- a/mercurial/branchmap.py
+++ b/mercurial/branchmap.py
@@ -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
 



To: pulkit, #hg-reviewers
Cc: mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

D5931: branchmap: move __init__ up in branchcache class

pulkit (Pulkit Goyal)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGbfc49f1df615: branchmap: move __init__ up in branchcache class (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5931?vs=14021&id=14027

REVISION DETAIL
  https://phab.mercurial-scm.org/D5931

AFFECTED FILES
  mercurial/branchmap.py

CHANGE DETAILS

diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py
--- a/mercurial/branchmap.py
+++ b/mercurial/branchmap.py
@@ -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
 



To: pulkit, #hg-reviewers
Cc: mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel