revlog: change _addrevision to return the new revision
authorJoerg Sonnenberger <joerg@bec.de>
Tue, 26 Jan 2021 23:56:11 +0100
changeset 46558 07984507d553
parent 46557 a25033eb43b5
child 46559 9ee4e988e2be
revlog: change _addrevision to return the new revision The node is passed as argument already, so returning it is quite pointless. The revision number on the other is useful as it decouples the caller from the revlog internals. Differential Revision: https://phab.mercurial-scm.org/D9880
mercurial/revlog.py
--- a/mercurial/revlog.py	Mon Feb 08 23:41:58 2021 +0100
+++ b/mercurial/revlog.py	Tue Jan 26 23:56:11 2021 +0100
@@ -2145,7 +2145,7 @@
             dfh = self._datafp(b"a+")
         ifh = self._indexfp(b"a+")
         try:
-            return self._addrevision(
+            self._addrevision(
                 node,
                 rawtext,
                 transaction,
@@ -2158,6 +2158,7 @@
                 dfh,
                 deltacomputer=deltacomputer,
             )
+            return node
         finally:
             if dfh:
                 dfh.close()
@@ -2329,7 +2330,7 @@
         if type(rawtext) == bytes:  # only accept immutable objects
             self._revisioncache = (node, curr, rawtext)
         self._chainbasecache[curr] = deltainfo.chainbase
-        return node
+        return curr
 
     def _writeentry(self, transaction, ifh, dfh, entry, data, link, offset):
         # Files opened in a+ mode have inconsistent behavior on various