Show More
@@ -430,6 +430,7 b' def overridecalculateupdates(origfn, rep' | |||||
430 | removes = set(a[0] for a in actions['r']) |
|
430 | removes = set(a[0] for a in actions['r']) | |
431 |
|
431 | |||
432 | newglist = [] |
|
432 | newglist = [] | |
|
433 | lfmr = [] # LargeFiles: Mark as Removed | |||
433 | for action in actions['g']: |
|
434 | for action in actions['g']: | |
434 | f, args, msg = action |
|
435 | f, args, msg = action | |
435 | splitstandin = f and lfutil.splitstandin(f) |
|
436 | splitstandin = f and lfutil.splitstandin(f) | |
@@ -456,7 +457,16 b' def overridecalculateupdates(origfn, rep' | |||||
456 | 'keep (l)argefile or use (n)ormal file?' |
|
457 | 'keep (l)argefile or use (n)ormal file?' | |
457 | '$$ &Largefile $$ &Normal file') % lfile |
|
458 | '$$ &Largefile $$ &Normal file') % lfile | |
458 | if repo.ui.promptchoice(msg, 0) == 0: |
|
459 | if repo.ui.promptchoice(msg, 0) == 0: | |
459 | actions['r'].append((lfile, None, msg)) |
|
460 | if branchmerge: | |
|
461 | # largefile can be restored from standin safely | |||
|
462 | actions['r'].append((lfile, None, msg)) | |||
|
463 | else: | |||
|
464 | # "lfile" should be marked as "removed" without | |||
|
465 | # removal of itself | |||
|
466 | lfmr.append((lfile, None, msg)) | |||
|
467 | ||||
|
468 | # linear-merge should treat this largefile as 're-added' | |||
|
469 | actions['a'].append((standin, None, msg)) | |||
460 | else: |
|
470 | else: | |
461 | actions['r'].append((standin, None, msg)) |
|
471 | actions['r'].append((standin, None, msg)) | |
462 | newglist.append((lfile, (p2.flags(lfile),), msg)) |
|
472 | newglist.append((lfile, (p2.flags(lfile),), msg)) | |
@@ -465,9 +475,22 b' def overridecalculateupdates(origfn, rep' | |||||
465 |
|
475 | |||
466 | newglist.sort() |
|
476 | newglist.sort() | |
467 | actions['g'] = newglist |
|
477 | actions['g'] = newglist | |
|
478 | if lfmr: | |||
|
479 | lfmr.sort() | |||
|
480 | actions['lfmr'] = lfmr | |||
468 |
|
481 | |||
469 | return actions |
|
482 | return actions | |
470 |
|
483 | |||
|
484 | def mergerecordupdates(orig, repo, actions, branchmerge): | |||
|
485 | if 'lfmr' in actions: | |||
|
486 | # this should be executed before 'orig', to execute 'remove' | |||
|
487 | # before all other actions | |||
|
488 | for lfile, args, msg in actions['lfmr']: | |||
|
489 | repo.dirstate.remove(lfile) | |||
|
490 | ||||
|
491 | return orig(repo, actions, branchmerge) | |||
|
492 | ||||
|
493 | ||||
471 | # Override filemerge to prompt the user about how they wish to merge |
|
494 | # Override filemerge to prompt the user about how they wish to merge | |
472 | # largefiles. This will handle identical edits without prompting the user. |
|
495 | # largefiles. This will handle identical edits without prompting the user. | |
473 | def overridefilemerge(origfn, repo, mynode, orig, fcd, fco, fca, labels=None): |
|
496 | def overridefilemerge(origfn, repo, mynode, orig, fcd, fco, fca, labels=None): |
@@ -99,6 +99,8 b' def uisetup(ui):' | |||||
99 | overrides.overridecheckunknownfile) |
|
99 | overrides.overridecheckunknownfile) | |
100 | entry = extensions.wrapfunction(merge, 'calculateupdates', |
|
100 | entry = extensions.wrapfunction(merge, 'calculateupdates', | |
101 | overrides.overridecalculateupdates) |
|
101 | overrides.overridecalculateupdates) | |
|
102 | entry = extensions.wrapfunction(merge, 'recordupdates', | |||
|
103 | overrides.mergerecordupdates) | |||
102 | entry = extensions.wrapfunction(filemerge, 'filemerge', |
|
104 | entry = extensions.wrapfunction(filemerge, 'filemerge', | |
103 | overrides.overridefilemerge) |
|
105 | overrides.overridefilemerge) | |
104 | entry = extensions.wrapfunction(cmdutil, 'copy', |
|
106 | entry = extensions.wrapfunction(cmdutil, 'copy', |
@@ -220,4 +220,48 b' Test that linear merge can detect modifi' | |||||
220 | $ cat .hglf/large1 |
|
220 | $ cat .hglf/large1 | |
221 | ba94c2efe5b7c5e0af8d189295ce00553b0612b7 |
|
221 | ba94c2efe5b7c5e0af8d189295ce00553b0612b7 | |
222 |
|
222 | |||
|
223 | Test a linear merge to a revision containing same-name normal file | |||
|
224 | ||||
|
225 | $ hg update -q -C 3 | |||
|
226 | $ hg remove large2 | |||
|
227 | $ echo 'large2 as normal file' > large2 | |||
|
228 | $ hg add large2 | |||
|
229 | $ echo 'large3 as normal file' > large3 | |||
|
230 | $ hg add large3 | |||
|
231 | $ hg commit -m '#5' | |||
|
232 | $ hg manifest | |||
|
233 | .hglf/large1 | |||
|
234 | large2 | |||
|
235 | large3 | |||
|
236 | normal1 | |||
|
237 | ||||
|
238 | (modified largefile is already switched to normal) | |||
|
239 | ||||
|
240 | $ hg update -q -C 2 | |||
|
241 | $ echo 'modified large2 for linear merge' > large2 | |||
|
242 | $ hg update -q 5 | |||
|
243 | local changed .hglf/large2 which remote deleted | |||
|
244 | use (c)hanged version or (d)elete? c | |||
|
245 | remote turned local largefile large2 into a normal file | |||
|
246 | keep (l)argefile or use (n)ormal file? l | |||
|
247 | $ hg debugdirstate --nodates | grep large2 | |||
|
248 | a 0 -1 .hglf/large2 | |||
|
249 | r 0 0 large2 | |||
|
250 | $ cat large2 | |||
|
251 | modified large2 for linear merge | |||
|
252 | ||||
|
253 | (added largefile is already committed as normal) | |||
|
254 | ||||
|
255 | $ hg update -q -C 2 | |||
|
256 | $ echo 'large3 as large file for linear merge' > large3 | |||
|
257 | $ hg add --large large3 | |||
|
258 | $ hg update -q 5 | |||
|
259 | remote turned local largefile large3 into a normal file | |||
|
260 | keep (l)argefile or use (n)ormal file? l | |||
|
261 | $ hg debugdirstate --nodates | grep large3 | |||
|
262 | a 0 -1 .hglf/large3 | |||
|
263 | r 0 0 large3 | |||
|
264 | $ cat large3 | |||
|
265 | large3 as large file for linear merge | |||
|
266 | ||||
223 | $ cd .. |
|
267 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now