durin42 created this revision.
Herald added a reviewer: indygreg.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This is the correct place to register this type of flag.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2008

AFFECTED FILES
  hgext/narrow/narrowchangegroup.py
  hgext/narrow/narrowrevlog.py
  hgext/narrow/narrowtemplates.py
  mercurial/revlog.py

CHANGE DETAILS

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -57,6 +57,7 @@
 # Dummy value until file format is finalized.
 # Reminder: change the bounds check in revlog.__init__ when this is changed.
 REVLOGV2 = 0xDEAD
+ELLIPSIS_NODE_FLAG = (1 << 14)
 FLAG_INLINE_DATA = (1 << 16)
 FLAG_GENERALDELTA = (1 << 17)
 REVLOG_DEFAULT_FLAGS = FLAG_INLINE_DATA
@@ -75,6 +76,7 @@
     REVIDX_ISCENSORED,
     REVIDX_ELLIPSIS,
     REVIDX_EXTSTORED,
+    ELLIPSIS_NODE_FLAG,
 ]
 REVIDX_KNOWN_FLAGS = util.bitsfrom(REVIDX_FLAGS_ORDER)
 
diff --git a/hgext/narrow/narrowtemplates.py b/hgext/narrow/narrowtemplates.py
--- a/hgext/narrow/narrowtemplates.py
+++ b/hgext/narrow/narrowtemplates.py
@@ -8,15 +8,14 @@
 from __future__ import absolute_import
 
 from mercurial import (
+    revlog,
     revset,
     templatekw,
     util,
 )
 
-from . import narrowrevlog
-
 def _isellipsis(repo, rev):
-    if repo.changelog.flags(rev) & narrowrevlog.ELLIPSIS_NODE_FLAG:
+    if repo.changelog.flags(rev) & revlog.ELLIPSIS_NODE_FLAG:
         return True
     return False
 
diff --git a/hgext/narrow/narrowrevlog.py b/hgext/narrow/narrowrevlog.py
--- a/hgext/narrow/narrowrevlog.py
+++ b/hgext/narrow/narrowrevlog.py
@@ -13,11 +13,6 @@
    util,
 )
 
-ELLIPSIS_NODE_FLAG = 1 << 14
-revlog.REVIDX_KNOWN_FLAGS |= ELLIPSIS_NODE_FLAG
-if ELLIPSIS_NODE_FLAG not in revlog.REVIDX_FLAGS_ORDER:
-    revlog.REVIDX_FLAGS_ORDER.append(ELLIPSIS_NODE_FLAG)
-
 def readtransform(self, text):
     return text, False
 
@@ -27,7 +22,7 @@
 def rawtransform(self, text):
     return False
 
-revlog.addflagprocessor(ELLIPSIS_NODE_FLAG,
+revlog.addflagprocessor(revlog.ELLIPSIS_NODE_FLAG,
                         (readtransform, writetransform, rawtransform))
 
 def setup():
diff --git a/hgext/narrow/narrowchangegroup.py 
b/hgext/narrow/narrowchangegroup.py
--- a/hgext/narrow/narrowchangegroup.py
+++ b/hgext/narrow/narrowchangegroup.py
@@ -15,12 +15,12 @@
     manifest,
     mdiff,
     node,
+    revlog,
     util,
 )
 
 from . import (
     narrowrepo,
-    narrowrevlog,
 )
 
 def setup():
@@ -83,11 +83,11 @@
     extensions.wrapfunction(
         changegroup.cg1packer, 'generatefiles', generatefiles)
 
-    def ellipsisdata(packer, rev, revlog, p1, p2, data, linknode):
-        n = revlog.node(rev)
-        p1n, p2n = revlog.node(p1), revlog.node(p2)
-        flags = revlog.flags(rev)
-        flags |= narrowrevlog.ELLIPSIS_NODE_FLAG
+    def ellipsisdata(packer, rev, revlog_, p1, p2, data, linknode):
+        n = revlog_.node(rev)
+        p1n, p2n = revlog_.node(p1), revlog_.node(p2)
+        flags = revlog_.flags(rev)
+        flags |= revlog.ELLIPSIS_NODE_FLAG
         meta = packer.builddeltaheader(
             n, p1n, p2n, node.nullid, linknode, flags)
         # TODO: try and actually send deltas for ellipsis data blocks



To: durin42, indygreg, #hg-reviewers
Cc: mercurial-devel
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to