Skip to content

Commit

Permalink
remote-hg: fake bookmark when there's none
Browse files Browse the repository at this point in the history
Or at least no current bookmark.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
  • Loading branch information
Felipe Contreras authored and Jeff King committed Nov 4, 2012
1 parent 9490bd0 commit 46cc3ad
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions contrib/remote-helpers/git-remote-hg
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 46cc3ad

Please sign in to comment.