|
1 test of the rebase command |
|
2 -------------------------- |
|
3 |
|
4 $ cat >> $HGRCPATH <<EOF |
|
5 > [defaults] |
|
6 > amend=-d "0 0" |
|
7 > fold=-d "0 0" |
|
8 > split=-d "0 0" |
|
9 > amend=-d "0 0" |
|
10 > [web] |
|
11 > push_ssl = false |
|
12 > allow_push = * |
|
13 > [phases] |
|
14 > publish = False |
|
15 > [diff] |
|
16 > git = 1 |
|
17 > unified = 0 |
|
18 > [ui] |
|
19 > interactive = true |
|
20 > [extensions] |
|
21 > hgext.graphlog= |
|
22 > rebase= |
|
23 > EOF |
|
24 $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH |
|
25 $ echo "topic=$(echo $(dirname $TESTDIR))/hgext3rd/topic/" >> $HGRCPATH |
|
26 $ mkcommit() { |
|
27 > echo "$1" > "$1" |
|
28 > hg add "$1" |
|
29 > hg ci -m "add $1" $2 $3 |
|
30 > } |
|
31 $ logtopic() { |
|
32 > hg log -G -T "{rev}:{node}\ntopics: {topics}" |
|
33 > } |
|
34 |
|
35 Check that rebase keep the topic in the simple case (1 changeset, no merge conflict) |
|
36 ------------------------------------------------------------------------------------ |
|
37 |
|
38 $ hg init testrebase |
|
39 $ cd testrebase |
|
40 $ mkcommit ROOT |
|
41 |
|
42 Work on myfeature |
|
43 $ hg topic myfeature |
|
44 $ mkcommit feature1 |
|
45 $ hg stack |
|
46 ### topic: myfeature |
|
47 ### branch: default |
|
48 t1@ add feature1 (current) |
|
49 ^ add ROOT |
|
50 $ logtopic |
|
51 @ 1:39e7a938055e87615edf675c24a10997ff05bb06 |
|
52 | topics: myfeature |
|
53 o 0:3e7df3b3b17c6deb4a1c70e790782fdf17af96a7 |
|
54 topics: |
|
55 |
|
56 Create another commit on default |
|
57 $ hg update --rev default |
|
58 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
59 $ mkcommit default |
|
60 $ logtopic |
|
61 @ 2:be7622a7a0f43ba713e152f56441275f8e8711ef |
|
62 | topics: |
|
63 | o 1:39e7a938055e87615edf675c24a10997ff05bb06 |
|
64 |/ topics: myfeature |
|
65 o 0:3e7df3b3b17c6deb4a1c70e790782fdf17af96a7 |
|
66 topics: |
|
67 |
|
68 Rebase the commit |
|
69 $ hg update --rev 1 |
|
70 switching to topic myfeature |
|
71 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
72 $ hg rebase |
|
73 rebasing 1:39e7a938055e "add feature1" |
|
74 switching to topic myfeature |
|
75 $ hg stack |
|
76 ### topic: myfeature |
|
77 ### branch: default |
|
78 t1@ add feature1 (current) |
|
79 ^ add default |
|
80 $ logtopic |
|
81 @ 3:fc6593661cf3256ba165cbccd6019ead17cc3726 |
|
82 | topics: myfeature |
|
83 o 2:be7622a7a0f43ba713e152f56441275f8e8711ef |
|
84 | topics: |
|
85 o 0:3e7df3b3b17c6deb4a1c70e790782fdf17af96a7 |
|
86 topics: |
|
87 $ hg up 3 |
|
88 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
89 $ hg stack |
|
90 ### topic: myfeature |
|
91 ### branch: default |
|
92 t1@ add feature1 (current) |
|
93 ^ add default |
|
94 |
|
95 Check that rebase keep the topic in case of merge conflict |
|
96 ---------------------------------------------------------- |
|
97 |
|
98 Create a common base |
|
99 $ hg topic --clear |
|
100 $ echo "A" > file |
|
101 $ hg commit -A -m "default2" file |
|
102 created new head |
|
103 |
|
104 Update the common file in a topic |
|
105 $ hg topic myotherfeature |
|
106 $ echo "B" >> file |
|
107 $ hg commit -m "myotherfeature1" |
|
108 |
|
109 Update the common file in default |
|
110 $ hg update --rev default |
|
111 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
112 $ echo "A2" > file |
|
113 $ hg commit -m "default3" |
|
114 |
|
115 Rebase the topic |
|
116 $ hg update --rev 5 |
|
117 switching to topic myotherfeature |
|
118 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
119 $ hg rebase |
|
120 rebasing 5:81f854012ec5 "myotherfeature1" |
|
121 merging file |
|
122 warning: conflicts while merging file! (edit, then use 'hg resolve --mark') |
|
123 switching to topic myotherfeature |
|
124 unresolved conflicts (see hg resolve, then hg rebase --continue) |
|
125 [1] |
|
126 |
|
127 Resolve the conflict |
|
128 $ echo "A2\nB" > file |
|
129 $ hg resolve -m |
|
130 (no more unresolved files) |
|
131 continue: hg rebase --continue |
|
132 $ hg rebase --continue |
|
133 rebasing 5:81f854012ec5 "myotherfeature1" |
|
134 |
|
135 Check the the commit has the right topic |
|
136 |
|
137 $ logtopic |
|
138 @ 7:6ccb9ec4913b64f3ad719ff1ba66495a70bf35a4 |
|
139 | topics: myotherfeature |
|
140 o 6:0b124ef641a7a6f4715d962650d3b367e8c800be |
|
141 | topics: |
|
142 o 4:0cd2e1a45ac4e3f9603a05ccfa6d1c70cd759bc5 |
|
143 | topics: |
|
144 o 3:fc6593661cf3256ba165cbccd6019ead17cc3726 |
|
145 | topics: myfeature |
|
146 o 2:be7622a7a0f43ba713e152f56441275f8e8711ef |
|
147 | topics: |
|
148 o 0:3e7df3b3b17c6deb4a1c70e790782fdf17af96a7 |
|
149 topics: |
|
150 $ hg stack |
|
151 ### topic: myotherfeature |
|
152 ### branch: default |
|
153 t1@ myotherfeature1 (current) |
|
154 ^ default3 |
|
155 $ hg update --rev 7 |
|
156 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
157 $ hg stack |
|
158 ### topic: myotherfeature |
|
159 ### branch: default |
|
160 t1@ myotherfeature1 (current) |
|
161 ^ default3 |