summaryrefslogtreecommitdiff
path: root/contrib/remote-helpers
diff options
context:
space:
mode:
authorLibravatar Felipe Contreras <felipe.contreras@gmail.com>2012-11-04 03:13:31 +0100
committerLibravatar Jeff King <peff@peff.net>2012-11-04 08:35:20 -0500
commit46cc3adb60f45273dcb0f9179d20bffe1f77f4ff (patch)
treecfe70a00046e9783f57260eeccf18c75bd05eac8 /contrib/remote-helpers
parentremote-hg: add compat for hg-git author fixes (diff)
downloadtgif-46cc3adb60f45273dcb0f9179d20bffe1f77f4ff.tar.xz
remote-hg: fake bookmark when there's none
Or at least no current bookmark. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Jeff King <peff@peff.net>
Diffstat (limited to 'contrib/remote-helpers')
-rwxr-xr-xcontrib/remote-helpers/git-remote-hg19
1 files changed, 14 insertions, 5 deletions
diff --git a/contrib/remote-helpers/git-remote-hg b/contrib/remote-helpers/git-remote-hg
index 9db4b7e59c..dbe309acfe 100755
--- a/contrib/remote-helpers/git-remote-hg
+++ b/contrib/remote-helpers/git-remote-hg
@@ -26,7 +26,7 @@ import urllib
# git:
# Sensible defaults for git.
# hg bookmarks are exported as git branches, hg branches are prefixed
-# with 'branches/'.
+# with 'branches/', HEAD is a special case.
#
# hg:
# Emulate hg-git.
@@ -430,12 +430,21 @@ def get_branch_tip(repo, branch):
return heads[0]
def list_head(repo, cur):
- global g_head
+ global g_head, bmarks
head = bookmarks.readcurrent(repo)
- if not head:
- return
- node = repo[head]
+ if head:
+ node = repo[head]
+ else:
+ # fake bookmark from current branch
+ head = cur
+ node = repo['.']
+ if not node:
+ return
+ if head == 'default':
+ head = 'master'
+ bmarks[head] = node
+
print "@refs/heads/%s HEAD" % head
g_head = (head, node)