22

I'm trying to get the hg-git extension working under Windows and after hours of fiddling, I finally seem to have it working. However, nothing shows up in my git repository even though the output of hg push reads:

importing Hg objects into Git
creating and sending data
    github::refs/heads/master => GIT:8d946209
[command completed successfully Wed Oct 20 15:26:47 2010]
James
  • 6,471
  • 11
  • 59
  • 86

3 Answers3

48

Try issuing the command hg bookmark -f master

(use -f to force an existing bookmark to move)

Then try pushing again.

This works because Hg-Git pushes your bookmarks up to the Git server as branches and will pull Git branches down and set them up as bookmarks. (from the official README.md)

StayOnTarget
  • 11,743
  • 10
  • 52
  • 81
user1447520
  • 581
  • 4
  • 4
  • I have limited experience with git, but I found https://groups.google.com/forum/#!topic/hg-git/x8QYBH-fPs4 which might be related. Does anyone with git experience have anything to say about this? – ftvs Aug 25 '13 at 14:38
  • 3
    I wish I could favorite an answer. Hopefully when I return here, I'll read these comments and realize this is the correct answer for the general case. :) – moswald Nov 26 '13 at 05:00
  • In my case the master bookmark became 'inactive' after I put a tag on a commit. This meant the master bookmark would no longer be updated automatically (until I ran the above command to make it 'active' again). – jtbr May 18 '17 at 17:10
2

And it seems that just after I asked this, I made a trivial change. This was picked up and pushed. So it seems that you have to wait until you've made a new commit in order for hg-git to pick it up.

James
  • 6,471
  • 11
  • 59
  • 86
  • Can you explain what you did? Especially did hg-git missed some changesets in the first run? – Rudi Oct 21 '10 at 07:39
0

I had chosen to 'Initialize this repository with a README'. This meant I ended up with two heads, which I couldn't hg merge because one had a bookmark.

To get pushing working, I had to:

  • configure hg-git and github remote as per https://blog.glyphobet.net/essay/2029
  • pull from github and update
  • force the merge (checking which id to use with hg heads),
  • commit the merge
  • add a trivial change to a file (add a space char to the end),
  • commit, then
  • move the bookmark to the tip
  • push to my configured github remote

This ended up with commands as follows (substituting in <x> sections)

hg pull github
hg update
hg merge <revision-id-of-incoming-git-version>
hg addremove
hg commit -m 'merged with github'
 # make some trivial change to a file - eg add a space where it doesn't cause harm
hg add <changed-file>
hg commit -m 'trivial change'
hg bookmark -f master
hg push github

make sure you pick the remote revision for the merge above - if you don't it doesn't work!

Phasmal
  • 3,840
  • 2
  • 16
  • 11