felipec / git-remote-hg

Transparent bidirectional bridge between Git and Mercurial for Git
GNU General Public License v2.0
369 stars 87 forks source link

Branching does not work as expected? #11

Closed tribut closed 5 years ago

tribut commented 10 years ago

Trying git-remote-hg for the first time, I was not able to create a branch that was not totally disjoint from its ancestor.

Here is what I tried:

git checkout -b branches/newbranch hgremote/branches/default
# do some changes
git commit
git push hgremote branches/newbranch

This did create a new branch, but it had nothing in common with branches/default (probably because all the commits were rewritten as if they had always been on that branch?). Was I doing something wrong? I was trying to create pull requests, see vcpromptignore and tailing-null from this repository. The other branches were created using hg itself.

I am using git-remote-hg 185852eac44c25ae2e8d3b3fb6c9630e754e6363 from this repository and git 1.9.1/hg 2.8.2 from Ubuntu trusty, none of the .gitconfig options are set.

fingolfin commented 10 years ago

Hm, this used to work... I thought that maybe the problem is how you setup the new branch. But even the way how I used to do it (I think) gives weird results:

$ git clone hg::ssh://hg@bitbucket.org/tribut/vcprompt vcprompt
Cloning into 'vcprompt'...
requesting all changes
adding changesets
adding manifests
adding file changes
added 438 changesets with 450 changes to 34 files (+6 heads)
progress revision 99 'master' (100/208)
progress revision 199 'master' (200/208)
progress revision 299 'vcpromptignore' (300/205)
progress revision 399 'vcpromptignore' (400/205)
Checking connectivity... done.
$ cd vcprompt
$ git checkout -b branches/newbranch
Switched to a new branch 'branches/newbranch'
$ echo a > release.txt
$ git commit -m a release.txt
[branches/newbranch b247a37] a
 1 file changed, 1 insertion(+), 81 deletions(-)
 rewrite release.txt (100%)
$ git push --dry-run origin branches/newbranch
searching for changes
no changes found
error: Object 6e2fb0eb6562ac506303fca13779ca8cc8203879 already has a mark
error: Object 48e9453586c694e0a364411264e2f0f89e0225d2 already has a mark
error: Object f9ccd0d259ef572ecdb39a280c98d76318d9bff4 already has a mark
error: Object 870d84b2f88040807d3e033851082ca139127e97 already has a mark
error: Object 0078fa46da8cb65286038a3bb01253ce96676aca already has a mark
...
error: Object 2034767e7bc13cf6f67a271968618e75a61306b4 already has a mark
To hg::ssh://hg@bitbucket.org/tribut/vcprompt
 * [new branch]      branches/newbranch -> branches/newbranch

That was with hg 3.1.2 / git 2.1.2

fingolfin commented 9 years ago

Never mind, this problem with vcprompt seems to be specific to vcprompt. I tried with some other random public hg repository:

$ git clone hg-dbg::https://bitbucket.org/durin42/blatter
Cloning into 'blatter'...
requesting all changes
adding changesets
adding manifests
adding file changes
added 18 changesets with 25 changes to 7 files
Checking connectivity... done.
$ cd blatter
$ git push
searching for changes
no changes found
Everything up-to-date
$ git checkout -b branches/newbranch
Switched to a new branch 'branches/newbranch'
$ echo a > README
$ git commit -m a README
[branches/newbranch 8ab25bb] a
 1 file changed, 1 insertion(+), 197 deletions(-)
 rewrite README (100%)
$ git push --dry-run origin branches/newbranch
searching for changes
no changes found
To hg-dbg::https://bitbucket.org/durin42/blatter
 * [new branch]      branches/newbranch -> branches/newbranch

Inspecting the internals, it seems the branch was created the right way:

$ cd .git/hg
$ hg branches
newbranch                     18:0154ceea551e
default                       17:2e6d60d7d1d5 (inactive)
$ hg log | head -10
changeset:   18:0154ceea551e
branch:      newbranch
tag:         tip
user:        Max Horn <max@quendi.de>
date:        Fri Jan 30 18:43:43 2015 +0100
summary:     a

changeset:   17:2e6d60d7d1d5
user:        Augie Fackler <durin42@gmail.com>
date:        Sat Jul 31 16:46:30 2010 -0500

So, in other words: I can't reproduce the issue.

felipec commented 9 years ago

Sorry for the long delay. Have you tried pushing first the original branch? It should be a no-op.

felipec commented 5 years ago

Well. No reply.