schacon / hg-git

mercurial to git bridge, pushed to directly from the hg-git plugin in Hg
GNU General Public License v2.0
620 stars 71 forks source link

Pushing silently fails #211

Closed Abscissa closed 10 years ago

Abscissa commented 12 years ago
>hg clone git+ssh://git@github.com:Abscissa/tools.git .
importing Hg objects into Git
["git-upload-pack 'Abscissa/tools.git'"]
Counting objects: 102, done.
Compressing objects: 100% (39/39), done.
Total 102 (delta 32), reused 99 (delta 29)
importing Git objects into Hg
updating to branch default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved

{...Modify the file...}

>hg commit -m blah

>hg push
pushing to git+ssh://git@github.com:Abscissa/tools.git
importing Hg objects into Git
creating and sending data
["git-receive-pack 'Abscissa/tools.git'"]
    default::.have => GIT:27bb715c
    default::refs/heads/master => GIT:6085e852

>

It appears to work, but the changeset never shows up on github/.

durin42 commented 12 years ago

Do you have bookmarks enabled? Without bookmarks pushing will likely appear to be a noop.

On Jun 9, 2011, at 8:25 PM, Abscissa wrote:

> hg clone git+ssh://git@github.com:Abscissa/tools.git .
importing Hg objects into Git
["git-upload-pack 'Abscissa/tools.git'"]
Counting objects: 102, done.
Compressing objects: 100% (39/39), done.
Total 102 (delta 32), reused 99 (delta 29)
importing Git objects into Hg
updating to branch default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved

{...Modify the file...}

> hg commit -m blah

> hg push
pushing to git+ssh://git@github.com:Abscissa/tools.git
importing Hg objects into Git
creating and sending data
["git-receive-pack 'Abscissa/tools.git'"]
   default::.have => GIT:27bb715c
   default::refs/heads/master => GIT:6085e852

> 

It appears to work, but the changeset never shows up on github/.

Abscissa commented 12 years ago

I don't even know what that is.

Abscissa commented 12 years ago

