comparison mercurial/merge.py @ 26304:bca60842e22d

update: move default destination into a revset This is another step toward having "default" destination more clear and unified. Not all the logic is there because some bookmark related computation happened elsewhere. It will be moved later. The function is private because as for the other ones, cleanup is needed before we can proceed.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Fri, 18 Sep 2015 17:23:10 -0700
parents 007ac1acfcac
children d3bd6cefd742
comparison
equal deleted inserted replaced
26303:c99b4d6efdd8 26304:bca60842e22d
19 nullid, 19 nullid,
20 nullrev, 20 nullrev,
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,
28 util, 27 util,
29 worker, 28 worker,
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]