Patchwork D1372: bundlerepo: make methods agree with base class

login
register
mail settings
Submitter phabricator
Date Nov. 12, 2017, 2:51 a.m.
Message ID <differential-rev-PHID-DREV-kkyu4vqypoiazgnm5m6u-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/25489/
State Superseded
Headers show

Comments

phabricator - Nov. 12, 2017, 2:51 a.m.
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  My editor was complaining about mismatches between method
  signatures.
  
  For methods that are implemented, we change arguments to match
  the base. For those that aren't, we use variable arguments
  because it shouldn't matter.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/bundlerepo.py

CHANGE DETAILS




To: indygreg, #hg-reviewers
Cc: mercurial-devel
phabricator - Nov. 12, 2017, 8:10 a.m.
dlax added a comment.


  > For methods that are implemented, we change arguments to match the base.
  
  Alternatively, we could use `**kwargs` for keywords arguments unused in a method. I think that's a common pattern and it avoids confusing the reader with unused arguments.

REPOSITORY
  rHG Mercurial

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

To: indygreg, #hg-reviewers
Cc: dlax, mercurial-devel

Patch

diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py
--- a/mercurial/bundlerepo.py
+++ b/mercurial/bundlerepo.py
@@ -86,7 +86,7 @@ 
             self.bundlerevs.add(n)
             n += 1
 
-    def _chunk(self, rev):
+    def _chunk(self, rev, df=None):
         # Warning: in case of bundle, the diff is against what we stored as
         # delta base, not against rev - 1
         # XXX: could use some caching
@@ -108,7 +108,7 @@ 
         return mdiff.textdiff(self.revision(rev1, raw=True),
                               self.revision(rev2, raw=True))
 
-    def revision(self, nodeorrev, raw=False):
+    def revision(self, nodeorrev, _df=None, raw=False):
         """return an uncompressed revision of a given node or revision
         number.
         """
@@ -152,12 +152,15 @@ 
         # needs to override 'baserevision' and make more specific call here.
         return revlog.revlog.revision(self, nodeorrev, raw=True)
 
-    def addrevision(self, text, transaction, link, p1=None, p2=None, d=None):
+    def addrevision(self, *args, **kwargs):
+        raise NotImplementedError
+
+    def addgroup(self, *args, **kwargs):
         raise NotImplementedError
-    def addgroup(self, deltas, transaction, addrevisioncb=None):
+
+    def strip(self, *args, **kwargs):
         raise NotImplementedError
-    def strip(self, rev, minlink):
-        raise NotImplementedError
+
     def checksize(self):
         raise NotImplementedError