Skip to content

Commit d421a4c

Browse files
zzl0facebook-github-bot
authored andcommitted
histedit: add test for folding subtree commits
Summary: Currently, histedit does not support merge and subtree metadata. This diff adds a test to show that it will lose subtree metadata Reviewed By: muirdm Differential Revision: D75897811 fbshipit-source-id: 381208cd814e55d3c72dbf551602987c31e885bf
1 parent 2f3850c commit d421a4c

1 file changed

Lines changed: 65 additions & 0 deletions

File tree

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
$ setconfig diff.git=True
2+
$ setconfig subtree.allow-any-source-commit=True
3+
$ setconfig subtree.min-path-depth=1
4+
$ enable histedit
5+
6+
test histedit to fold subtree merge commits
7+
$ newclientrepo
8+
$ drawdag <<'EOS'
9+
> D # D/foo/x = 1a\n2a\n3a\n
10+
> |
11+
> C # C/foo/x = 1a\n2a\n3\n
12+
> |
13+
> B # B/foo/x = 1a\n2\n3\n
14+
> |
15+
> A # A/foo/x = 1\n2\n3\n
16+
> EOS
17+
$ hg go -q $D
18+
$ hg subtree copy -r $A --from-path foo --to-path foo2 -m "subtree copy foo to foo2"
19+
copying foo to foo2
20+
$ hg subtree copy -r $A --from-path foo --to-path foo3 -m "subtree copy foo to foo3"
21+
copying foo to foo3
22+
$ hg subtree merge -r $B --from-path foo --to-path foo2
23+
computing merge base (timeout: 120 seconds)...
24+
merge base: b4cb27eee4e2
25+
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
26+
(subtree merge, don't forget to commit)
27+
$ hg ci -m "merge B from foo to foo2"
28+
$ hg subtree merge -r $C --from-path foo --to-path foo3
29+
computing merge base (timeout: 120 seconds)...
30+
merge base: b4cb27eee4e2
31+
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
32+
(subtree merge, don't forget to commit)
33+
$ hg ci -m "merge C from foo to foo3"
34+
$ hg log -G -T '{node|short} {desc|firstline}\n'
35+
@ c90acfc6d9e6 merge C from foo to foo3
36+
37+
o 23b8d4a76647 merge B from foo to foo2
38+
39+
o f6ef74a89a69 subtree copy foo to foo3
40+
41+
o 44d9b171824f subtree copy foo to foo2
42+
43+
o 8451df1af03b D
44+
45+
o 4701d37a062f C
46+
47+
o c4fbbcdf676b B
48+
49+
o b4cb27eee4e2 A
50+
$ hg histedit 23b8d4a76647 --commands - <<EOF
51+
> pick 23b8d4a76647 merge B from foo to foo2
52+
> f c90acfc6d9e6 merge C from foo to foo3
53+
> EOF
54+
tofix: the combined commits should have two subtree merge metadata
55+
$ hg subtree inspect -r .
56+
{
57+
"merges": [
58+
{
59+
"version": 1,
60+
"from_commit": "c4fbbcdf676b67867d7a51393f12109974c5da59",
61+
"from_path": "foo",
62+
"to_path": "foo2"
63+
}
64+
]
65+
}

0 commit comments

Comments
 (0)