Show More
@@ -0,0 +1,19 b'' | |||||
|
1 | #!/bin/sh | |||
|
2 | ||||
|
3 | # test update logic when there are renames | |||
|
4 | ||||
|
5 | ||||
|
6 | # update with local changes across a file rename | |||
|
7 | hg init a | |||
|
8 | cd a | |||
|
9 | echo a > a | |||
|
10 | hg add a | |||
|
11 | hg ci -m a | |||
|
12 | hg mv a b | |||
|
13 | hg ci -m rename | |||
|
14 | echo b > b | |||
|
15 | hg ci -m change | |||
|
16 | hg up -q 0 | |||
|
17 | echo c > a | |||
|
18 | hg up | |||
|
19 | cd .. |
@@ -0,0 +1,5 b'' | |||||
|
1 | merging a and b to b | |||
|
2 | warning: conflicts during merge. | |||
|
3 | merging b failed! | |||
|
4 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | |||
|
5 | use 'hg resolve' to retry unresolved file merges |
@@ -1170,12 +1170,10 b' class queue(object):' | |||||
1170 | raise util.Abort(_("deletions found between repo revs")) |
|
1170 | raise util.Abort(_("deletions found between repo revs")) | |
1171 | for f in a: |
|
1171 | for f in a: | |
1172 | try: |
|
1172 | try: | |
1173 |
|
|
1173 | util.unlink(repo.wjoin(f)) | |
1174 | except OSError, e: |
|
1174 | except OSError, e: | |
1175 | if e.errno != errno.ENOENT: |
|
1175 | if e.errno != errno.ENOENT: | |
1176 | raise |
|
1176 | raise | |
1177 | try: os.removedirs(os.path.dirname(repo.wjoin(f))) |
|
|||
1178 | except: pass |
|
|||
1179 | repo.dirstate.forget(f) |
|
1177 | repo.dirstate.forget(f) | |
1180 | for f in m + r: |
|
1178 | for f in m + r: | |
1181 | fctx = ctx[f] |
|
1179 | fctx = ctx[f] |
@@ -117,8 +117,23 b' def copies(repo, c1, c2, ca, checkdirs=F' | |||||
117 | diverge = {} |
|
117 | diverge = {} | |
118 |
|
118 | |||
119 | def related(f1, f2, limit): |
|
119 | def related(f1, f2, limit): | |
|
120 | # Walk back to common ancestor to see if the two files originate | |||
|
121 | # from the same file. Since workingfilectx's rev() is None it messes | |||
|
122 | # up the integer comparison logic, hence the pre-step check for | |||
|
123 | # None (f1 and f2 can only be workingfilectx's initially). | |||
|
124 | ||||
|
125 | if f1 == f2: | |||
|
126 | return f1 # a match | |||
|
127 | ||||
120 | g1, g2 = f1.ancestors(), f2.ancestors() |
|
128 | g1, g2 = f1.ancestors(), f2.ancestors() | |
121 | try: |
|
129 | try: | |
|
130 | f1r, f2r = f1.rev(), f2.rev() | |||
|
131 | ||||
|
132 | if f1r is None: | |||
|
133 | f1 = g1.next() | |||
|
134 | if f2r is None: | |||
|
135 | f2 = g2.next() | |||
|
136 | ||||
122 | while 1: |
|
137 | while 1: | |
123 | f1r, f2r = f1.rev(), f2.rev() |
|
138 | f1r, f2r = f1.rev(), f2.rev() | |
124 | if f1r > f2r: |
|
139 | if f1r > f2r: |
@@ -1517,8 +1517,15 b' class localrepository(repo.repository):' | |||||
1517 | if len(lheads) > len(rheads): |
|
1517 | if len(lheads) > len(rheads): | |
1518 | warn = 1 |
|
1518 | warn = 1 | |
1519 | else: |
|
1519 | else: | |
|
1520 | # add local heads involved in the push | |||
|
1521 | updatelheads = [self.changelog.heads(x, lheads) | |||
|
1522 | for x in update] | |||
|
1523 | newheads = set(sum(updatelheads, [])) & set(lheads) | |||
|
1524 | ||||
|
1525 | if not newheads: | |||
|
1526 | return True | |||
|
1527 | ||||
1520 | # add heads we don't have or that are not involved in the push |
|
1528 | # add heads we don't have or that are not involved in the push | |
1521 | newheads = set(lheads) |
|
|||
1522 | for r in rheads: |
|
1529 | for r in rheads: | |
1523 | if r in self.changelog.nodemap: |
|
1530 | if r in self.changelog.nodemap: | |
1524 | desc = self.changelog.heads(r, heads) |
|
1531 | desc = self.changelog.heads(r, heads) |
@@ -1,5 +1,8 b'' | |||||
1 | #!/bin/sh |
|
1 | #!/bin/sh | |
2 |
|
2 | |||
|
3 | echo "[extensions]" >> $HGRCPATH | |||
|
4 | echo "graphlog=" >> $HGRCPATH | |||
|
5 | ||||
3 | mkdir a |
|
6 | mkdir a | |
4 | cd a |
|
7 | cd a | |
5 | hg init |
|
8 | hg init | |
@@ -193,5 +196,72 b" hg -q ci -d '0 0' -mb2" | |||||
193 | hg -q merge 3 |
|
196 | hg -q merge 3 | |
194 | hg -q ci -d '0 0' -mma |
|
197 | hg -q ci -d '0 0' -mma | |
195 | hg push ../l -b b |
|
198 | hg push ../l -b b | |
|
199 | cd .. | |||
|
200 | ||||
|
201 | echo % check prepush with new branch head on former topo non-head | |||
|
202 | hg init n | |||
|
203 | cd n | |||
|
204 | hg branch A | |||
|
205 | echo a >a | |||
|
206 | hg ci -Ama | |||
|
207 | hg branch B | |||
|
208 | echo b >b | |||
|
209 | hg ci -Amb | |||
|
210 | # b is now branch head of B, and a topological head | |||
|
211 | # a is now branch head of A, but not a topological head | |||
|
212 | hg clone . inner | |||
|
213 | cd inner | |||
|
214 | hg up B | |||
|
215 | echo b1 >b1 | |||
|
216 | hg ci -Amb1 | |||
|
217 | # in the clone b1 is now the head of B | |||
|
218 | cd .. | |||
|
219 | hg up 0 | |||
|
220 | echo a2 >a2 | |||
|
221 | hg ci -Ama2 | |||
|
222 | # a2 is now the new branch head of A, and a new topological head | |||
|
223 | # it replaces a former inner branch head, so it should at most warn about A, not B | |||
|
224 | echo %% glog of local | |||
|
225 | hg glog --template "{rev}: {branches} {desc}\n" | |||
|
226 | echo %% glog of remote | |||
|
227 | hg glog -R inner --template "{rev}: {branches} {desc}\n" | |||
|
228 | echo %% outgoing | |||
|
229 | hg out inner --template "{rev}: {branches} {desc}\n" | |||
|
230 | hg push inner | |||
|
231 | cd .. | |||
|
232 | ||||
|
233 | echo % check prepush with new branch head on former topo head | |||
|
234 | hg init o | |||
|
235 | cd o | |||
|
236 | hg branch A | |||
|
237 | echo a >a | |||
|
238 | hg ci -Ama | |||
|
239 | hg branch B | |||
|
240 | echo b >b | |||
|
241 | hg ci -Amb | |||
|
242 | # b is now branch head of B, and a topological head | |||
|
243 | hg up 0 | |||
|
244 | echo a1 >a1 | |||
|
245 | hg ci -Ama1 | |||
|
246 | # a1 is now branch head of A, and a topological head | |||
|
247 | hg clone . inner | |||
|
248 | cd inner | |||
|
249 | hg up B | |||
|
250 | echo b1 >b1 | |||
|
251 | hg ci -Amb1 | |||
|
252 | # in the clone b1 is now the head of B | |||
|
253 | cd .. | |||
|
254 | echo a2 >a2 | |||
|
255 | hg ci -Ama2 | |||
|
256 | # a2 is now the new branch head of A, and a topological head | |||
|
257 | # it replaces a former topological and branch head, so this should not warn | |||
|
258 | echo %% glog of local | |||
|
259 | hg glog --template "{rev}: {branches} {desc}\n" | |||
|
260 | echo %% glog of remote | |||
|
261 | hg glog -R inner --template "{rev}: {branches} {desc}\n" | |||
|
262 | echo %% outgoing | |||
|
263 | hg out inner --template "{rev}: {branches} {desc}\n" | |||
|
264 | hg push inner | |||
|
265 | cd .. | |||
196 |
|
266 | |||
197 | exit 0 |
|
267 | exit 0 |
@@ -175,3 +175,82 b' pushing to ../l' | |||||
175 | searching for changes |
|
175 | searching for changes | |
176 | abort: push creates new remote heads on branch 'a'! |
|
176 | abort: push creates new remote heads on branch 'a'! | |
177 | (did you forget to merge? use push -f to force) |
|
177 | (did you forget to merge? use push -f to force) | |
|
178 | % check prepush with new branch head on former topo non-head | |||
|
179 | marked working directory as branch A | |||
|
180 | adding a | |||
|
181 | marked working directory as branch B | |||
|
182 | adding b | |||
|
183 | updating to branch B | |||
|
184 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
185 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
186 | adding b1 | |||
|
187 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |||
|
188 | adding a2 | |||
|
189 | created new head | |||
|
190 | %% glog of local | |||
|
191 | @ 2: A a2 | |||
|
192 | | | |||
|
193 | | o 1: B b | |||
|
194 | |/ | |||
|
195 | o 0: A a | |||
|
196 | ||||
|
197 | %% glog of remote | |||
|
198 | @ 2: B b1 | |||
|
199 | | | |||
|
200 | o 1: B b | |||
|
201 | | | |||
|
202 | o 0: A a | |||
|
203 | ||||
|
204 | %% outgoing | |||
|
205 | comparing with inner | |||
|
206 | searching for changes | |||
|
207 | 2: A a2 | |||
|
208 | pushing to inner | |||
|
209 | searching for changes | |||
|
210 | note: unsynced remote changes! | |||
|
211 | adding changesets | |||
|
212 | adding manifests | |||
|
213 | adding file changes | |||
|
214 | added 1 changesets with 1 changes to 1 files (+1 heads) | |||
|
215 | % check prepush with new branch head on former topo head | |||
|
216 | marked working directory as branch A | |||
|
217 | adding a | |||
|
218 | marked working directory as branch B | |||
|
219 | adding b | |||
|
220 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |||
|
221 | adding a1 | |||
|
222 | created new head | |||
|
223 | updating to branch A | |||
|
224 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
225 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |||
|
226 | adding b1 | |||
|
227 | adding a2 | |||
|
228 | %% glog of local | |||
|
229 | @ 3: A a2 | |||
|
230 | | | |||
|
231 | o 2: A a1 | |||
|
232 | | | |||
|
233 | | o 1: B b | |||
|
234 | |/ | |||
|
235 | o 0: A a | |||
|
236 | ||||
|
237 | %% glog of remote | |||
|
238 | @ 3: B b1 | |||
|
239 | | | |||
|
240 | | o 2: A a1 | |||
|
241 | | | | |||
|
242 | o | 1: B b | |||
|
243 | |/ | |||
|
244 | o 0: A a | |||
|
245 | ||||
|
246 | %% outgoing | |||
|
247 | comparing with inner | |||
|
248 | searching for changes | |||
|
249 | 3: A a2 | |||
|
250 | pushing to inner | |||
|
251 | searching for changes | |||
|
252 | note: unsynced remote changes! | |||
|
253 | adding changesets | |||
|
254 | adding manifests | |||
|
255 | adding file changes | |||
|
256 | added 1 changesets with 1 changes to 1 files |
General Comments 0
You need to be logged in to leave comments.
Login now