Patchwork [3,of,5,v3] revlog: pass flags to addrevision

login
register
mail settings
Submitter Remi Chaintron
Date Nov. 23, 2016, 4:19 p.m.
Message ID <2b21a1071ab3003f9ce1.1479917955@iphonesleepsort.dhcp.thefacebook.com>
Download mbox | patch
Permalink /patch/17718/
State Superseded
Headers show

Comments

Remi Chaintron - Nov. 23, 2016, 4:19 p.m.
# HG changeset patch
# User Remi Chaintron <remi@fb.com>
# Date 1479916365 0
#      Wed Nov 23 15:52:45 2016 +0000
# Branch stable
# Node ID 2b21a1071ab3003f9ce145620e0e888d41742b80
# Parent  f45a31268675da806e7f9569b569aec8fefb29d5
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`.

Patch

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()