annotate tests/test-amend-merge.t @ 6655:81fe0a498447 stable

topic: internal config option to fix hg pick behavior (issue6406) After some consideration, hg pick was made to always use current topic (and topic namespace), even if it's not set, in which case the resulting changeset will not have any topic. Previously the intended behavior was to only update topic if there was an active topic, and not touch commit extras at all otherwise. That wasn't ideal, since pick doesn't change active topic, and amending the just-picked commit would unset its topic without clear user's intent to do so and to their surprise.
author Anton Shestakov <av6@dwimlabs.net>
date Sat, 27 Jan 2024 17:36:39 -0300
parents 2800aa3c3dbf
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5918
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
1 This test amends a merge commit using various commands, including topics
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
2
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
3 $ . $TESTDIR/testlib/common.sh
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
4
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
5 $ cat >> $HGRCPATH << EOF
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
6 > [extensions]
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
7 > evolve =
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
8 > topic =
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
9 > EOF
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
10
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
11 $ hg init amending-a-merge
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
12 $ cd amending-a-merge
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
13
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
14 $ mkcommit root
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
15 $ mkcommit apple
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
16 $ hg up 'desc("root")'
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
17 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
18 $ mkcommit banana
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
19 created new head
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
20 (consider using topic for lightweight branches. See 'hg help topic')
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
21 $ hg up 'desc("apple")'
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
22 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
23 $ hg merge 'desc("banana")'
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
24 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
25 (branch merge, don't forget to commit)
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
26
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
27 $ hg ci -m merge
6031
c3d66af4cb07 tests: show extras that are going to change in the next patch
Anton Shestakov <av6@dwimlabs.net>
parents: 5919
diff changeset
28 $ hg log -r . -T '{rev}: {join(extras, " ")}\n'
c3d66af4cb07 tests: show extras that are going to change in the next patch
Anton Shestakov <av6@dwimlabs.net>
parents: 5919
diff changeset
29 3: branch=default
5918
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
30 $ hg diff -r 'p1(.)' -r '.'
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
31 diff -r 88a060ab6523 -r c20705a6a8c4 banana
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
32 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
33 +++ b/banana Thu Jan 01 00:00:00 1970 +0000
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
34 @@ -0,0 +1,1 @@
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
35 +banana
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
36 $ hg diff -r 'p2(.)' -r '.'
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
37 diff -r d8c7baf0ca58 -r c20705a6a8c4 apple
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
38 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
39 +++ b/apple Thu Jan 01 00:00:00 1970 +0000
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
40 @@ -0,0 +1,1 @@
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
41 +apple
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
42
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
43 amend
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
44
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
45 $ hg amend -m 'merge, amend'
6031
c3d66af4cb07 tests: show extras that are going to change in the next patch
Anton Shestakov <av6@dwimlabs.net>
parents: 5919
diff changeset
46 $ hg log -r . -T '{rev}: {join(extras, " ")}\n'
c3d66af4cb07 tests: show extras that are going to change in the next patch
Anton Shestakov <av6@dwimlabs.net>
parents: 5919
diff changeset
47 4: amend_source=[0-9a-f]+ branch=default (re)
5918
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
48 $ hg diff -r 'p1(.)' -r '.'
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
49 diff -r 88a060ab6523 -r 456753fae3cd banana
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
50 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
51 +++ b/banana Thu Jan 01 00:00:00 1970 +0000
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
52 @@ -0,0 +1,1 @@
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
53 +banana
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
54 $ hg diff -r 'p2(.)' -r '.'
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
55 diff -r d8c7baf0ca58 -r 456753fae3cd apple
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
56 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
57 +++ b/apple Thu Jan 01 00:00:00 1970 +0000
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
58 @@ -0,0 +1,1 @@
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
59 +apple
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
60
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
61 metaedit
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
62
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
63 $ hg metaedit -m 'merge, metaedit'
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
64 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
6031
c3d66af4cb07 tests: show extras that are going to change in the next patch
Anton Shestakov <av6@dwimlabs.net>
parents: 5919
diff changeset
65 $ hg log -r . -T '{rev}: {join(extras, " ")}\n'
c3d66af4cb07 tests: show extras that are going to change in the next patch
Anton Shestakov <av6@dwimlabs.net>
parents: 5919
diff changeset
66 5: amend_source=[0-9a-f]+ branch=default (re)
5918
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
67 $ hg diff -r 'p1(.)' -r '.'
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
68 diff -r 88a060ab6523 -r 1528d42f3e83 banana
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
69 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
70 +++ b/banana Thu Jan 01 00:00:00 1970 +0000
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
71 @@ -0,0 +1,1 @@
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
72 +banana
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
73 $ hg diff -r 'p2(.)' -r '.'
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
74 diff -r d8c7baf0ca58 -r 1528d42f3e83 apple
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
75 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
76 +++ b/apple Thu Jan 01 00:00:00 1970 +0000
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
77 @@ -0,0 +1,1 @@
13c406d9912c tests: add test-amend-merge.t with a simple merge amended by various commands
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
78 +apple
5919
1a8e86053adb topic: don't lose any file changes when changing topic of a merge commit
Anton Shestakov <av6@dwimlabs.net>
parents: 5918
diff changeset
79
1a8e86053adb topic: don't lose any file changes when changing topic of a merge commit
Anton Shestakov <av6@dwimlabs.net>
parents: 5918
diff changeset
80 topics
1a8e86053adb topic: don't lose any file changes when changing topic of a merge commit
Anton Shestakov <av6@dwimlabs.net>
parents: 5918
diff changeset
81
1a8e86053adb topic: don't lose any file changes when changing topic of a merge commit
Anton Shestakov <av6@dwimlabs.net>
parents: 5918
diff changeset
82 $ hg topics -r . foo
1a8e86053adb topic: don't lose any file changes when changing topic of a merge commit
Anton Shestakov <av6@dwimlabs.net>
parents: 5918
diff changeset
83 switching to topic foo
1a8e86053adb topic: don't lose any file changes when changing topic of a merge commit
Anton Shestakov <av6@dwimlabs.net>
parents: 5918
diff changeset
84 changed topic on 1 changesets to "foo"
6031
c3d66af4cb07 tests: show extras that are going to change in the next patch
Anton Shestakov <av6@dwimlabs.net>
parents: 5919
diff changeset
85 $ hg log -r . -T '{rev}: {join(extras, " ")}\n'
6032
2800aa3c3dbf topic: drop the old workaround for detecting amends by amend_source
Anton Shestakov <av6@dwimlabs.net>
parents: 6031
diff changeset
86 6: _rewrite_noise=[0-9a-f]+ amend_source=[0-9a-f]+ branch=default topic=foo (re)
5919
1a8e86053adb topic: don't lose any file changes when changing topic of a merge commit
Anton Shestakov <av6@dwimlabs.net>
parents: 5918
diff changeset
87 $ hg diff -r 'p1(.)' -r '.'
6032
2800aa3c3dbf topic: drop the old workaround for detecting amends by amend_source
Anton Shestakov <av6@dwimlabs.net>
parents: 6031
diff changeset
88 diff -r 88a060ab6523 -r 05be679ae1bd banana
5919
1a8e86053adb topic: don't lose any file changes when changing topic of a merge commit
Anton Shestakov <av6@dwimlabs.net>
parents: 5918
diff changeset
89 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1a8e86053adb topic: don't lose any file changes when changing topic of a merge commit
Anton Shestakov <av6@dwimlabs.net>
parents: 5918
diff changeset
90 +++ b/banana Thu Jan 01 00:00:00 1970 +0000
1a8e86053adb topic: don't lose any file changes when changing topic of a merge commit
Anton Shestakov <av6@dwimlabs.net>
parents: 5918
diff changeset
91 @@ -0,0 +1,1 @@
1a8e86053adb topic: don't lose any file changes when changing topic of a merge commit
Anton Shestakov <av6@dwimlabs.net>
parents: 5918
diff changeset
92 +banana
1a8e86053adb topic: don't lose any file changes when changing topic of a merge commit
Anton Shestakov <av6@dwimlabs.net>
parents: 5918
diff changeset
93 $ hg diff -r 'p2(.)' -r '.'
6032
2800aa3c3dbf topic: drop the old workaround for detecting amends by amend_source
Anton Shestakov <av6@dwimlabs.net>
parents: 6031
diff changeset
94 diff -r d8c7baf0ca58 -r 05be679ae1bd apple
5919
1a8e86053adb topic: don't lose any file changes when changing topic of a merge commit
Anton Shestakov <av6@dwimlabs.net>
parents: 5918
diff changeset
95 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1a8e86053adb topic: don't lose any file changes when changing topic of a merge commit
Anton Shestakov <av6@dwimlabs.net>
parents: 5918
diff changeset
96 +++ b/apple Thu Jan 01 00:00:00 1970 +0000
1a8e86053adb topic: don't lose any file changes when changing topic of a merge commit
Anton Shestakov <av6@dwimlabs.net>
parents: 5918
diff changeset
97 @@ -0,0 +1,1 @@
1a8e86053adb topic: don't lose any file changes when changing topic of a merge commit
Anton Shestakov <av6@dwimlabs.net>
parents: 5918
diff changeset
98 +apple
1a8e86053adb topic: don't lose any file changes when changing topic of a merge commit
Anton Shestakov <av6@dwimlabs.net>
parents: 5918
diff changeset
99
1a8e86053adb topic: don't lose any file changes when changing topic of a merge commit
Anton Shestakov <av6@dwimlabs.net>
parents: 5918
diff changeset
100 $ hg files
1a8e86053adb topic: don't lose any file changes when changing topic of a merge commit
Anton Shestakov <av6@dwimlabs.net>
parents: 5918
diff changeset
101 apple
1a8e86053adb topic: don't lose any file changes when changing topic of a merge commit
Anton Shestakov <av6@dwimlabs.net>
parents: 5918
diff changeset
102 banana
1a8e86053adb topic: don't lose any file changes when changing topic of a merge commit
Anton Shestakov <av6@dwimlabs.net>
parents: 5918
diff changeset
103 root
1a8e86053adb topic: don't lose any file changes when changing topic of a merge commit
Anton Shestakov <av6@dwimlabs.net>
parents: 5918
diff changeset
104 $ hg cat apple banana
1a8e86053adb topic: don't lose any file changes when changing topic of a merge commit
Anton Shestakov <av6@dwimlabs.net>
parents: 5918
diff changeset
105 apple
1a8e86053adb topic: don't lose any file changes when changing topic of a merge commit
Anton Shestakov <av6@dwimlabs.net>
parents: 5918
diff changeset
106 banana