revlog: avoid unnecessary node -> rev conversion
authorJun Wu <quark@fb.com>
Wed, 29 Mar 2017 16:23:04 -0700
changeset 31722 4eb75c86368b
parent 31721 be8a866a2c44
child 31723 2c4295773436
revlog: avoid unnecessary node -> rev conversion
mercurial/revlog.py
tests/test-check-code.t
--- a/mercurial/revlog.py	Wed Mar 29 16:46:57 2017 -0700
+++ b/mercurial/revlog.py	Wed Mar 29 16:23:04 2017 -0700
@@ -438,7 +438,7 @@
         if l >= 0:
             return l
 
-        t = self.revision(self.node(rev))
+        t = self.revision(rev)
         return len(t)
     size = rawsize
 
@@ -1596,7 +1596,7 @@
                     fh = ifh
                 else:
                     fh = dfh
-                basetext = self.revision(self.node(baserev), _df=fh, raw=raw)
+                basetext = self.revision(baserev, _df=fh, raw=raw)
                 btext[0] = mdiff.patch(basetext, delta)
 
             try:
@@ -1628,7 +1628,7 @@
                         fh = ifh
                     else:
                         fh = dfh
-                    ptext = self.revision(self.node(rev), _df=fh)
+                    ptext = self.revision(rev, _df=fh)
                     delta = mdiff.textdiff(ptext, t)
             header, data = self.compress(delta)
             deltalen = len(header) + len(data)
--- a/tests/test-check-code.t	Wed Mar 29 16:46:57 2017 -0700
+++ b/tests/test-check-code.t	Wed Mar 29 16:23:04 2017 -0700
@@ -45,15 +45,6 @@
   mercurial/policy.py:49:
    >     policy = os.environ.get('HGMODULEPOLICY', policy)
    use encoding.environ instead (py3)
-  mercurial/revlog.py:441:
-   >         t = self.revision(self.node(rev))
-   don't covert rev to node before passing to revision(nodeorrev)
-  mercurial/revlog.py:1599:
-   >                 basetext = self.revision(self.node(baserev), _df=fh, raw=raw)
-   don't covert rev to node before passing to revision(nodeorrev)
-  mercurial/revlog.py:1631:
-   >                     ptext = self.revision(self.node(rev), _df=fh)
-   don't covert rev to node before passing to revision(nodeorrev)
   Skipping mercurial/statprof.py it has no-che?k-code (glob)
   mercurial/unionrepo.py:93:
    >         return mdiff.textdiff(self.revision(self.node(rev1)),