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