comparison mercurial/destutil.py @ 26721:3d094fbedf74

destupdate: indent bookmark and branch logic We'll move the obsolete related logic first (as it is overwriting any other anyway) to make the next patch clearer we add indentation in this one.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Thu, 15 Oct 2015 02:12:15 +0100
parents 6c22a17faa18
children 6cd643a1d32c
comparison
equal deleted inserted replaced
26720:6c22a17faa18 26721:3d094fbedf74
51 - activemark: a bookmark to activate at the end of the update. 51 - activemark: a bookmark to activate at the end of the update.
52 """ 52 """
53 node = None 53 node = None
54 wc = repo[None] 54 wc = repo[None]
55 p1 = wc.p1() 55 p1 = wc.p1()
56 activemark = None 56 movemark, activemark = None
57
58 # we also move the active bookmark, if any
59 node, movemark = bookmarks.calculateupdate(repo.ui, repo, None)
60 if node is not None:
61 activemark = node
62 57
63 if node is None: 58 if node is None:
64 try: 59 # we also move the active bookmark, if any
65 node = repo.branchtip(wc.branch()) 60 node, movemark = bookmarks.calculateupdate(repo.ui, repo, None)
66 except error.RepoLookupError: 61 if node is not None:
67 if wc.branch() == 'default': # no default branch! 62 activemark = node
68 node = repo.lookup('tip') # update to tip
69 else:
70 raise error.Abort(_("branch %s not found") % wc.branch())
71 63
64 if node is None:
65 try:
66 node = repo.branchtip(wc.branch())
67 except error.RepoLookupError:
68 if wc.branch() == 'default': # no default branch!
69 node = repo.lookup('tip') # update to tip
70 else:
71 raise error.Abort(_("branch %s not found") % wc.branch())
72 if p1.obsolete() and not p1.children(): 72 if p1.obsolete() and not p1.children():
73 # allow updating to successors 73 # allow updating to successors
74 successors = obsolete.successorssets(repo, p1.node()) 74 successors = obsolete.successorssets(repo, p1.node())
75 75
76 # behavior of certain cases is as follows, 76 # behavior of certain cases is as follows,