Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
remote-hg: add branch_tip() helper
author
Felipe Contreras
<felipe.contreras@gmail.com>
Mon, 22 Apr 2013 21:55:13 +0000
(16:55 -0500)
committer
Junio C Hamano
<gitster@pobox.com>
Mon, 22 Apr 2013 22:25:53 +0000
(15:25 -0700)
Idea from gitifyhg, the backwards compatibility is how Mercurial used to
do it.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/remote-helpers/git-remote-hg
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
7e31e1f
)
diff --git
a/contrib/remote-helpers/git-remote-hg
b/contrib/remote-helpers/git-remote-hg
index a4db5b07bc1667d00ba3b03bc536655e33a36ca0..bd93f82857e624955614625f6803f6c160f29445 100755
(executable)
--- a/
contrib/remote-helpers/git-remote-hg
+++ b/
contrib/remote-helpers/git-remote-hg
@@
-457,6
+457,13
@@
def do_capabilities(parser):
print
print
+def branch_tip(repo, branch):
+ # older versions of mercurial don't have this
+ if hasattr(repo, 'branchtip'):
+ return repo.branchtip(branch)
+ else:
+ return repo.branchtags()[branch]
+
def get_branch_tip(repo, branch):
global branches
def get_branch_tip(repo, branch):
global branches
@@
-467,9
+474,7
@@
def get_branch_tip(repo, branch):
# verify there's only one head
if (len(heads) > 1):
warn("Branch '%s' has more than one head, consider merging" % branch)
# verify there's only one head
if (len(heads) > 1):
warn("Branch '%s' has more than one head, consider merging" % branch)
- # older versions of mercurial don't have this
- if hasattr(repo, "branchtip"):
- return repo.branchtip(branch)
+ return branch_tip(repo, branch)
return heads[0]
return heads[0]