Show More
@@ -21,7 +21,6 b' from .node import (' | |||||
21 | ) |
|
21 | ) | |
22 | from . import ( |
|
22 | from . import ( | |
23 | copies, |
|
23 | copies, | |
24 | error as errormod, |
|
|||
25 | filemerge, |
|
24 | filemerge, | |
26 | obsolete, |
|
25 | obsolete, | |
27 | subrepo, |
|
26 | subrepo, | |
@@ -985,42 +984,10 b' def update(repo, node, branchmerge, forc' | |||||
985 | pas = [repo[ancestor]] |
|
984 | pas = [repo[ancestor]] | |
986 |
|
985 | |||
987 | if node is None: |
|
986 | if node is None: | |
988 | # Here is where we should consider bookmarks, divergent bookmarks, |
|
987 | nodes = list(repo.set('_updatedefaultdest()')) | |
989 | # foreground changesets (successors), and tip of current branch; |
|
988 | if nodes: | |
990 | # but currently we are only checking the branch tips. |
|
989 | node = nodes[0].node() | |
991 | try: |
|
990 | if p1.obsolete() and not p1.children(): | |
992 | node = repo.branchtip(wc.branch()) |
|
|||
993 | except errormod.RepoLookupError: |
|
|||
994 | if wc.branch() == 'default': # no default branch! |
|
|||
995 | node = repo.lookup('tip') # update to tip |
|
|||
996 | else: |
|
|||
997 | raise util.Abort(_("branch %s not found") % wc.branch()) |
|
|||
998 |
|
||||
999 | if p1.obsolete() and not p1.children(): |
|
|||
1000 | # allow updating to successors |
|
|||
1001 | successors = obsolete.successorssets(repo, p1.node()) |
|
|||
1002 |
|
||||
1003 | # behavior of certain cases is as follows, |
|
|||
1004 | # |
|
|||
1005 | # divergent changesets: update to highest rev, similar to what |
|
|||
1006 | # is currently done when there are more than one head |
|
|||
1007 | # (i.e. 'tip') |
|
|||
1008 | # |
|
|||
1009 | # replaced changesets: same as divergent except we know there |
|
|||
1010 | # is no conflict |
|
|||
1011 | # |
|
|||
1012 | # pruned changeset: no update is done; though, we could |
|
|||
1013 | # consider updating to the first non-obsolete parent, |
|
|||
1014 | # similar to what is current done for 'hg prune' |
|
|||
1015 |
|
||||
1016 | if successors: |
|
|||
1017 | # flatten the list here handles both divergent (len > 1) |
|
|||
1018 | # and the usual case (len = 1) |
|
|||
1019 | successors = [n for sub in successors for n in sub] |
|
|||
1020 |
|
||||
1021 | # get the max revision for the given successors set, |
|
|||
1022 | # i.e. the 'tip' of a set |
|
|||
1023 | node = repo.revs('max(%ln)', successors).first() |
|
|||
1024 | pas = [p1] |
|
991 | pas = [p1] | |
1025 |
|
992 | |||
1026 | overwrite = force and not branchmerge |
|
993 | overwrite = force and not branchmerge |
@@ -524,6 +524,55 b' def _mergedefaultdest(repo, subset, x):' | |||||
524 | node = nbhs[0] |
|
524 | node = nbhs[0] | |
525 | return subset & baseset([repo[node].rev()]) |
|
525 | return subset & baseset([repo[node].rev()]) | |
526 |
|
526 | |||
|
527 | def _updatedefaultdest(repo, subset, x): | |||
|
528 | # ``_updatedefaultdest()`` | |||
|
529 | ||||
|
530 | # default destination for update. | |||
|
531 | # # XXX: Currently private because I expect the signature to change. | |||
|
532 | # # XXX: - taking rev as arguments, | |||
|
533 | # # XXX: - bailing out in case of ambiguity vs returning all data. | |||
|
534 | getargs(x, 0, 0, _("_updatedefaultdest takes no arguments")) | |||
|
535 | # Here is where we should consider bookmarks, divergent bookmarks, | |||
|
536 | # foreground changesets (successors), and tip of current branch; | |||
|
537 | # but currently we are only checking the branch tips. | |||
|
538 | node = None | |||
|
539 | wc = repo[None] | |||
|
540 | p1 = wc.p1() | |||
|
541 | try: | |||
|
542 | node = repo.branchtip(wc.branch()) | |||
|
543 | except error.RepoLookupError: | |||
|
544 | if wc.branch() == 'default': # no default branch! | |||
|
545 | node = repo.lookup('tip') # update to tip | |||
|
546 | else: | |||
|
547 | raise util.Abort(_("branch %s not found") % wc.branch()) | |||
|
548 | ||||
|
549 | if p1.obsolete() and not p1.children(): | |||
|
550 | # allow updating to successors | |||
|
551 | successors = obsmod.successorssets(repo, p1.node()) | |||
|
552 | ||||
|
553 | # behavior of certain cases is as follows, | |||
|
554 | # | |||
|
555 | # divergent changesets: update to highest rev, similar to what | |||
|
556 | # is currently done when there are more than one head | |||
|
557 | # (i.e. 'tip') | |||
|
558 | # | |||
|
559 | # replaced changesets: same as divergent except we know there | |||
|
560 | # is no conflict | |||
|
561 | # | |||
|
562 | # pruned changeset: no update is done; though, we could | |||
|
563 | # consider updating to the first non-obsolete parent, | |||
|
564 | # similar to what is current done for 'hg prune' | |||
|
565 | ||||
|
566 | if successors: | |||
|
567 | # flatten the list here handles both divergent (len > 1) | |||
|
568 | # and the usual case (len = 1) | |||
|
569 | successors = [n for sub in successors for n in sub] | |||
|
570 | ||||
|
571 | # get the max revision for the given successors set, | |||
|
572 | # i.e. the 'tip' of a set | |||
|
573 | node = repo.revs('max(%ln)', successors).first() | |||
|
574 | return subset & baseset([repo[node].rev()]) | |||
|
575 | ||||
527 | def adds(repo, subset, x): |
|
576 | def adds(repo, subset, x): | |
528 | """``adds(pattern)`` |
|
577 | """``adds(pattern)`` | |
529 | Changesets that add a file matching pattern. |
|
578 | Changesets that add a file matching pattern. | |
@@ -2162,6 +2211,7 b' def _hexlist(repo, subset, x):' | |||||
2162 |
|
2211 | |||
2163 | symbols = { |
|
2212 | symbols = { | |
2164 | "_mergedefaultdest": _mergedefaultdest, |
|
2213 | "_mergedefaultdest": _mergedefaultdest, | |
|
2214 | "_updatedefaultdest": _updatedefaultdest, | |||
2165 | "adds": adds, |
|
2215 | "adds": adds, | |
2166 | "all": getall, |
|
2216 | "all": getall, | |
2167 | "ancestor": ancestor, |
|
2217 | "ancestor": ancestor, |
General Comments 0
You need to be logged in to leave comments.
Login now