It works fine if I use git (but I'd much rather not), and I can repeat the entire process in another directory (and modify the same lines of code) without recieving any conflict issues, so I'm fairly certain it really isn't getting pushed.

durin42 commented 12 years ago

Try using the hg bookmarks extension (Google is likely helpful) and make a bookmark for 'master'. If you need one-on-one support please use the Google Group and not the issue tracker.

On Jun 9, 2011, at 9:03 PM, Abscissa wrote:

It works fine if I use git (but I'd much rather not), and I can repeat the entire process in another directory (and modify the same lines of code) without recieving any conflict issues, so I'm fairly certain it really isn't getting pushed.

Abscissa commented 12 years ago

No, I'm not looking for one-on-one support, that's why I'm using the issue tracker.

I've just looked up "hg bookmarks", and no, that has nothing to do with this.

Here's the basic sequence of steps:

  1. Clone a repo
  2. Change a file
  3. Commit
  4. Push

With those exact same steps:

If I do that with git and clone a repo from github, the new changeset exists in the upstream repo. It works.

If I do it with hg and clone an hg repo, again, the new changeset exists in the upstream repo. It works.

If I do with with hg-git and clone a repo from github, the new changeset does not exist in the upstream repo. It doesn't work. Tags/booksmarks/etc have nothing to do with this.

miquelfire commented 12 years ago

hg-git uses hg bookmarks, if that's not working, then nothing will work.

Abscissa commented 12 years ago

Ok, I understand now. However, over at:

http://mercurial.selenic.com/wiki/BookmarksExtension

It says that bookmarks are enabled by adding "bookmarks =" to the "[extensions]" section of my "mercurial.ini" (well, actually it says ".hgrc", but it seems to be assuming that everyone's on Unix.) But I do have that in there. So it seems there's still some sort of bug.

Stiivi commented 12 years ago

I am now experiencing the same problem, I do:

$ hg push -r master github pushing to git+ssh://git@github.com/Stiivi/brewery.git importing Hg objects into Git creating and sending data ["git-receive-pack '/Stiivi/brewery.git'"] github::.have => GIT:2a623a68 github::refs/tags/v0.6 => GIT:959fd931 github::refs/heads/master => GIT:7ef1ca14

but changes are not reflected. bitbucket repository was updated correctly.

In .hgrc I have:

[extensions] bookmarks = hgext.bookmarks = hggit = convert = mq =

in project's .hg/hgrc i have:

$ cat .hg/hgrc [paths] default = ssh://hg@bitbucket.org/Stiivi/brewery github = git+ssh://git@github.com/Stiivi/brewery.git

It looks that it stopped working after some pull/merge from a foreign git clone.

nelchael commented 12 years ago

I'm getting the same after upgrade to mercurial 1.9 and hg-git HEAD (as 0.2.6 does not work with hg 1.9):

$ hg --verbose --debug push -r master pushing to git+ssh://git@git.overlays.gentoo.org/dev/nelchael.git creating and sending data calling ssh: ssh git@git.overlays.gentoo.org 'git-receive-pack '\''/dev/nelchael.git'\''' ["git-receive-pack '/dev/nelchael.git'"] default::refs/heads/master => GIT:8e0e7bf5

Stiivi commented 12 years ago

I forgot to post an update day or two after my post. What helped was deleting all bookmarks (I do not use bookmarks, so there were only github related bookmarks). However I consider that only as a workaround, as I am not sure if I didn't broke something with that... Anyway, it looks that hg-git forgets to update github related bookmarks under certain circumstances.

nelchael commented 12 years ago

@Stiivi: thanks, unfortunately it didn't work:

$ hg bookmarks master 32:f5e8329c16ad $ hg bookmarks --delete master $ hg push pushing to git+ssh://git@git.overlays.gentoo.org/dev/nelchael.git creating and sending data ["git-receive-pack '/dev/nelchael.git'"] default::refs/heads/master => GIT:8e0e7bf5 $ hg bookmarks no bookmarks set $ hg pull --update pulling from git+ssh://git@git.overlays.gentoo.org/dev/nelchael.git ["git-upload-pack '/dev/nelchael.git'"] no changes found $ hg bookmarks master 32:f5e8329c16ad $ hg push pushing to git+ssh://git@git.overlays.gentoo.org/dev/nelchael.git creating and sending data ["git-receive-pack '/dev/nelchael.git'"] default::refs/heads/master => GIT:8e0e7bf5 $ hg bookmarks master 32:f5e8329c16ad $

jfrelinger commented 12 years ago

I'm having similar issues, deleting the bookmark doesn't work for me either...

vinc3m1 commented 12 years ago

You need to update to your bookmark before you commit, or move the bookmark up to the latest commit. Especially if you have

[bookmarks]
track.current = True

It is possible to be on the same commit as your bookmark, but not actually be moving the bookmark. make sure to check that the bookmark (branch) you want to be on has a star by it and is on the correct commit.

For example:

hg update master
hg commit -m "this commit will move master bookmark (equivalent to git branch) with you"

Otherwise:

hg commit -m "if you accidentally commit first, you need to move master back up to your commit"
hg bookmark -f master
nelchael commented 12 years ago

hg bookmark -f master seems to fix the issue.

vinc3m1 commented 12 years ago

Can OP confirm this issue closed?

adamschmideg commented 12 years ago

I'm having the same issue (hg push failing silently). Your proposed workarounds (hg update master before commit, or hg bookmark -f master after commit) result in an error with a stacktrace:

error: refusing to update checked out branch: refs/heads/master
error: By default, updating the current branch in a non-bare repository
error: is denied, because it will make the index and work tree inconsistent
error: with what you pushed, and will require 'git reset --hard' to match
error: the work tree to HEAD.
error: 
error: You can set 'receive.denyCurrentBranch' configuration variable to
error: 'ignore' or 'warn' in the remote repository to allow pushing into
error: its current branch; however, this is not recommended unless you
error: arranged to update its work tree to match what you pushed in some
error: other way.
error: 
error: To squelch this message and still keep the default behaviour, set
error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
** unknown exception encountered, please report by visiting
**  http://mercurial.selenic.com/wiki/BugTracker
** Python 2.7.2+ (default, Oct  4 2011, 20:06:09) [GCC 4.6.1]
** Mercurial Distributed SCM (version 1.9.1)
fatuhoku commented 11 years ago

Hmms. I do a hg push git+ssh://git@github.com/<<username>>/<<repo-name>>.git and I get

pushing to git+ssh://git@github.com/<<username>>/<<repo-name>>.git
creating and sending data
["git-receive-pack '/<<username>>/<<repo-name>>.git'"]
fatal: protocol error: expected old/new/ref, got '0000000000000000000000000000000000000000 None refs/heads/master'
** unknown exception encountered, please report by visiting
**  http://mercurial.selenic.com/wiki/BugTracker
** Python 2.7.2 (default, Mar 26 2012, 21:05:44) [GCC 4.2.1 (Apple Inc. build 5664)]
** Mercurial Distributed SCM (version 2.2.2)
** Extensions loaded: color, progress, mq, transplant, rebase, hggit
Traceback (most recent call last):
  File "/usr/local/share/python/hg", line 5, in <module>
    pkg_resources.run_script('mercurial==2.2.2', 'hg')
  File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 499, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 1239, in run_script
    execfile(script_filename, namespace, namespace)
  File "/usr/local/lib/python2.7/site-packages/mercurial-2.2.2-py2.7-macosx-10.4-x86_64.egg/EGG-INFO/scripts/hg", line 38, in <module>
    mercurial.dispatch.run()
  File "/usr/local/lib/python2.7/site-packages/mercurial-2.2.2-py2.7-macosx-10.4-x86_64.egg/mercurial/dispatch.py", line 27, in run
    sys.exit((dispatch(request(sys.argv[1:])) or 0) & 255)
  File "/usr/local/lib/python2.7/site-packages/mercurial-2.2.2-py2.7-macosx-10.4-x86_64.egg/mercurial/dispatch.py", line 64, in dispatch
    return _runcatch(req)
  File "/usr/local/lib/python2.7/site-packages/mercurial-2.2.2-py2.7-macosx-10.4-x86_64.egg/mercurial/dispatch.py", line 87, in _runcatch
    return _dispatch(req)
  File "/usr/local/lib/python2.7/site-packages/mercurial-2.2.2-py2.7-macosx-10.4-x86_64.egg/mercurial/dispatch.py", line 696, in _dispatch
    cmdpats, cmdoptions)
  File "/usr/local/lib/python2.7/site-packages/mercurial-2.2.2-py2.7-macosx-10.4-x86_64.egg/mercurial/dispatch.py", line 472, in runcommand
    ret = _runcommand(ui, options, cmd, d)
  File "/usr/local/lib/python2.7/site-packages/mercurial-2.2.2-py2.7-macosx-10.4-x86_64.egg/mercurial/extensions.py", line 184, in wrap
    return wrapper(origfn, *args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/mercurial-2.2.2-py2.7-macosx-10.4-x86_64.egg/hgext/color.py", line 362, in colorcmd
    return orig(ui_, opts, cmd, cmdfunc)
  File "/usr/local/lib/python2.7/site-packages/mercurial-2.2.2-py2.7-macosx-10.4-x86_64.egg/mercurial/dispatch.py", line 786, in _runcommand
    return checkargs()
  File "/usr/local/lib/python2.7/site-packages/mercurial-2.2.2-py2.7-macosx-10.4-x86_64.egg/mercurial/dispatch.py", line 757, in checkargs
    return cmdfunc()
  File "/usr/local/lib/python2.7/site-packages/mercurial-2.2.2-py2.7-macosx-10.4-x86_64.egg/mercurial/dispatch.py", line 693, in <lambda>
    d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
  File "/usr/local/lib/python2.7/site-packages/mercurial-2.2.2-py2.7-macosx-10.4-x86_64.egg/mercurial/util.py", line 463, in check
    return func(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/mercurial-2.2.2-py2.7-macosx-10.4-x86_64.egg/mercurial/extensions.py", line 139, in wrap
    util.checksignature(origfn), *args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/mercurial-2.2.2-py2.7-macosx-10.4-x86_64.egg/mercurial/util.py", line 463, in check
    return func(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/mercurial-2.2.2-py2.7-macosx-10.4-x86_64.egg/hgext/mq.py", line 3392, in mqcommand
    return orig(ui, repo, *args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/mercurial-2.2.2-py2.7-macosx-10.4-x86_64.egg/mercurial/util.py", line 463, in check
    return func(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/mercurial-2.2.2-py2.7-macosx-10.4-x86_64.egg/mercurial/commands.py", line 4549, in push
    newbranch=opts.get('new_branch'))
  File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/hg_git-0.3.2-py2.7.egg/hggit/hgrepo.py", line 22, in push
    git.push(remote.path, revs, force)
  File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/hg_git-0.3.2-py2.7.egg/hggit/git_handler.py", line 229, in push
    changed_refs = self.upload_pack(remote, revs, force)
  File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/hg_git-0.3.2-py2.7.egg/hggit/git_handler.py", line 703, in upload_pack
    changed_refs = client.send_pack(path, changed, genpack)
  File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/dulwich-0.8.3-py2.7-macosx-10.4-x86_64.egg/dulwich/client.py", line 457, in send_pack
    if len(objects) > 0:
  File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/dulwich-0.8.3-py2.7-macosx-10.4-x86_64.egg/dulwich/object_store.py", line 755, in __len__
    return len(list(self.itershas()))
  File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/dulwich-0.8.3-py2.7-macosx-10.4-x86_64.egg/dulwich/object_store.py", line 729, in itershas
    for sha in self.sha_iter:
  File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/dulwich-0.8.3-py2.7-macosx-10.4-x86_64.egg/dulwich/object_store.py", line 822, in next
    o = self.object_store[sha]
  File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/dulwich-0.8.3-py2.7-macosx-10.4-x86_64.egg/dulwich/object_store.py", line 112, in __getitem__
    type_num, uncomp = self.get_raw(sha)
  File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/dulwich-0.8.3-py2.7-macosx-10.4-x86_64.egg/dulwich/object_store.py", line 299, in get_raw
    if len(name) == 40:
TypeError: object of type 'NoneType' has no len()

Which probably doesn't help.