【问题标题】:hg-git push silently failshg-git push 静默失败
【发布时间】:2011-11-13 21:53:46
【问题描述】:

我正在尝试将hg push 用于 git 存储库,但它默默地失败了。我找到了a single post on the mailing lista registered hg-git issue,但两者都大约半岁,没有太多活动。所以我开始认为我误解/错误配置了一些东西。 我的~/.hgrc 包含

[extensions]
hgext.bookmarks =
hgext.git =
#hggit = /path/to/hg-git-0.3.1/hggit
[bookmarks]
track.current = True

这个 sn-p 重现了这个问题:

mkdir /tmp/Git
cd /tmp/Git
git init
echo 'something' > myfile
git add .
git commit -m 'Started'
cd ..
hg clone /tmp/Git /tmp/Hg
cd /tmp/Hg
echo 'another thing' >> myfile
hg ci -m 'Working'
hg log
# Two items listed
hg push
cd ../Git
git log
# Only one item listed, but two expected

我尝试了 Ubuntu 11.10 附带的 hg-git 0.2.6-2 和最新的标记版本 0.3.1。我的 mercurial 是 1.9.1 版

我什至尝试了两种建议的解决方法,提交前hg update master,提交后hg bookmark -f master,但都给出了错误。

更新:

我创建了一个new issue for this

【问题讨论】:

    标签: git mercurial hg-git


    【解决方案1】:

    这里有两个问题:push 应该明确失败,hg-git 应该报告它(但它没有)。

    推送应该失败,给出"abort: git remote error: refs/heads/master failed to update" when pushing to local clone,因为它是对非裸存储库的推送(请参阅more on that from a mercurial user's perspective)。上述 sn-p 的工作版本是这样的(注意使用 Bare 存储库)。

    mkdir /tmp/Git
    cd /tmp/Git
    git init
    echo 'something' > myfile
    git add .
    git commit -m 'Started'
    cd ..
    git clone --bare -l /tmp/Git /tmp/Bare
    hg clone /tmp/Bare/ /tmp/Hg
    cd /tmp/Hg
    echo 'another thing' >> myfile
    hg ci -m 'Working'
    hg log
    # Two items listed
    hg push
    cd ../Bare
    git log
    # Two items listed
    

    关于为什么hg-git 隐藏了这个错误,我怀疑这是 Ubuntu 附带的最新版本的问题。我所做的是

    apt-get remove mercurial-git python-dulwich
    easy_install hg-git
    

    它删除了dulwich 0.7.1,并根据hg-git 站点安装了0.8。现在,它对我有用。善变的版本 (1.9.1) 似乎工作正常。

    【讨论】:

      猜你喜欢
      • 2017-10-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-07-20
      • 2021-03-15
      • 2013-03-21
      • 2014-04-30
      • 2011-04-26
      相关资源
      最近更新 更多