1. abderrahim
  2. hg-git
  3. Issues
Issue #11 resolved

"revision cannot be pushed since it doesn't have a ref"

Günther Brammer
created an issue

I pushed a test case to http://bitbucket.org/guenther/hg-git-test/. If I try to push this repository into an empty git repository, I get this: {{{ pushing to ../git/ importing Hg objects into Git creating and sending data abort: revision f6e6d463b7fd cannot be pushed since it doesn't have a ref fatal: The remote end hung up unexpectedly }}} The repository was created in this way: {{{ hg init echo foo > bar1 hg add hg commit -m "1" echo foo > bar2 hg add hg commit -m "2" echo foo > bar3 hg add hg commit -m "3" hg update 0 hg transplant 2 hg strip 1 }}}

Comments (13)

  1. Steve Losh
    • changed status to open

    This still doesn't work for me. It pushes but doesn't create the new tags (or refs on the git side). I think the problem is that it only does the tip -> master lookup/mapping if no changesets are being pushed.

    I made a quick change that seems to have fixed it... I'm not sure if it's correct though, since I don't know the internals of git_handler.py. Maybe you could take a look?

    http://bitbucket.org/sjl/hg-git/changeset/e3568785bbdc/

  2. abderrahim repo owner

    I see, del new_refs['capabilities^{}'] should be executed whenever we push to an empty repository, but the rest only if there are no branches/tags (i.e. if revs is empty)

  3. abderrahim repo owner

    I cannot reproduce the behaviour you describe in (comment 2)

    (about comment 4, I didn't think about track.current as it's not the default; I should maybe try it)

  4. Steve Losh

    Hey, I poked around a bit this morning and I think I've figured it out. I tried with a brand new sample repo and couldn't reproduce it either. Then I tried using my existing repo from before and I saw it again.

    I looked closer and realized that the repo I'm trying to push into the empty git repo has a tag in it. If I clone a copy of it to a revision that doesn't have that tag, it pushes just fine. Here's a quick script to show the problem:

    hg init my_hg_repo
    cd my_hg_repo
    
    echo a >> a
    hg add -q
    hg com -m 'Initial'
    
    hg tag v1
    
    mkdir ../git_mirror
    cd ../git_mirror
    git init
    
    cd ../my_hg_repo
    echo '[paths]' >> .hg/hgrc
    echo 'git = ../git_mirror' >> .hg/hgrc
    
    hg push git
    
    echo
    echo 'The proper tags were not created on the Mercurial side.'
    hg tags
    hg bookmarks
    
    echo
    echo 'The changesets do not show up in the log on the git side.'
    cd ../git_mirror
    git log --pretty=oneline
    

    I bisected and the changeset that causes this is 51e4d6ebbc40

  5. stephan.diestelhorst

    This is still (as of changeset ff2d4f541ae9) an issue:

    I have cloned the PTLsim repository from git clone git.ptlsim.org:/project/git/ptlsim-stable.git using hg clone git:git.ptlsim.org/ptlsim-stable.git

    Then I've modified the stuff locally and tred to push in the following way: hg push git+ssh:git.ptlsim.org/project/git/ptlsim-stable.git

    Which results in pushing to git+ssh:git.ptlsim.org/project/git/ptlsim-stable.git importing Hg objects into Git at: 0/5 creating and sending data abort: revision b908069cde5d cannot be pushed since it doesn't have a ref

    Revision b908069cde5d is my local tip, i.e., the last modification I've made locally.

    If also tried different cloning: hg clone git+ssh:git.ptlsim.org/project/git/ptlsim-stable.git and then just hg push but that had the same error.

    Could you please have a look into this?

    Thanks, Stephan

  6. abderrahim repo owner

    Seems weird, this message is supposed to happen only if you use -r. What version of hg are you using? (are you by chance using 1.1?) Please also post the output of 'hg tags', 'hg heads', and 'hg bookmarks'.

  7. stephan.diestelhorst
    #> hg heads
    changeset:   235:709ae91a2d93
    tag:         tip
    user:        Stephan Diestelhorst <stephan.diestelhorst@amd.com>
    date:        Thu Oct 01 16:51:54 2009 +0200
    summary:     <snip>
    
    #> hg tags
    tip                              235:709ae91a2d93
    default/master                   229:d407e5032c4a
    
    #> hg bookmarks
     * master                    235:709ae91a2d93
    
    #> hg version
    Mercurial Distributed SCM (version 1.1.2)
    
    Copyright (C) 2005-2008 Matt Mackall <mpm@selenic.com> and others
    This is free software; see the source for copying conditions. There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    

    So yes, I'm using mercurial 1.1, it was the newest I could find quickly on my old release of Ubuntu.

  8. Log in to comment