[Request] [++ ] D9139: copies: add a HASCOPIESINFO flag to highlight rev with useful data
marmoute (Pierre-Yves David)
phabricator at mercurial-scm.org
Thu Oct 1 14:09:57 UTC 2020
marmoute created this revision.
Herald added a reviewer: indygreg.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.
REVISION SUMMARY
If some files changes that may impact copy tracing are detected, we set this
flag. This helps the copy tracing algorithm to skip fetching possibly expensive
data when unnecessary.
REPOSITORY
rHG Mercurial
BRANCH
default
REVISION DETAIL
https://phab.mercurial-scm.org/D9139
AFFECTED FILES
mercurial/changelog.py
mercurial/interfaces/repository.py
mercurial/revlog.py
mercurial/revlogutils/constants.py
mercurial/revlogutils/flagutil.py
tests/test-lfs-serve.t
CHANGE DETAILS
diff --git a/tests/test-lfs-serve.t b/tests/test-lfs-serve.t
--- a/tests/test-lfs-serve.t
+++ b/tests/test-lfs-serve.t
@@ -360,9 +360,11 @@
# LFS required- both lfs and non-lfs revlogs have 0x2000 flag
*** runcommand debugprocessors lfs.bin -R ../server
registered processor '0x8000'
+ registered processor '0x800'
registered processor '0x2000'
*** runcommand debugprocessors nonlfs2.txt -R ../server
registered processor '0x8000'
+ registered processor '0x800'
registered processor '0x2000'
*** runcommand config extensions --cwd ../server
extensions.debugprocessors=$TESTTMP/debugprocessors.py
@@ -371,6 +373,7 @@
# LFS not enabled- revlogs don't have 0x2000 flag
*** runcommand debugprocessors nonlfs3.txt
registered processor '0x8000'
+ registered processor '0x800'
*** runcommand config extensions
extensions.debugprocessors=$TESTTMP/debugprocessors.py
@@ -413,9 +416,11 @@
# LFS enabled- both lfs and non-lfs revlogs have 0x2000 flag
*** runcommand debugprocessors lfs.bin -R ../server
registered processor '0x8000'
+ registered processor '0x800'
registered processor '0x2000'
*** runcommand debugprocessors nonlfs2.txt -R ../server
registered processor '0x8000'
+ registered processor '0x800'
registered processor '0x2000'
*** runcommand config extensions --cwd ../server
extensions.debugprocessors=$TESTTMP/debugprocessors.py
@@ -424,6 +429,7 @@
# LFS enabled without requirement- revlogs have 0x2000 flag
*** runcommand debugprocessors nonlfs3.txt
registered processor '0x8000'
+ registered processor '0x800'
registered processor '0x2000'
*** runcommand config extensions
extensions.debugprocessors=$TESTTMP/debugprocessors.py
@@ -432,6 +438,7 @@
# LFS disabled locally- revlogs don't have 0x2000 flag
*** runcommand debugprocessors nonlfs.txt -R ../nonlfs
registered processor '0x8000'
+ registered processor '0x800'
*** runcommand config extensions --cwd ../nonlfs
extensions.debugprocessors=$TESTTMP/debugprocessors.py
extensions.lfs=!
diff --git a/mercurial/revlogutils/flagutil.py b/mercurial/revlogutils/flagutil.py
--- a/mercurial/revlogutils/flagutil.py
+++ b/mercurial/revlogutils/flagutil.py
@@ -15,6 +15,7 @@
REVIDX_ELLIPSIS,
REVIDX_EXTSTORED,
REVIDX_FLAGS_ORDER,
+ REVIDX_HASCOPIESINFO,
REVIDX_ISCENSORED,
REVIDX_RAWTEXT_CHANGING_FLAGS,
REVIDX_SIDEDATA,
@@ -28,6 +29,7 @@
REVIDX_ELLIPSIS
REVIDX_EXTSTORED
REVIDX_SIDEDATA
+REVIDX_HASCOPIESINFO,
REVIDX_DEFAULT_FLAGS
REVIDX_FLAGS_ORDER
REVIDX_RAWTEXT_CHANGING_FLAGS
@@ -37,6 +39,7 @@
# Store flag processors (cf. 'addflagprocessor()' to register)
flagprocessors = {
REVIDX_ISCENSORED: None,
+ REVIDX_HASCOPIESINFO: None,
}
diff --git a/mercurial/revlogutils/constants.py b/mercurial/revlogutils/constants.py
--- a/mercurial/revlogutils/constants.py
+++ b/mercurial/revlogutils/constants.py
@@ -40,6 +40,8 @@
REVIDX_EXTSTORED = repository.REVISION_FLAG_EXTSTORED
# revision data contains extra metadata not part of the official digest
REVIDX_SIDEDATA = repository.REVISION_FLAG_SIDEDATA
+# revision changes files in a way that could affect copy tracing.
+REVIDX_HASCOPIESINFO = repository.REVISION_FLAG_HASCOPIESINFO
REVIDX_DEFAULT_FLAGS = 0
# stable order in which flags need to be processed and their processors applied
REVIDX_FLAGS_ORDER = [
@@ -47,6 +49,7 @@
REVIDX_ELLIPSIS,
REVIDX_EXTSTORED,
REVIDX_SIDEDATA,
+ REVIDX_HASCOPIESINFO,
]
# bitmark for flags that could cause rawdata content change
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -53,6 +53,7 @@
REVIDX_ELLIPSIS,
REVIDX_EXTSTORED,
REVIDX_FLAGS_ORDER,
+ REVIDX_HASCOPIESINFO,
REVIDX_ISCENSORED,
REVIDX_RAWTEXT_CHANGING_FLAGS,
REVIDX_SIDEDATA,
@@ -98,6 +99,7 @@
REVIDX_ISCENSORED
REVIDX_ELLIPSIS
REVIDX_SIDEDATA
+REVIDX_HASCOPIESINFO
REVIDX_EXTSTORED
REVIDX_DEFAULT_FLAGS
REVIDX_FLAGS_ORDER
diff --git a/mercurial/interfaces/repository.py b/mercurial/interfaces/repository.py
--- a/mercurial/interfaces/repository.py
+++ b/mercurial/interfaces/repository.py
@@ -28,12 +28,14 @@
REVISION_FLAG_ELLIPSIS = 1 << 14
REVISION_FLAG_EXTSTORED = 1 << 13
REVISION_FLAG_SIDEDATA = 1 << 12
+REVISION_FLAG_HASCOPIESINFO = 1 << 11
REVISION_FLAGS_KNOWN = (
REVISION_FLAG_CENSORED
| REVISION_FLAG_ELLIPSIS
| REVISION_FLAG_EXTSTORED
| REVISION_FLAG_SIDEDATA
+ | REVISION_FLAG_HASCOPIESINFO
)
CG_DELTAMODE_STD = b'default'
diff --git a/mercurial/changelog.py b/mercurial/changelog.py
--- a/mercurial/changelog.py
+++ b/mercurial/changelog.py
@@ -26,6 +26,7 @@
dateutil,
stringutil,
)
+from .revlogutils import flagutil
_defaultextra = {b'branch': b'default'}
@@ -579,8 +580,17 @@
_(b'the name \'%s\' is reserved') % branch
)
sortedfiles = sorted(files.touched)
+ flags = 0
sidedata = None
if self._copiesstorage == b'changeset-sidedata':
+ if (
+ files.removed
+ or files.merged
+ or files.salvaged
+ or files.copied_from_p1
+ or files.copied_from_p2
+ ):
+ flags |= flagutil.REVIDX_HASCOPIESINFO
sidedata = metadata.encode_files_sidedata(files)
if extra:
To: marmoute, indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20201001/18c557d9/attachment-0001.html>
More information about the Mercurial-patches
mailing list