Patchwork [2,of,5] revlog: avoid unnecessary node -> rev conversion

login
register
mail settings
Submitter Jun Wu
Date March 29, 2017, 11:57 p.m.
Message ID <21926bb9a6adbadc1f71.1490831855@x1c>
Download mbox | patch
Permalink /patch/19833/
State Accepted
Headers show

Comments

Jun Wu - March 29, 2017, 11:57 p.m.
# HG changeset patch
# User Jun Wu <quark@fb.com>
# Date 1490829784 25200
#      Wed Mar 29 16:23:04 2017 -0700
# Node ID 21926bb9a6adbadc1f715dc0a71ac53a3c4d8019
# Parent  e28b3818efa140482be9849f7bd8dd915e25fa07
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r 21926bb9a6ad
revlog: avoid unnecessary node -> rev conversion

Patch

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -439,5 +439,5 @@  class revlog(object):
             return l
 
-        t = self.revision(self.node(rev))
+        t = self.revision(rev)
         return len(t)
     size = rawsize
@@ -1597,5 +1597,5 @@  class revlog(object):
                 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)
 
@@ -1629,5 +1629,5 @@  class revlog(object):
                     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)
diff --git a/tests/test-check-code.t b/tests/test-check-code.t
--- a/tests/test-check-code.t
+++ b/tests/test-check-code.t
@@ -46,13 +46,4 @@  New errors are not allowed. Warnings are
    >     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: