##// END OF EJS Templates
merge
Kevin Bullock -
r18783:b99e62a9 merge default
parent child Browse files
Show More
@@ -361,9 +361,10 b' def overridecheckunknownfile(origfn, rep'
361 361 # writing the files into the working copy and lfcommands.updatelfiles
362 362 # will update the largefiles.
363 363 def overridemanifestmerge(origfn, repo, p1, p2, pa, branchmerge, force,
364 partial):
364 partial, acceptremote=False):
365 365 overwrite = force and not branchmerge
366 actions = origfn(repo, p1, p2, pa, branchmerge, force, partial)
366 actions = origfn(repo, p1, p2, pa, branchmerge, force, partial,
367 acceptremote)
367 368 processed = []
368 369
369 370 for action in actions:
@@ -2972,7 +2972,7 b' def grep(ui, repo, pattern, *pats, **opt'
2972 2972 if opts.get('ignore_case'):
2973 2973 reflags |= re.I
2974 2974 try:
2975 regexp = re.compile(pattern, reflags)
2975 regexp = util.compilere(pattern, reflags)
2976 2976 except re.error, inst:
2977 2977 ui.warn(_("grep: invalid match pattern: %s\n") % inst)
2978 2978 return 1
@@ -185,12 +185,14 b' def _forgetremoved(wctx, mctx, branchmer'
185 185
186 186 return actions
187 187
188 def manifestmerge(repo, wctx, p2, pa, branchmerge, force, partial):
188 def manifestmerge(repo, wctx, p2, pa, branchmerge, force, partial,
189 acceptremote=False):
189 190 """
190 191 Merge p1 and p2 with ancestor pa and generate merge action list
191 192
192 193 branchmerge and force are as passed in to update
193 194 partial = function to filter file lists
195 acceptremote = accept the incoming changes without prompting
194 196 """
195 197
196 198 overwrite = force and not branchmerge
@@ -331,7 +333,9 b' def manifestmerge(repo, wctx, p2, pa, br'
331 333
332 334 for f, m in sorted(prompts):
333 335 if m == "cd":
334 if repo.ui.promptchoice(
336 if acceptremote:
337 actions.append((f, "r", None, "remote delete"))
338 elif repo.ui.promptchoice(
335 339 _("local changed %s which remote deleted\n"
336 340 "use (c)hanged version or (d)elete?") % f,
337 341 (_("&Changed"), _("&Delete")), 0):
@@ -339,7 +343,9 b' def manifestmerge(repo, wctx, p2, pa, br'
339 343 else:
340 344 actions.append((f, "a", None, "prompt keep"))
341 345 elif m == "dc":
342 if repo.ui.promptchoice(
346 if acceptremote:
347 actions.append((f, "g", (m2.flags(f),), "remote recreating"))
348 elif repo.ui.promptchoice(
343 349 _("remote changed %s which local deleted\n"
344 350 "use (c)hanged version or leave (d)eleted?") % f,
345 351 (_("&Changed"), _("&Deleted")), 0) == 0:
@@ -465,11 +471,11 b' def applyupdates(repo, actions, wctx, mc'
465 471 f, m, args, msg = a
466 472 progress(_updating, z + i + 1, item=f, total=numupdates, unit=_files)
467 473 if m == "m": # merge
474 f2, fd, move = args
468 475 if fd == '.hgsubstate': # subrepo states need updating
469 476 subrepo.submerge(repo, wctx, mctx, wctx.ancestor(mctx),
470 477 overwrite)
471 478 continue
472 f2, fd, move = args
473 479 audit(fd)
474 480 r = ms.resolve(fd, wctx, mctx)
475 481 if r is not None and r > 0:
@@ -512,7 +518,8 b' def applyupdates(repo, actions, wctx, mc'
512 518
513 519 return updated, merged, removed, unresolved
514 520
515 def calculateupdates(repo, tctx, mctx, ancestor, branchmerge, force, partial):
521 def calculateupdates(repo, tctx, mctx, ancestor, branchmerge, force, partial,
522 acceptremote=False):
516 523 "Calculate the actions needed to merge mctx into tctx"
517 524 actions = []
518 525 folding = not util.checkcase(repo.path)
@@ -526,7 +533,7 b' def calculateupdates(repo, tctx, mctx, a'
526 533 actions += manifestmerge(repo, tctx, mctx,
527 534 ancestor,
528 535 branchmerge, force,
529 partial)
536 partial, acceptremote)
530 537 if tctx.rev() is None:
531 538 actions += _forgetremoved(tctx, mctx, branchmerge)
532 539 return actions
@@ -602,10 +609,11 b' def update(repo, node, branchmerge, forc'
602 609 branchmerge = whether to merge between branches
603 610 force = whether to force branch merging or file overwriting
604 611 partial = a function to filter file lists (dirstate not updated)
605 mergeancestor = if false, merging with an ancestor (fast-forward)
606 is only allowed between different named branches. This flag
607 is used by rebase extension as a temporary fix and should be
608 avoided in general.
612 mergeancestor = whether it is merging with an ancestor. If true,
613 we should accept the incoming changes for any prompts that occur.
614 If false, merging with an ancestor (fast-forward) is only allowed
615 between different named branches. This flag is used by rebase extension
616 as a temporary fix and should be avoided in general.
609 617
610 618 The table below shows all the behaviors of the update command
611 619 given the -c and -C or no options, whether the working directory
@@ -693,7 +701,7 b' def update(repo, node, branchmerge, forc'
693 701
694 702 ### calculate phase
695 703 actions = calculateupdates(repo, wc, p2, pa,
696 branchmerge, force, partial)
704 branchmerge, force, partial, mergeancestor)
697 705
698 706 ### apply phase
699 707 if not branchmerge: # just jump to the new rev
@@ -1496,8 +1496,6 b' def tag(repo, subset, x):'
1496 1496 s = set([repo[tn].rev()])
1497 1497 else:
1498 1498 s = set([cl.rev(n) for t, n in repo.tagslist() if matcher(t)])
1499 if not s:
1500 raise util.Abort(_("no tags exist that match '%s'") % pattern)
1501 1499 else:
1502 1500 s = set([cl.rev(n) for t, n in repo.tagslist() if t != 'tip'])
1503 1501 return [r for r in subset if r in s]
@@ -662,10 +662,12 b' try:'
662 662 except ImportError:
663 663 _re2 = False
664 664
665 def compilere(pat):
665 def compilere(pat, flags=0):
666 666 '''Compile a regular expression, using re2 if possible
667 667
668 For best performance, use only re2-compatible regexp features.'''
668 For best performance, use only re2-compatible regexp features. The
669 only flags from the re module that are re2-compatible are
670 IGNORECASE and MULTILINE.'''
669 671 global _re2
670 672 if _re2 is None:
671 673 try:
@@ -673,12 +675,16 b' def compilere(pat):'
673 675 _re2 = True
674 676 except ImportError:
675 677 _re2 = False
676 if _re2:
678 if _re2 and (flags & ~(re.IGNORECASE | re.MULTILINE)) == 0:
679 if flags & re.IGNORECASE:
680 pat = '(?i)' + pat
681 if flags & re.MULTILINE:
682 pat = '(?m)' + pat
677 683 try:
678 684 return re2.compile(pat)
679 685 except re2.error:
680 686 pass
681 return re.compile(pat)
687 return re.compile(pat, flags)
682 688
683 689 _fspathcache = {}
684 690 def fspath(name, root):
@@ -719,6 +719,30 b' Test stripping a revision with another c'
719 719
720 720 $ cd ..
721 721
722 Test collapsing changes that add then remove a file
722 723
724 $ hg init collapseaddremove
725 $ cd collapseaddremove
723 726
727 $ touch base
728 $ hg commit -Am base
729 adding base
730 $ touch a
731 $ hg commit -Am a
732 adding a
733 $ hg rm a
734 $ touch b
735 $ hg commit -Am b
736 adding b
737 $ hg rebase -d 0 -r "1::2" --collapse -m collapsed
738 saved backup bundle to $TESTTMP/collapseaddremove/.hg/strip-backup/*-backup.hg (glob)
739 $ hg tglog
740 @ 1: 'collapsed'
741 |
742 o 0: 'base'
743
744 $ hg manifest
745 b
746 base
724 747
748 $ cd ..
@@ -326,8 +326,6 b' Verify that target is not selected as ex'
326 326 $ hg ci -m "J"
327 327
328 328 $ hg rebase -s 8 -d 7 --collapse --config ui.merge=internal:other
329 remote changed E which local deleted
330 use (c)hanged version or leave (d)eleted? c
331 329 saved backup bundle to $TESTTMP/a6/.hg/strip-backup/*-backup.hg (glob)
332 330
333 331 $ hg tglog
@@ -437,8 +437,6 b' we can use patterns when searching for t'
437 437 $ log 'tag("literal:1.0")'
438 438 6
439 439 $ log 'tag("re:0..*")'
440 abort: no tags exist that match '0..*'
441 [255]
442 440
443 441 $ log 'tag(unknown)'
444 442 abort: tag 'unknown' does not exist
General Comments 0
You need to be logged in to leave comments. Login now