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

Pushing to branches fails.. #2

Closed djmitche closed 10 years ago

djmitche commented 10 years ago

hg repo is at https://hg.mozilla.org/build/puppet if you want to have a look

As advertised in the README:

(sandbox)dustin@euclid ~/code/puppetagain/t/puppetagain [moco] $ git push moco branches/default
searching for changes
no changes found
error: src refspec branches/default does not match any.
error: failed to push some refs to 'hg::ssh://hg.mozilla.org/build/puppet'

and since that says "src refspec", maybe it's trying to parse that as a local refspec?

(sandbox)dustin@euclid ~/code/puppetagain/t/puppetagain [moco] $ git push moco moco:branches/default
searching for changes
no changes found
fatal: remote-helpers do not support old:new syntax
ERROR: unhandled export command: 

Here's my config:

(sandbox)dustin@euclid ~/code/puppetagain/t/puppetagain [moco] $ cat .git/config 
[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
        notesRef = refs/notes/hg

[remote "moco"]
        url = hg::ssh://hg.mozilla.org/build/puppet
        fetch = +refs/heads/*:refs/remotes/moco/*

[branch "moco"]
        remote = moco
        merge = refs/heads/branches/default

and local branches:

(sandbox)dustin@euclid ~/code/puppetagain/t/puppetagain [moco] $ git branch -av | grep moco
* moco                             40270ad [ahead 1] Add README.md; a=NPTOB
  remotes/moco/branches/default    099d4b3 Bug 986599: disable filebucket for Concat; r=rail
  remotes/moco/branches/production 82d2c32 Merge default -> production
  remotes/moco/master              099d4b3 Bug 986599: disable filebucket for Concat; r=rail
  remotes/moco/moco                40270ad Add README.md; a=NPTOB

Finally, if I just run 'git push moco', it works, although it rejects the remote and I need to do a pull --rebase to fix it:

(sandbox)dustin@euclid ~/code/puppetagain/t/puppetagain [moco] $ git push moco
searching for changes
no changes found
searching for changes
To hg::ssh://hg.mozilla.org/build/puppet
 ! [remote rejected] moco -> moco
error: failed to push some refs to 'hg::ssh://hg.mozilla.org/build/puppet'
remote: adding changesets
remote: adding manifests
remote: adding file changes
remote: added 1 changesets with 1 changes to 1 files
remote: Trying to insert into pushlog.
remote: Please do not interrupt...
remote: Inserted into the pushlog db successfully.
remote: You can view your change at the following URL:
remote:   https://hg.mozilla.org/build/puppet/rev/c1298edd65ec

This also has the side-effect of creating a 'moco' bookmark on the hg repo. At least, sometimes it does -- on this attempt it did not.

felipec commented 10 years ago

The branch needs to be named "branches/default", that is:

git checkout branches/default

If you use "moco:branches/default", that should also work, but you need my patches that were never applied to Git upstream (it works in git-fc though).

djmitche commented 10 years ago

The local branch needs to have that name?

Just making sure, as I'm tracking 'default' in two upstream hg repos, so there's no good way to have the same local name for both of them :/

felipec commented 10 years ago

The local branch needs to have that name?

Yes, that's a limitation of Git. I already sent the patches to fix that, but they were not applied.

For now you would need to do git reset --hard branches/default $what before every time you want to push.

Or you could use git-fc, in which case you can do git push moco moco:branches/default.

djmitche commented 10 years ago

Great, thanks!

felipec commented 10 years ago

I guess I'll close this then.