зеркало из https://github.com/microsoft/git.git
remote-hg: simplify branch_tip()
It simply picks the last head that is not closed, but we have a stored list of open heads. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
d3c460b5b4
Коммит
611024e606
|
@ -560,12 +560,8 @@ def do_capabilities(parser):
|
||||||
|
|
||||||
print
|
print
|
||||||
|
|
||||||
def branch_tip(repo, branch):
|
def branch_tip(branch):
|
||||||
# older versions of mercurial don't have this
|
return branches[branch][-1]
|
||||||
if hasattr(repo, 'branchtip'):
|
|
||||||
return repo.branchtip(branch)
|
|
||||||
else:
|
|
||||||
return repo.branchtags()[branch]
|
|
||||||
|
|
||||||
def get_branch_tip(repo, branch):
|
def get_branch_tip(repo, branch):
|
||||||
global branches
|
global branches
|
||||||
|
@ -577,7 +573,7 @@ def get_branch_tip(repo, branch):
|
||||||
# verify there's only one head
|
# verify there's only one head
|
||||||
if (len(heads) > 1):
|
if (len(heads) > 1):
|
||||||
warn("Branch '%s' has more than one head, consider merging" % branch)
|
warn("Branch '%s' has more than one head, consider merging" % branch)
|
||||||
return branch_tip(repo, hgref(branch))
|
return branch_tip(hgref(branch))
|
||||||
|
|
||||||
return heads[0]
|
return heads[0]
|
||||||
|
|
||||||
|
@ -828,7 +824,7 @@ def parse_tag(parser):
|
||||||
|
|
||||||
def write_tag(repo, tag, node, msg, author):
|
def write_tag(repo, tag, node, msg, author):
|
||||||
branch = repo[node].branch()
|
branch = repo[node].branch()
|
||||||
tip = branch_tip(repo, branch)
|
tip = branch_tip(branch)
|
||||||
tip = repo[tip]
|
tip = repo[tip]
|
||||||
|
|
||||||
def getfilectx(repo, memctx, f):
|
def getfilectx(repo, memctx, f):
|
||||||
|
|
Загрузка…
Ссылка в новой задаче