[Updated] D9796: copies: add an devel option to trace all files
marmoute (Pierre-Yves David)
phabricator at mercurial-scm.org
Thu Jan 28 21:16:36 UTC 2021
Closed by commit rHGe948ad0dcbe2: copies: add an devel option to trace all files (authored by marmoute).
This revision was automatically updated to reflect the committed changes.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D9796?vs=25313&id=25364
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D9796/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D9796
AFFECTED FILES
mercurial/configitems.py
mercurial/copies.py
tests/test-copies.t
tests/test-copy.t
CHANGE DETAILS
diff --git a/tests/test-copy.t b/tests/test-copy.t
--- a/tests/test-copy.t
+++ b/tests/test-copy.t
@@ -228,6 +228,17 @@
should show no copies
$ hg st -C
+note: since filelog based copy tracing only trace copy for new file, the copy information here is not displayed.
+
+ $ hg status --copies --change .
+ M bar
+
+They are a devel option to walk all file and fine this information anyway.
+
+ $ hg status --copies --change . --config devel.copy-tracing.trace-all-files=yes
+ M bar
+ foo
+
copy --after on an added file
$ cp bar baz
$ hg add baz
diff --git a/tests/test-copies.t b/tests/test-copies.t
--- a/tests/test-copies.t
+++ b/tests/test-copies.t
@@ -95,6 +95,8 @@
x -> y
$ hg debugpathcopies 0 1
x -> y (no-filelog !)
+ $ hg debugpathcopies 0 1 --config devel.copy-tracing.trace-all-files=yes
+ x -> y
Copy a file onto another file with same content. If metadata is stored in changeset, this does not
produce a new filelog entry. The changeset's "files" entry should still list the file.
@@ -113,6 +115,8 @@
x -> x2
$ hg debugpathcopies 0 1
x -> x2 (no-filelog !)
+ $ hg debugpathcopies 0 1 --config devel.copy-tracing.trace-all-files=yes
+ x -> x2
Rename file in a loop: x->y->z->x
$ newrepo
diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -152,13 +152,21 @@
if b.p1() == a and b.p2().node() == nullid:
filesmatcher = matchmod.exact(b.files())
forwardmissingmatch = matchmod.intersectmatchers(match, filesmatcher)
- missing = _computeforwardmissing(a, b, match=forwardmissingmatch)
+ if repo.ui.configbool(b'devel', b'copy-tracing.trace-all-files'):
+ missing = list(b.walk(match))
+ # _computeforwardmissing(a, b, match=forwardmissingmatch)
+ if debug:
+ dbg(b'debug.copies: searching all files: %d\n' % len(missing))
+ else:
+ missing = _computeforwardmissing(a, b, match=forwardmissingmatch)
+ if debug:
+ dbg(
+ b'debug.copies: missing files to search: %d\n'
+ % len(missing)
+ )
ancestrycontext = a._repo.changelog.ancestors([b.rev()], inclusive=True)
- if debug:
- dbg(b'debug.copies: missing files to search: %d\n' % len(missing))
-
for f in sorted(missing):
if debug:
dbg(b'debug.copies: tracing file: %s\n' % f)
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -615,6 +615,12 @@
b'check-relroot',
default=False,
)
+# Track copy information for all file, not just "added" one (very slow)
+coreconfigitem(
+ b'devel',
+ b'copy-tracing.trace-all-files',
+ default=False,
+)
coreconfigitem(
b'devel',
b'default-date',
To: marmoute, #hg-reviewers, pulkit
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20210128/49c2cf19/attachment-0002.html>
More information about the Mercurial-patches
mailing list