Show More
@@ -345,7 +345,16 b' def rebase(ui, repo, **opts):' | |||||
345 | 'resolve, then hg rebase --continue)')) |
|
345 | 'resolve, then hg rebase --continue)')) | |
346 | finally: |
|
346 | finally: | |
347 | ui.setconfig('ui', 'forcemerge', '', 'rebase') |
|
347 | ui.setconfig('ui', 'forcemerge', '', 'rebase') | |
348 | cmdutil.duplicatecopies(repo, rev, target) |
|
348 | if collapsef: | |
|
349 | cmdutil.duplicatecopies(repo, rev, target) | |||
|
350 | else: | |||
|
351 | # If we're not using --collapse, we need to | |||
|
352 | # duplicate copies between the revision we're | |||
|
353 | # rebasing and its first parent, but *not* | |||
|
354 | # duplicate any copies that have already been | |||
|
355 | # performed in the destination. | |||
|
356 | p1rev = repo[rev].p1().rev() | |||
|
357 | cmdutil.duplicatecopies(repo, rev, p1rev, skiprev=target) | |||
349 | if not collapsef: |
|
358 | if not collapsef: | |
350 | newrev = concludenode(repo, rev, p1, p2, extrafn=extrafn, |
|
359 | newrev = concludenode(repo, rev, p1, p2, extrafn=extrafn, | |
351 | editor=editor) |
|
360 | editor=editor) |
@@ -240,3 +240,84 b' Test rebase across repeating renames:' | |||||
240 | 1 files changed, 1 insertions(+), 0 deletions(-) |
|
240 | 1 files changed, 1 insertions(+), 0 deletions(-) | |
241 |
|
241 | |||
242 | $ cd .. |
|
242 | $ cd .. | |
|
243 | ||||
|
244 | Verify that copies get preserved (issue4192). | |||
|
245 | $ hg init copy-gets-preserved | |||
|
246 | $ cd copy-gets-preserved | |||
|
247 | ||||
|
248 | $ echo a > a | |||
|
249 | $ hg add a | |||
|
250 | $ hg commit --message "File a created" | |||
|
251 | $ hg copy a b | |||
|
252 | $ echo b > b | |||
|
253 | $ hg commit --message "File b created as copy of a and modified" | |||
|
254 | $ hg copy b c | |||
|
255 | $ echo c > c | |||
|
256 | $ hg commit --message "File c created as copy of b and modified" | |||
|
257 | $ hg copy c d | |||
|
258 | $ echo d > d | |||
|
259 | $ hg commit --message "File d created as copy of c and modified" | |||
|
260 | ||||
|
261 | Note that there are four entries in the log for d | |||
|
262 | $ hg tglog --follow d | |||
|
263 | @ 3: 'File d created as copy of c and modified' | |||
|
264 | | | |||
|
265 | o 2: 'File c created as copy of b and modified' | |||
|
266 | | | |||
|
267 | o 1: 'File b created as copy of a and modified' | |||
|
268 | | | |||
|
269 | o 0: 'File a created' | |||
|
270 | ||||
|
271 | Update back to before we performed copies, and inject an unrelated change. | |||
|
272 | $ hg update 0 | |||
|
273 | 0 files updated, 0 files merged, 3 files removed, 0 files unresolved | |||
|
274 | ||||
|
275 | $ echo unrelated > unrelated | |||
|
276 | $ hg add unrelated | |||
|
277 | $ hg commit --message "Unrelated file created" | |||
|
278 | created new head | |||
|
279 | $ hg update 4 | |||
|
280 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
281 | ||||
|
282 | Rebase the copies on top of the unrelated change. | |||
|
283 | $ hg rebase --source 1 --dest 4 | |||
|
284 | saved backup bundle to $TESTTMP/copy-gets-preserved/.hg/*.hg (glob) | |||
|
285 | $ hg update 4 | |||
|
286 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
287 | ||||
|
288 | There should still be four entries in the log for d | |||
|
289 | $ hg tglog --follow d | |||
|
290 | @ 4: 'File d created as copy of c and modified' | |||
|
291 | | | |||
|
292 | o 3: 'File c created as copy of b and modified' | |||
|
293 | | | |||
|
294 | o 2: 'File b created as copy of a and modified' | |||
|
295 | | | |||
|
296 | o 0: 'File a created' | |||
|
297 | ||||
|
298 | Same steps as above, but with --collapse on rebase to make sure the | |||
|
299 | copy records collapse correctly. | |||
|
300 | $ hg co 1 | |||
|
301 | 0 files updated, 0 files merged, 3 files removed, 0 files unresolved | |||
|
302 | $ echo more >> unrelated | |||
|
303 | $ hg ci -m 'unrelated commit is unrelated' | |||
|
304 | created new head | |||
|
305 | $ hg rebase -s 2 --dest 5 --collapse | |||
|
306 | merging b and c to c | |||
|
307 | merging c and d to d | |||
|
308 | saved backup bundle to $TESTTMP/copy-gets-preserved/.hg/*.hg (glob) | |||
|
309 | $ hg co tip | |||
|
310 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
311 | ||||
|
312 | This should show both revision 3 and 0 since 'd' was transitively a | |||
|
313 | copy of 'a'. | |||
|
314 | ||||
|
315 | $ hg tglog --follow d | |||
|
316 | @ 3: 'Collapsed revision | |||
|
317 | | * File b created as copy of a and modified | |||
|
318 | | * File c created as copy of b and modified | |||
|
319 | | * File d created as copy of c and modified' | |||
|
320 | o 0: 'File a created' | |||
|
321 | ||||
|
322 | ||||
|
323 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now