annotate tests/test-obsconvert.t @ 5979:4a09e95d29c9 stable

rewriteutil: fix broken touch of merge commits (issue6416) `rewriteutil.rewrite()` is for rewriting a linear chain of commits into a single commit, i.e. what `hg fold` does. Many of the callers passed in a single commit because they wanted to rewrite just a single commit (e.g. `hg touch`). Before this patch, the code worked by going through the commits to fold and adding up all the modified files in them, then building a `memctx` based on that. As reported in issue6416, that can lose changes in merge commits. We could probably fix that without changing the existing code too much, but it seems the easiest way is to rewrite the code so it instead creates the new commit by effectively checking out the base and then revert to the head of the chain, so that's what this patch does. It does so by using in-memory merge.
author Martin von Zweigbergk <martinvonz@google.com>
date Mon, 05 Oct 2020 08:35:17 -0700
parents 945a0989e41b
children f5d472b7e800
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1159
04bd66779a1f obsup: hack extension to make in-place upgrading of obsolete markers easy
Augie Fackler <raf@durin42.com>
parents:
diff changeset
1 $ cat >> $HGRCPATH <<EOF
04bd66779a1f obsup: hack extension to make in-place upgrading of obsolete markers easy
Augie Fackler <raf@durin42.com>
parents:
diff changeset
2 > [extensions]
04bd66779a1f obsup: hack extension to make in-place upgrading of obsolete markers easy
Augie Fackler <raf@durin42.com>
parents:
diff changeset
3 > EOF
1806
9f42f819267b evolve: move the extensions to 'hgext3rd'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1187
diff changeset
4 $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
1159
04bd66779a1f obsup: hack extension to make in-place upgrading of obsolete markers easy
Augie Fackler <raf@durin42.com>
parents:
diff changeset
5 $ hg init alpha
04bd66779a1f obsup: hack extension to make in-place upgrading of obsolete markers easy
Augie Fackler <raf@durin42.com>
parents:
diff changeset
6 $ cd alpha
04bd66779a1f obsup: hack extension to make in-place upgrading of obsolete markers easy
Augie Fackler <raf@durin42.com>
parents:
diff changeset
7 $ echo foo > foo
04bd66779a1f obsup: hack extension to make in-place upgrading of obsolete markers easy
Augie Fackler <raf@durin42.com>
parents:
diff changeset
8 $ hg addremove
04bd66779a1f obsup: hack extension to make in-place upgrading of obsolete markers easy
Augie Fackler <raf@durin42.com>
parents:
diff changeset
9 adding foo
04bd66779a1f obsup: hack extension to make in-place upgrading of obsolete markers easy
Augie Fackler <raf@durin42.com>
parents:
diff changeset
10 $ hg ci -m 'foo'
04bd66779a1f obsup: hack extension to make in-place upgrading of obsolete markers easy
Augie Fackler <raf@durin42.com>
parents:
diff changeset
11 $ for x in 1 2 3 4 ; do
04bd66779a1f obsup: hack extension to make in-place upgrading of obsolete markers easy
Augie Fackler <raf@durin42.com>
parents:
diff changeset
12 > echo foo $x > foo
04bd66779a1f obsup: hack extension to make in-place upgrading of obsolete markers easy
Augie Fackler <raf@durin42.com>
parents:
diff changeset
13 > hg amend
04bd66779a1f obsup: hack extension to make in-place upgrading of obsolete markers easy
Augie Fackler <raf@durin42.com>
parents:
diff changeset
14 > done
04bd66779a1f obsup: hack extension to make in-place upgrading of obsolete markers easy
Augie Fackler <raf@durin42.com>
parents:
diff changeset
15
04bd66779a1f obsup: hack extension to make in-place upgrading of obsolete markers easy
Augie Fackler <raf@durin42.com>
parents:
diff changeset
16 Test conversion between obsolete marker formats
1172
8d28bb4fc127 debugobsconvert: fix 6f08a8f6bb1d and add proper test
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1170
diff changeset
17 $ hg debugobsolete
2581
ef5d556ec589 effectflag: activate effect flag on test-obsconvert.t test file
Boris Feld <boris.feld@octobus.net>
parents: 1806
diff changeset
18 e63c23eaa88ae77967edcf4ea194d31167c478b0 b81ac6b9d2a55f9a7a6b90a006b1aab0568d6d34 0 (*) {'ef1': '*', 'user': 'test'} (glob)
ef5d556ec589 effectflag: activate effect flag on test-obsconvert.t test file
Boris Feld <boris.feld@octobus.net>
parents: 1806
diff changeset
19 b81ac6b9d2a55f9a7a6b90a006b1aab0568d6d34 384fc811182687231962e486f23ea8c5bab7a2d3 0 (*) {'ef1': '*', 'user': 'test'} (glob)
ef5d556ec589 effectflag: activate effect flag on test-obsconvert.t test file
Boris Feld <boris.feld@octobus.net>
parents: 1806
diff changeset
20 384fc811182687231962e486f23ea8c5bab7a2d3 949d379b3c3bf051906bc3528c049cb536e2ec86 0 (*) {'ef1': '*', 'user': 'test'} (glob)
ef5d556ec589 effectflag: activate effect flag on test-obsconvert.t test file
Boris Feld <boris.feld@octobus.net>
parents: 1806
diff changeset
21 949d379b3c3bf051906bc3528c049cb536e2ec86 f2e4c45b2a4a58ccf7ef6825b8fa5685873cd2f7 0 (*) {'ef1': '*', 'user': 'test'} (glob)
1159
04bd66779a1f obsup: hack extension to make in-place upgrading of obsolete markers easy
Augie Fackler <raf@durin42.com>
parents:
diff changeset
22 $ hg debugobsconvert --new-format 0
1170
4697f23e0ede debugobsconvert: fix a typo on "version"
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1159
diff changeset
23 Old store is version 1, will rewrite in version 0
1159
04bd66779a1f obsup: hack extension to make in-place upgrading of obsolete markers easy
Augie Fackler <raf@durin42.com>
parents:
diff changeset
24 Done!
1172
8d28bb4fc127 debugobsconvert: fix 6f08a8f6bb1d and add proper test
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1170
diff changeset
25 $ hg debugobsolete
2581
ef5d556ec589 effectflag: activate effect flag on test-obsconvert.t test file
Boris Feld <boris.feld@octobus.net>
parents: 1806
diff changeset
26 e63c23eaa88ae77967edcf4ea194d31167c478b0 b81ac6b9d2a55f9a7a6b90a006b1aab0568d6d34 0 (*) {'ef1': '*', 'user': 'test'} (glob)
ef5d556ec589 effectflag: activate effect flag on test-obsconvert.t test file
Boris Feld <boris.feld@octobus.net>
parents: 1806
diff changeset
27 b81ac6b9d2a55f9a7a6b90a006b1aab0568d6d34 384fc811182687231962e486f23ea8c5bab7a2d3 0 (*) {'ef1': '*', 'user': 'test'} (glob)
ef5d556ec589 effectflag: activate effect flag on test-obsconvert.t test file
Boris Feld <boris.feld@octobus.net>
parents: 1806
diff changeset
28 384fc811182687231962e486f23ea8c5bab7a2d3 949d379b3c3bf051906bc3528c049cb536e2ec86 0 (*) {'ef1': '*', 'user': 'test'} (glob)
ef5d556ec589 effectflag: activate effect flag on test-obsconvert.t test file
Boris Feld <boris.feld@octobus.net>
parents: 1806
diff changeset
29 949d379b3c3bf051906bc3528c049cb536e2ec86 f2e4c45b2a4a58ccf7ef6825b8fa5685873cd2f7 0 (*) {'ef1': '*', 'user': 'test'} (glob)
1159
04bd66779a1f obsup: hack extension to make in-place upgrading of obsolete markers easy
Augie Fackler <raf@durin42.com>
parents:
diff changeset
30 $ hg debugobsconvert --new-format 0
04bd66779a1f obsup: hack extension to make in-place upgrading of obsolete markers easy
Augie Fackler <raf@durin42.com>
parents:
diff changeset
31 abort: New format is the same as the old format, not upgrading!
04bd66779a1f obsup: hack extension to make in-place upgrading of obsolete markers easy
Augie Fackler <raf@durin42.com>
parents:
diff changeset
32 [255]
1172
8d28bb4fc127 debugobsconvert: fix 6f08a8f6bb1d and add proper test
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1170
diff changeset
33 $ hg debugobsolete
2581
ef5d556ec589 effectflag: activate effect flag on test-obsconvert.t test file
Boris Feld <boris.feld@octobus.net>
parents: 1806
diff changeset
34 e63c23eaa88ae77967edcf4ea194d31167c478b0 b81ac6b9d2a55f9a7a6b90a006b1aab0568d6d34 0 (*) {'ef1': '*', 'user': 'test'} (glob)
ef5d556ec589 effectflag: activate effect flag on test-obsconvert.t test file
Boris Feld <boris.feld@octobus.net>
parents: 1806
diff changeset
35 b81ac6b9d2a55f9a7a6b90a006b1aab0568d6d34 384fc811182687231962e486f23ea8c5bab7a2d3 0 (*) {'ef1': '*', 'user': 'test'} (glob)
ef5d556ec589 effectflag: activate effect flag on test-obsconvert.t test file
Boris Feld <boris.feld@octobus.net>
parents: 1806
diff changeset
36 384fc811182687231962e486f23ea8c5bab7a2d3 949d379b3c3bf051906bc3528c049cb536e2ec86 0 (*) {'ef1': '*', 'user': 'test'} (glob)
ef5d556ec589 effectflag: activate effect flag on test-obsconvert.t test file
Boris Feld <boris.feld@octobus.net>
parents: 1806
diff changeset
37 949d379b3c3bf051906bc3528c049cb536e2ec86 f2e4c45b2a4a58ccf7ef6825b8fa5685873cd2f7 0 (*) {'ef1': '*', 'user': 'test'} (glob)
1159
04bd66779a1f obsup: hack extension to make in-place upgrading of obsolete markers easy
Augie Fackler <raf@durin42.com>
parents:
diff changeset
38 $ hg debugobsconvert --new-format 1
1170
4697f23e0ede debugobsconvert: fix a typo on "version"
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1159
diff changeset
39 Old store is version 0, will rewrite in version 1
1159
04bd66779a1f obsup: hack extension to make in-place upgrading of obsolete markers easy
Augie Fackler <raf@durin42.com>
parents:
diff changeset
40 Done!
1172
8d28bb4fc127 debugobsconvert: fix 6f08a8f6bb1d and add proper test
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1170
diff changeset
41 $ hg debugobsolete
2581
ef5d556ec589 effectflag: activate effect flag on test-obsconvert.t test file
Boris Feld <boris.feld@octobus.net>
parents: 1806
diff changeset
42 e63c23eaa88ae77967edcf4ea194d31167c478b0 b81ac6b9d2a55f9a7a6b90a006b1aab0568d6d34 0 (*) {'ef1': '*', 'user': 'test'} (glob)
ef5d556ec589 effectflag: activate effect flag on test-obsconvert.t test file
Boris Feld <boris.feld@octobus.net>
parents: 1806
diff changeset
43 b81ac6b9d2a55f9a7a6b90a006b1aab0568d6d34 384fc811182687231962e486f23ea8c5bab7a2d3 0 (*) {'ef1': '*', 'user': 'test'} (glob)
ef5d556ec589 effectflag: activate effect flag on test-obsconvert.t test file
Boris Feld <boris.feld@octobus.net>
parents: 1806
diff changeset
44 384fc811182687231962e486f23ea8c5bab7a2d3 949d379b3c3bf051906bc3528c049cb536e2ec86 0 (*) {'ef1': '*', 'user': 'test'} (glob)
ef5d556ec589 effectflag: activate effect flag on test-obsconvert.t test file
Boris Feld <boris.feld@octobus.net>
parents: 1806
diff changeset
45 949d379b3c3bf051906bc3528c049cb536e2ec86 f2e4c45b2a4a58ccf7ef6825b8fa5685873cd2f7 0 (*) {'ef1': '*', 'user': 'test'} (glob)
1159
04bd66779a1f obsup: hack extension to make in-place upgrading of obsolete markers easy
Augie Fackler <raf@durin42.com>
parents:
diff changeset
46
04bd66779a1f obsup: hack extension to make in-place upgrading of obsolete markers easy
Augie Fackler <raf@durin42.com>
parents:
diff changeset
47 Test that the default is some reasonably modern format (first downgrade)
04bd66779a1f obsup: hack extension to make in-place upgrading of obsolete markers easy
Augie Fackler <raf@durin42.com>
parents:
diff changeset
48 $ hg debugobsconvert --new-format 0
1170
4697f23e0ede debugobsconvert: fix a typo on "version"
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1159
diff changeset
49 Old store is version 1, will rewrite in version 0
1159
04bd66779a1f obsup: hack extension to make in-place upgrading of obsolete markers easy
Augie Fackler <raf@durin42.com>
parents:
diff changeset
50 Done!
04bd66779a1f obsup: hack extension to make in-place upgrading of obsolete markers easy
Augie Fackler <raf@durin42.com>
parents:
diff changeset
51 $ hg debugobsconvert
1170
4697f23e0ede debugobsconvert: fix a typo on "version"
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1159
diff changeset
52 Old store is version 0, will rewrite in version 1
1159
04bd66779a1f obsup: hack extension to make in-place upgrading of obsolete markers easy
Augie Fackler <raf@durin42.com>
parents:
diff changeset
53 Done!
1172
8d28bb4fc127 debugobsconvert: fix 6f08a8f6bb1d and add proper test
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1170
diff changeset
54 $ hg debugobsolete
2581
ef5d556ec589 effectflag: activate effect flag on test-obsconvert.t test file
Boris Feld <boris.feld@octobus.net>
parents: 1806
diff changeset
55 e63c23eaa88ae77967edcf4ea194d31167c478b0 b81ac6b9d2a55f9a7a6b90a006b1aab0568d6d34 0 (*) {'ef1': '*', 'user': 'test'} (glob)
ef5d556ec589 effectflag: activate effect flag on test-obsconvert.t test file
Boris Feld <boris.feld@octobus.net>
parents: 1806
diff changeset
56 b81ac6b9d2a55f9a7a6b90a006b1aab0568d6d34 384fc811182687231962e486f23ea8c5bab7a2d3 0 (*) {'ef1': '*', 'user': 'test'} (glob)
ef5d556ec589 effectflag: activate effect flag on test-obsconvert.t test file
Boris Feld <boris.feld@octobus.net>
parents: 1806
diff changeset
57 384fc811182687231962e486f23ea8c5bab7a2d3 949d379b3c3bf051906bc3528c049cb536e2ec86 0 (*) {'ef1': '*', 'user': 'test'} (glob)
ef5d556ec589 effectflag: activate effect flag on test-obsconvert.t test file
Boris Feld <boris.feld@octobus.net>
parents: 1806
diff changeset
58 949d379b3c3bf051906bc3528c049cb536e2ec86 f2e4c45b2a4a58ccf7ef6825b8fa5685873cd2f7 0 (*) {'ef1': '*', 'user': 'test'} (glob)