Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
remote-hg: fake bookmark when there's none
author
Felipe Contreras
<felipe.contreras@gmail.com>
Sun, 4 Nov 2012 02:13:31 +0000
(
03:13
+0100)
committer
Jeff King
<peff@peff.net>
Sun, 4 Nov 2012 13:35:20 +0000
(08:35 -0500)
Or at least no current bookmark.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
contrib/remote-helpers/git-remote-hg
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
9490bd0
)
diff --git
a/contrib/remote-helpers/git-remote-hg
b/contrib/remote-helpers/git-remote-hg
index 9db4b7e59c746f2bb8ce823b12dbaa48e11196b4..dbe309acfe5bb899aa7119afb2a5e7cdd6a0e7ad 100755
(executable)
--- 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
# 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.
#
# hg:
# Emulate hg-git.
@@
-430,12
+430,21
@@
def get_branch_tip(repo, branch):
return heads[0]
def list_head(repo, cur):
return heads[0]
def list_head(repo, cur):
- global g_head
+ global g_head
, bmarks
head = bookmarks.readcurrent(repo)
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)
print "@refs/heads/%s HEAD" % head
g_head = (head, node)