983 pas = [None] |
982 pas = [None] |
984 if ancestor is not None: |
983 if ancestor is not None: |
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 |
1027 |
994 |
1028 p2 = repo[node] |
995 p2 = repo[node] |