[Updated] D9125: changing-files: add a debug command display changed files
marmoute (Pierre-Yves David)
phabricator at mercurial-scm.org
Thu Oct 8 15:24:54 UTC 2020
Closed by commit rHG6922260a9100: changing-files: add a debug command display changed 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/D9125?vs=22945&id=23089
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D9125/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D9125
AFFECTED FILES
mercurial/debugcommands.py
tests/test-completion.t
tests/test-copies-chain-merge.t
tests/test-help.t
CHANGE DETAILS
diff --git a/tests/test-help.t b/tests/test-help.t
--- a/tests/test-help.t
+++ b/tests/test-help.t
@@ -983,6 +983,8 @@
debugbundle lists the contents of a bundle
debugcapabilities
lists the capabilities of a remote peer
+ debugchangedfiles
+ list the stored files changes for a revision
debugcheckstate
validate the correctness of the current dirstate
debugcolor show available color, effects or style
diff --git a/tests/test-copies-chain-merge.t b/tests/test-copies-chain-merge.t
--- a/tests/test-copies-chain-merge.t
+++ b/tests/test-copies-chain-merge.t
@@ -1023,51 +1023,71 @@
$ for rev in `hg log --rev 'all()' -T '{rev}\n'`; do
> echo "##### revision $rev #####"
> hg debugsidedata -c -v -- $rev
+ > hg debugchangedfiles $rev
> done
##### revision 0 #####
1 sidedata entries
entry-0014 size 34
'\x00\x00\x00\x03\x04\x00\x00\x00\x01\x00\x00\x00\x00\x04\x00\x00\x00\x02\x00\x00\x00\x00\x04\x00\x00\x00\x03\x00\x00\x00\x00abh'
+ added : a, ;
+ added : b, ;
+ added : h, ;
##### revision 1 #####
1 sidedata entries
entry-0014 size 24
'\x00\x00\x00\x02\x0c\x00\x00\x00\x01\x00\x00\x00\x00\x06\x00\x00\x00\x02\x00\x00\x00\x00ac'
+ removed : a, ;
+ added p1: c, a;
##### revision 2 #####
1 sidedata entries
entry-0014 size 24
'\x00\x00\x00\x02\x0c\x00\x00\x00\x01\x00\x00\x00\x00\x06\x00\x00\x00\x02\x00\x00\x00\x00cd'
+ removed : c, ;
+ added p1: d, c;
##### revision 3 #####
1 sidedata entries
entry-0014 size 24
'\x00\x00\x00\x02\x0c\x00\x00\x00\x01\x00\x00\x00\x00\x06\x00\x00\x00\x02\x00\x00\x00\x00de'
+ removed : d, ;
+ added p1: e, d;
##### revision 4 #####
1 sidedata entries
entry-0014 size 24
'\x00\x00\x00\x02\x0c\x00\x00\x00\x01\x00\x00\x00\x00\x06\x00\x00\x00\x02\x00\x00\x00\x00ef'
+ removed : e, ;
+ added p1: f, e;
##### revision 5 #####
1 sidedata entries
entry-0014 size 14
'\x00\x00\x00\x01\x14\x00\x00\x00\x01\x00\x00\x00\x00b'
+ touched : b, ;
##### revision 6 #####
1 sidedata entries
entry-0014 size 14
'\x00\x00\x00\x01\x0c\x00\x00\x00\x01\x00\x00\x00\x00d'
+ removed : d, ;
##### revision 7 #####
1 sidedata entries
entry-0014 size 14
'\x00\x00\x00\x01\x0c\x00\x00\x00\x01\x00\x00\x00\x00d'
+ removed : d, ;
##### revision 8 #####
1 sidedata entries
entry-0014 size 14
'\x00\x00\x00\x01\x04\x00\x00\x00\x01\x00\x00\x00\x00d'
+ added : d, ;
##### revision 9 #####
1 sidedata entries
entry-0014 size 24
'\x00\x00\x00\x02\x0c\x00\x00\x00\x01\x00\x00\x00\x00\x06\x00\x00\x00\x02\x00\x00\x00\x00bg'
+ removed : b, ;
+ added p1: g, b;
##### revision 10 #####
1 sidedata entries
entry-0014 size 24
'\x00\x00\x00\x02\x06\x00\x00\x00\x01\x00\x00\x00\x01\x0c\x00\x00\x00\x02\x00\x00\x00\x00fg'
+ added p1: f, g;
+ removed : g, ;
##### revision 11 #####
1 sidedata entries
entry-0014 size 4
@@ -1084,6 +1104,7 @@
1 sidedata entries
entry-0014 size 14
'\x00\x00\x00\x01\x04\x00\x00\x00\x01\x00\x00\x00\x00d'
+ added : d, ;
##### revision 15 #####
1 sidedata entries
entry-0014 size 4
@@ -1092,6 +1113,7 @@
1 sidedata entries
entry-0014 size 14
'\x00\x00\x00\x01\x04\x00\x00\x00\x01\x00\x00\x00\x00d'
+ added : d, ;
##### revision 17 #####
1 sidedata entries
entry-0014 size 4
@@ -1104,18 +1126,24 @@
1 sidedata entries
entry-0014 size 14
'\x00\x00\x00\x01\x08\x00\x00\x00\x01\x00\x00\x00\x00f'
+ merged : f, ;
##### revision 20 #####
1 sidedata entries
entry-0014 size 14
'\x00\x00\x00\x01\x08\x00\x00\x00\x01\x00\x00\x00\x00f'
+ merged : f, ;
##### revision 21 #####
1 sidedata entries
entry-0014 size 24
'\x00\x00\x00\x02\x0c\x00\x00\x00\x01\x00\x00\x00\x00\x06\x00\x00\x00\x02\x00\x00\x00\x00hi'
+ removed : h, ;
+ added p1: i, h;
##### revision 22 #####
1 sidedata entries
entry-0014 size 24
'\x00\x00\x00\x02\x16\x00\x00\x00\x01\x00\x00\x00\x01\x0c\x00\x00\x00\x02\x00\x00\x00\x00di'
+ touched p1: d, i;
+ removed : i, ;
##### revision 23 #####
1 sidedata entries
entry-0014 size 4
@@ -1128,22 +1156,27 @@
1 sidedata entries
entry-0014 size 14
'\x00\x00\x00\x01\x14\x00\x00\x00\x01\x00\x00\x00\x00d'
+ touched : d, ;
##### revision 26 #####
1 sidedata entries
entry-0014 size 14
'\x00\x00\x00\x01\x08\x00\x00\x00\x01\x00\x00\x00\x00d'
+ merged : d, ;
##### revision 27 #####
1 sidedata entries
entry-0014 size 14
'\x00\x00\x00\x01\x08\x00\x00\x00\x01\x00\x00\x00\x00d'
+ merged : d, ;
##### revision 28 #####
1 sidedata entries
entry-0014 size 14
'\x00\x00\x00\x01\x08\x00\x00\x00\x01\x00\x00\x00\x00d'
+ merged : d, ;
##### revision 29 #####
1 sidedata entries
entry-0014 size 14
'\x00\x00\x00\x01\x08\x00\x00\x00\x01\x00\x00\x00\x00d'
+ merged : d, ;
##### revision 30 #####
1 sidedata entries
entry-0014 size 4
diff --git a/tests/test-completion.t b/tests/test-completion.t
--- a/tests/test-completion.t
+++ b/tests/test-completion.t
@@ -80,6 +80,7 @@
debugbuilddag
debugbundle
debugcapabilities
+ debugchangedfiles
debugcheckstate
debugcolor
debugcommands
@@ -268,6 +269,7 @@
debugbuilddag: mergeable-file, overwritten-file, new-file
debugbundle: all, part-type, spec
debugcapabilities:
+ debugchangedfiles:
debugcheckstate:
debugcolor: style
debugcommands:
diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -59,6 +59,7 @@
lock as lockmod,
logcmdutil,
mergestate as mergestatemod,
+ metadata,
obsolete,
obsutil,
pathutil,
@@ -99,6 +100,7 @@
from .revlogutils import (
deltas as deltautil,
nodemap,
+ sidedata,
)
release = lockmod.release
@@ -478,6 +480,40 @@
ui.write(b' %s\n' % v)
+ at command(b'debugchangedfiles', [], b'REV')
+def debugchangedfiles(ui, repo, rev):
+ """list the stored files changes for a revision"""
+ ctx = scmutil.revsingle(repo, rev, None)
+ sd = repo.changelog.sidedata(ctx.rev())
+ files_block = sd.get(sidedata.SD_FILES)
+ if files_block is not None:
+ files = metadata.decode_files_sidedata(sd)
+ for f in sorted(files.touched):
+ if f in files.added:
+ action = b"added"
+ elif f in files.removed:
+ action = b"removed"
+ elif f in files.merged:
+ action = b"merged"
+ elif f in files.salvaged:
+ action = b"salvaged"
+ else:
+ action = b"touched"
+
+ copy_parent = b""
+ copy_source = b""
+ if f in files.copied_from_p1:
+ copy_parent = b"p1"
+ copy_source = files.copied_from_p1[f]
+ elif f in files.copied_from_p2:
+ copy_parent = b"p2"
+ copy_source = files.copied_from_p2[f]
+
+ data = (action, copy_parent, f, copy_source)
+ template = b"%-8s %2s: %s, %s;\n"
+ ui.write(template % data)
+
+
@command(b'debugcheckstate', [], b'')
def debugcheckstate(ui, repo):
"""validate the correctness of the current dirstate"""
To: marmoute, #hg-reviewers, Alphare, pulkit
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20201008/e2431652/attachment-0002.html>
More information about the Mercurial-patches
mailing list