Patchwork [4,of,8] filelog: use super() for calling base functions

login
register
mail settings
Submitter Durham Goode
Date May 6, 2013, 7:36 p.m.
Message ID <73881f8307e167690b55.1367869014@dev350.prn1.facebook.com>
Download mbox | patch
Permalink /patch/1560/
State Accepted, archived
Commit 3bda242bf244e59ae1c3616b5f2d6f3a47cc8561
Headers show

Comments

Durham Goode - May 6, 2013, 7:36 p.m.
# HG changeset patch
# User Durham Goode <durham@fb.com>
# Date 1367429977 25200
#      Wed May 01 10:39:37 2013 -0700
# Node ID 73881f8307e167690b55cba8f9163f70ca176418
# Parent  e5c4416f076c1a99ea99fe83da9a009a15ca33ea
filelog: use super() for calling base functions

filelog had some hardcoded revlog.revlog.foo() calls. This changes it to
use super() instead so that extensions can replace the filelog base class.

Patch

diff --git a/mercurial/filelog.py b/mercurial/filelog.py
--- a/mercurial/filelog.py
+++ b/mercurial/filelog.py
@@ -31,7 +31,7 @@ 
 
 class filelog(revlog.revlog):
     def __init__(self, opener, path):
-        revlog.revlog.__init__(self, opener,
+        super(filelog, self).__init__(opener,
                         "/".join(("data", path + ".i")))
 
     def read(self, node):
@@ -64,7 +64,7 @@ 
             return len(self.read(node))
 
         # XXX if self.read(node).startswith("\1\n"), this returns (size+4)
-        return revlog.revlog.size(self, rev)
+        return super(filelog, self).size(rev)
 
     def cmp(self, node, text):
         """compare text with a given file revision
@@ -76,7 +76,7 @@ 
         if text.startswith('\1\n'):
             t = '\1\n\1\n' + text
 
-        samehashes = not revlog.revlog.cmp(self, node, t)
+        samehashes = not super(filelog, self).cmp(node, t)
         if samehashes:
             return False