[PATCH 3 of 6] revlog: pass flags to addrevision

Remi Chaintron remi at fb.com
Thu Oct 27 11:04:01 EDT 2016


# HG changeset patch
# User Remi Chaintron <remi at fb.com>
# Date 1477579974 -3600
#      Thu Oct 27 15:52:54 2016 +0100
# Branch stable
# Node ID f0825d5947cb38fe35c3f383ea68fee4e744deb4
# Parent  c16fc21427f7d3db2adce1d34b6a8f7fb04f9ca7
revlog: pass flags to addrevision

Add the ability to pass known flags for a revision to `revlog.addrevision`. This
allows extensions and subclasses of revlog to set such flags and is leveraged by
the `lfs` extension implementation.

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -1397,7 +1397,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
@@ -1408,6 +1408,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")
@@ -1428,7 +1429,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