Mercurial > hg
annotate tests/test-pull-branch.t @ 16536:63c817ea4a70 stable
commit: abort on merge with missing files
Here is a script illustrating the previous behaviour:
The merge brings a new file 'b' from remote
$ hg merge 1 --debug
searching for copies back to rev 1
unmatched files in other:
b
resolving manifests
overwrite: False, partial: False
ancestor: 07f494440405, local: 540395c44225+, remote: 102a90ea7b4a
b: remote created -> g
updating: b 1/1 files (100.00%)
getting b
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
Delete but do not remove b
$ rm b
$ hg st
! b
The commit succeeds
$ hg commit -m merge
$ hg parents --template "{rev} {desc|firstline} files: {files}\n"
3 merge files:
$ hg st
! b
b changes were ignored, but even b existence was ignored
$ hg manifest
a
This happens because localrepo.commitctx() checks the input ctx.files(), which
is empty for workingctx.files() only returns added, modified or removed
entries, and bypass files/manifest updates completely. So the committed
revision manifest is the same as its first parent one, not containing the 'b'
file.
This patch forces the commit to abort in presence of a merge and missing files.
test-merge4.t is modified accordingly as it was introduced to check hg was not
just terminating with a traceback (5e9e8b8d2629).
author | Patrick Mezard <patrick@mezard.eu> |
---|---|
date | Sat, 28 Apr 2012 15:01:57 +0200 |
parents | 41885892796e |
children | f2719b387380 |
rev | line source |
---|---|
12279 | 1 $ hg init t |
2 $ cd t | |
3 $ echo 1 > foo | |
4 $ hg ci -Am1 # 0 | |
5 adding foo | |
6 $ hg branch branchA | |
7 marked working directory as branch branchA | |
15615 | 8 (branches are permanent and global, did you want a bookmark?) |
12279 | 9 $ echo a1 > foo |
10 $ hg ci -ma1 # 1 | |
7372
e17dbf140035
pull: update to branch tip if there is only one head on the current branch
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
11 |
12279 | 12 $ cd .. |
13 $ hg init tt | |
14 $ cd tt | |
15 $ hg pull ../t | |
16 pulling from ../t | |
17 requesting all changes | |
18 adding changesets | |
19 adding manifests | |
20 adding file changes | |
21 added 2 changesets with 2 changes to 1 files | |
22 (run 'hg update' to get a working copy) | |
23 $ hg up branchA | |
24 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
7372
e17dbf140035
pull: update to branch tip if there is only one head on the current branch
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
25 |
12279 | 26 $ cd ../t |
27 $ echo a2 > foo | |
28 $ hg ci -ma2 # 2 | |
29 | |
30 Create branch B: | |
7372
e17dbf140035
pull: update to branch tip if there is only one head on the current branch
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
31 |
12279 | 32 $ hg up 0 |
33 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
34 $ hg branch branchB | |
35 marked working directory as branch branchB | |
15615 | 36 (branches are permanent and global, did you want a bookmark?) |
12279 | 37 $ echo b1 > foo |
38 $ hg ci -mb1 # 3 | |
39 | |
40 $ cd ../tt | |
41 | |
42 A new branch is there | |
7372
e17dbf140035
pull: update to branch tip if there is only one head on the current branch
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
43 |
12279 | 44 $ hg pull -u ../t |
45 pulling from ../t | |
46 searching for changes | |
47 adding changesets | |
48 adding manifests | |
49 adding file changes | |
50 added 2 changesets with 2 changes to 1 files (+1 heads) | |
51 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
52 | |
53 Develop both branches: | |
7372
e17dbf140035
pull: update to branch tip if there is only one head on the current branch
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
54 |
12279 | 55 $ cd ../t |
56 $ hg up branchA | |
57 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
58 $ echo a3 > foo | |
59 $ hg ci -ma3 # 4 | |
60 $ hg up branchB | |
61 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
62 $ echo b2 > foo | |
63 $ hg ci -mb2 # 5 | |
64 | |
65 $ cd ../tt | |
66 | |
67 Should succeed, no new heads: | |
7372
e17dbf140035
pull: update to branch tip if there is only one head on the current branch
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
68 |
12279 | 69 $ hg pull -u ../t |
70 pulling from ../t | |
71 searching for changes | |
72 adding changesets | |
73 adding manifests | |
74 adding file changes | |
75 added 2 changesets with 2 changes to 1 files | |
76 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
77 | |
78 Add a head on other branch: | |
7372
e17dbf140035
pull: update to branch tip if there is only one head on the current branch
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
79 |
12279 | 80 $ cd ../t |
81 $ hg up branchA | |
82 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
83 $ echo a4 > foo | |
84 $ hg ci -ma4 # 6 | |
85 $ hg up branchB | |
86 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
87 $ echo b3.1 > foo | |
88 $ hg ci -m b3.1 # 7 | |
89 $ hg up 5 | |
90 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
91 $ echo b3.2 > foo | |
92 $ hg ci -m b3.2 # 8 | |
93 created new head | |
94 | |
95 $ cd ../tt | |
96 | |
97 Should succeed because there is only one head on our branch: | |
7372
e17dbf140035
pull: update to branch tip if there is only one head on the current branch
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
98 |
12279 | 99 $ hg pull -u ../t |
100 pulling from ../t | |
101 searching for changes | |
102 adding changesets | |
103 adding manifests | |
104 adding file changes | |
105 added 3 changesets with 3 changes to 1 files (+1 heads) | |
106 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
7372
e17dbf140035
pull: update to branch tip if there is only one head on the current branch
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
107 |
12279 | 108 $ cd ../t |
109 $ hg up -C branchA | |
110 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
111 $ echo a5.1 > foo | |
112 $ hg ci -ma5.1 # 9 | |
113 $ hg up 6 | |
114 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
115 $ echo a5.2 > foo | |
116 $ hg ci -ma5.2 # 10 | |
117 created new head | |
118 $ hg up 7 | |
119 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
120 $ echo b4.1 > foo | |
121 $ hg ci -m b4.1 # 11 | |
122 $ hg up -C 8 | |
123 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
124 $ echo b4.2 > foo | |
125 $ hg ci -m b4.2 # 12 | |
7372
e17dbf140035
pull: update to branch tip if there is only one head on the current branch
Benoit Allard <benoit@aeteurope.nl>
parents:
diff
changeset
|
126 |
12279 | 127 $ cd ../tt |
128 | |
129 $ hg pull -u ../t | |
130 pulling from ../t | |
131 searching for changes | |
132 adding changesets | |
133 adding manifests | |
134 adding file changes | |
135 added 4 changesets with 4 changes to 1 files (+1 heads) | |
14485
610873cf064a
Make pull -u behave like pull && update
Brendan Cully <brendan@kublai.com>
parents:
13804
diff
changeset
|
136 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
12279 | 137 |
13803
e380964d53f8
pull: don't suggest running hg merge when new heads are on different branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
12279
diff
changeset
|
138 Make changes on new branch on tt |
e380964d53f8
pull: don't suggest running hg merge when new heads are on different branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
12279
diff
changeset
|
139 |
14485
610873cf064a
Make pull -u behave like pull && update
Brendan Cully <brendan@kublai.com>
parents:
13804
diff
changeset
|
140 $ hg up 6 |
610873cf064a
Make pull -u behave like pull && update
Brendan Cully <brendan@kublai.com>
parents:
13804
diff
changeset
|
141 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
13803
e380964d53f8
pull: don't suggest running hg merge when new heads are on different branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
12279
diff
changeset
|
142 $ hg branch branchC |
e380964d53f8
pull: don't suggest running hg merge when new heads are on different branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
12279
diff
changeset
|
143 marked working directory as branch branchC |
15615 | 144 (branches are permanent and global, did you want a bookmark?) |
13803
e380964d53f8
pull: don't suggest running hg merge when new heads are on different branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
12279
diff
changeset
|
145 $ echo b1 > bar |
13804
7dc2bd4c0dc8
pull: new output message when there are multiple branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
13803
diff
changeset
|
146 $ hg ci -Am "commit on branchC on tt" |
13803
e380964d53f8
pull: don't suggest running hg merge when new heads are on different branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
12279
diff
changeset
|
147 adding bar |
e380964d53f8
pull: don't suggest running hg merge when new heads are on different branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
12279
diff
changeset
|
148 |
e380964d53f8
pull: don't suggest running hg merge when new heads are on different branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
12279
diff
changeset
|
149 Make changes on default branch on t |
e380964d53f8
pull: don't suggest running hg merge when new heads are on different branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
12279
diff
changeset
|
150 |
e380964d53f8
pull: don't suggest running hg merge when new heads are on different branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
12279
diff
changeset
|
151 $ cd ../t |
e380964d53f8
pull: don't suggest running hg merge when new heads are on different branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
12279
diff
changeset
|
152 $ hg up -C default |
e380964d53f8
pull: don't suggest running hg merge when new heads are on different branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
12279
diff
changeset
|
153 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
e380964d53f8
pull: don't suggest running hg merge when new heads are on different branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
12279
diff
changeset
|
154 $ echo a1 > bar |
13804
7dc2bd4c0dc8
pull: new output message when there are multiple branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
13803
diff
changeset
|
155 $ hg ci -Am "commit on default on t" |
13803
e380964d53f8
pull: don't suggest running hg merge when new heads are on different branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
12279
diff
changeset
|
156 adding bar |
e380964d53f8
pull: don't suggest running hg merge when new heads are on different branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
12279
diff
changeset
|
157 |
e380964d53f8
pull: don't suggest running hg merge when new heads are on different branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
12279
diff
changeset
|
158 Pull branchC from tt |
e380964d53f8
pull: don't suggest running hg merge when new heads are on different branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
12279
diff
changeset
|
159 |
e380964d53f8
pull: don't suggest running hg merge when new heads are on different branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
12279
diff
changeset
|
160 $ hg pull ../tt |
e380964d53f8
pull: don't suggest running hg merge when new heads are on different branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
12279
diff
changeset
|
161 pulling from ../tt |
e380964d53f8
pull: don't suggest running hg merge when new heads are on different branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
12279
diff
changeset
|
162 searching for changes |
e380964d53f8
pull: don't suggest running hg merge when new heads are on different branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
12279
diff
changeset
|
163 adding changesets |
e380964d53f8
pull: don't suggest running hg merge when new heads are on different branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
12279
diff
changeset
|
164 adding manifests |
e380964d53f8
pull: don't suggest running hg merge when new heads are on different branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
12279
diff
changeset
|
165 adding file changes |
e380964d53f8
pull: don't suggest running hg merge when new heads are on different branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
12279
diff
changeset
|
166 added 1 changesets with 1 changes to 1 files (+1 heads) |
e380964d53f8
pull: don't suggest running hg merge when new heads are on different branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
12279
diff
changeset
|
167 (run 'hg heads' to see heads) |
13804
7dc2bd4c0dc8
pull: new output message when there are multiple branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
13803
diff
changeset
|
168 |
7dc2bd4c0dc8
pull: new output message when there are multiple branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
13803
diff
changeset
|
169 Make changes on default and branchC on tt |
7dc2bd4c0dc8
pull: new output message when there are multiple branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
13803
diff
changeset
|
170 |
7dc2bd4c0dc8
pull: new output message when there are multiple branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
13803
diff
changeset
|
171 $ cd ../tt |
7dc2bd4c0dc8
pull: new output message when there are multiple branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
13803
diff
changeset
|
172 $ hg pull ../t |
7dc2bd4c0dc8
pull: new output message when there are multiple branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
13803
diff
changeset
|
173 pulling from ../t |
7dc2bd4c0dc8
pull: new output message when there are multiple branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
13803
diff
changeset
|
174 searching for changes |
7dc2bd4c0dc8
pull: new output message when there are multiple branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
13803
diff
changeset
|
175 adding changesets |
7dc2bd4c0dc8
pull: new output message when there are multiple branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
13803
diff
changeset
|
176 adding manifests |
7dc2bd4c0dc8
pull: new output message when there are multiple branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
13803
diff
changeset
|
177 adding file changes |
7dc2bd4c0dc8
pull: new output message when there are multiple branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
13803
diff
changeset
|
178 added 1 changesets with 1 changes to 1 files (+1 heads) |
7dc2bd4c0dc8
pull: new output message when there are multiple branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
13803
diff
changeset
|
179 (run 'hg heads' to see heads) |
7dc2bd4c0dc8
pull: new output message when there are multiple branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
13803
diff
changeset
|
180 $ hg up -C default |
7dc2bd4c0dc8
pull: new output message when there are multiple branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
13803
diff
changeset
|
181 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
7dc2bd4c0dc8
pull: new output message when there are multiple branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
13803
diff
changeset
|
182 $ echo a1 > bar1 |
7dc2bd4c0dc8
pull: new output message when there are multiple branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
13803
diff
changeset
|
183 $ hg ci -Am "commit on default on tt" |
7dc2bd4c0dc8
pull: new output message when there are multiple branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
13803
diff
changeset
|
184 adding bar1 |
7dc2bd4c0dc8
pull: new output message when there are multiple branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
13803
diff
changeset
|
185 $ hg up branchC |
7dc2bd4c0dc8
pull: new output message when there are multiple branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
13803
diff
changeset
|
186 2 files updated, 0 files merged, 1 files removed, 0 files unresolved |
7dc2bd4c0dc8
pull: new output message when there are multiple branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
13803
diff
changeset
|
187 $ echo a1 > bar2 |
7dc2bd4c0dc8
pull: new output message when there are multiple branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
13803
diff
changeset
|
188 $ hg ci -Am "commit on branchC on tt" |
7dc2bd4c0dc8
pull: new output message when there are multiple branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
13803
diff
changeset
|
189 adding bar2 |
7dc2bd4c0dc8
pull: new output message when there are multiple branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
13803
diff
changeset
|
190 |
7dc2bd4c0dc8
pull: new output message when there are multiple branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
13803
diff
changeset
|
191 Make changes on default and branchC on t |
7dc2bd4c0dc8
pull: new output message when there are multiple branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
13803
diff
changeset
|
192 |
7dc2bd4c0dc8
pull: new output message when there are multiple branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
13803
diff
changeset
|
193 $ cd ../t |
7dc2bd4c0dc8
pull: new output message when there are multiple branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
13803
diff
changeset
|
194 $ hg up default |
7dc2bd4c0dc8
pull: new output message when there are multiple branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
13803
diff
changeset
|
195 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
7dc2bd4c0dc8
pull: new output message when there are multiple branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
13803
diff
changeset
|
196 $ echo a1 > bar3 |
7dc2bd4c0dc8
pull: new output message when there are multiple branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
13803
diff
changeset
|
197 $ hg ci -Am "commit on default on t" |
7dc2bd4c0dc8
pull: new output message when there are multiple branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
13803
diff
changeset
|
198 adding bar3 |
7dc2bd4c0dc8
pull: new output message when there are multiple branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
13803
diff
changeset
|
199 $ hg up branchC |
7dc2bd4c0dc8
pull: new output message when there are multiple branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
13803
diff
changeset
|
200 2 files updated, 0 files merged, 1 files removed, 0 files unresolved |
7dc2bd4c0dc8
pull: new output message when there are multiple branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
13803
diff
changeset
|
201 $ echo a1 > bar4 |
7dc2bd4c0dc8
pull: new output message when there are multiple branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
13803
diff
changeset
|
202 $ hg ci -Am "commit on branchC on tt" |
7dc2bd4c0dc8
pull: new output message when there are multiple branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
13803
diff
changeset
|
203 adding bar4 |
7dc2bd4c0dc8
pull: new output message when there are multiple branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
13803
diff
changeset
|
204 |
7dc2bd4c0dc8
pull: new output message when there are multiple branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
13803
diff
changeset
|
205 Pull from tt |
7dc2bd4c0dc8
pull: new output message when there are multiple branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
13803
diff
changeset
|
206 |
7dc2bd4c0dc8
pull: new output message when there are multiple branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
13803
diff
changeset
|
207 $ hg pull ../tt |
7dc2bd4c0dc8
pull: new output message when there are multiple branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
13803
diff
changeset
|
208 pulling from ../tt |
7dc2bd4c0dc8
pull: new output message when there are multiple branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
13803
diff
changeset
|
209 searching for changes |
7dc2bd4c0dc8
pull: new output message when there are multiple branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
13803
diff
changeset
|
210 adding changesets |
7dc2bd4c0dc8
pull: new output message when there are multiple branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
13803
diff
changeset
|
211 adding manifests |
7dc2bd4c0dc8
pull: new output message when there are multiple branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
13803
diff
changeset
|
212 adding file changes |
7dc2bd4c0dc8
pull: new output message when there are multiple branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
13803
diff
changeset
|
213 added 2 changesets with 2 changes to 2 files (+2 heads) |
7dc2bd4c0dc8
pull: new output message when there are multiple branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
13803
diff
changeset
|
214 (run 'hg heads .' to see heads, 'hg merge' to merge) |