git-hg icon indicating copy to clipboard operation
git-hg copied to clipboard

"git-hg push" creates new Mercurial head

Open allentiak opened this issue 13 years ago • 8 comments

Hello,

I'm using git hg to interact with a Google code repository. However, if I try to push my changes back to mercurial, I create a new head (wich is a clone of the branch I'm working on + my changes).

The only workaround I found was forcing the push and then closing the duplicated branches...

//I had to force the cloning, otherwise I would get no files at all $git hg clone --force https://(google-username)@code.google.com/p/scalasmt/

$git commit

$git hg push scanning source...(google-username)@code.google.com/p/scalasmt/ searching for changes abort: push creates new remote head (hash)! (did you forget to merge? use push -f to force)

allentiak avatar Jul 04 '12 14:07 allentiak

Got same problem - anyone has any idea how to fix?

m0she avatar Jan 06 '13 15:01 m0she

+1

vedranmiletic avatar Jan 13 '13 20:01 vedranmiletic

Same here, it complains about new remote heads (when it shouldn't), then if try to force, it replicates the whole tree in a new "branch". The new tree looks like this, notice the first commit's parent:

o  changeset:   4:018cee199382
|  tag:         tip
|  parent:      2:b3ad305ef945
|  user:        Oscar Morante <[email protected]>
|  date:        Fri Nov 08 09:10:30 2013 +0100
|  summary:     poiu
|
| o  changeset:   3:d464b70dfcb1
|/   user:        Oscar Morante <[email protected]>
|    date:        Thu Nov 07 18:36:03 2013 +0100
|    summary:     qwer
|
o  changeset:   2:b3ad305ef945
   parent:      -1:000000000000
   user:        Oscar Morante <[email protected]>
   date:        Thu Nov 07 18:35:28 2013 +0100
   summary:     asdf

And this is the original tree:

@  changeset:   1:47f4590483fb
|  branch:      feature-branch
|  user:        Oscar Morante <[email protected]>
|  date:        Thu Nov 07 18:36:03 2013 +0100
|  summary:     qwer
|
o  changeset:   0:bc22880425b1
   user:        Oscar Morante <[email protected]>
   date:        Thu Nov 07 18:35:28 2013 +0100
   summary:     asdf

spacepluk avatar Nov 08 '13 08:11 spacepluk

I think the problem is that 'hg convert' is generating different hashes than fast-export for some reason. I'm using Mercurial 2.7.2, from Debian repositories.

spacepluk avatar Nov 08 '13 10:11 spacepluk

I think this is really a sign that this approach for doing pushes is not really workable. There is another approach taken by git-hg-again that uses the same library used by hg-git but in reverse, which honestly might be a better approach if hg-convert doesn't round-trip properly.

cosmin avatar Jan 06 '14 03:01 cosmin

So I just updated to the latest fast-export. I really doubt that this will help much, since I think the problem is on the hg convert side, but it might be worth trying.

cosmin avatar Jan 06 '14 03:01 cosmin

Any confirmation of this issue? I would like to choose a tool for using hg from git now. Curious to know since this is a vital feature. Thanks.

nengxu avatar Jan 29 '14 00:01 nengxu

If you need a tool to seriously use hg bi-directionally from git, this is probably not the right tool for you, and it's unlikely to get there unless someone that really cares about that problem steps up. In the mean time git-hg-again might prove useful to you.

cosmin avatar Jan 29 '14 19:01 cosmin