[PATCH 3 of 5 lfs-v2] revlog: pass flags to addrevision

Remi Chaintron remi at fb.com
Tue Nov 22 12:56:46 EST 2016


# HG changeset patch
# User Remi Chaintron <remi at fb.com>
# Date 1479829452 0
#      Tue Nov 22 15:44:12 2016 +0000
# Branch stable
# Node ID 66391d01bb92ff5f1d14033c00389214f78f25cc
# Parent  c6936724ef27b378361773441debc6b7f9ba66cb
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
@@ -1401,7 +1401,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
@@ -1412,6 +1412,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")
@@ -1432,7 +1433,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