[PATCH 2 of 4 v5] revlog: pass flags to addrevision

Remi Chaintron remi at fb.com
Wed Dec 14 06:58:08 EST 2016


# HG changeset patch
# User Remi Chaintron <remi at fb.com>
# Date 1481638896 0
#      Tue Dec 13 14:21:36 2016 +0000
# Branch stable
# Node ID f4cd0db914fa6df17fdb733cdcf8b18ec79f8c0c
# Parent  7599256f2800bbacc3b478ac8d2c4a5746eb4cd1
revlog: pass flags to addrevision

Add the ability to pass known revision flags to `revlog.addrevision`. This
allows to ensure present flags are propagated and usable by the extensions
relying on the flagprocessor, such as `lfs`.

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -1344,7 +1344,7 @@
         self._chunkclear()
 
     def addrevision(self, text, transaction, link, p1, p2, cachedelta=None,
-                    node=None):
+                    node=None, flags=REVIDX_DEFAULT_FLAGS):
         """add a revision to the log
 
         text - the revision data to add
@@ -1355,6 +1355,7 @@
         node - nodeid of revision; typically node is not specified, and it is
             computed by default as hash(text, p1, p2), however subclasses might
             use different hashing method (and override checkhash() in such case)
+        flags - the known flags to set on the revision
         """
         if link == nullrev:
             raise RevlogError(_("attempted to add linkrev -1 to %s")
@@ -1375,7 +1376,7 @@
         ifh = self.opener(self.indexfile, "a+", checkambig=self._checkambig)
         try:
             return self._addrevision(node, text, transaction, link, p1, p2,
-                                     REVIDX_DEFAULT_FLAGS, cachedelta, ifh, dfh)
+                                     flags, cachedelta, ifh, dfh)
         finally:
             if dfh:
                 dfh.close()


More information about the Mercurial-devel mailing list