我尝试使用hg push访问git存储库,但它无声无息地失败了。我找到了a single post on the mailing list和a registered hg-git issue,但它们都只有半年大,没有太多的活动。所以我开始认为我误解了/错误地配置了一些东西。我的~/.hgrc包含
[extensions]
hgext.bookmarks =
hgext.git =
#hggit = /path/to/hg-git-0.3.1/hggit
[bookmarks]
track.current = True这段代码重现了这个问题:
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我既试过Ubuntu11.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
发布于 2011-12-20 08:46:01
这里有两个问题:推送应该明确失败,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)。上面代码片段的一个工作版本是这样的(请注意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。现在,它对我很有效。mercurial版本(1.9.1)似乎运行良好。
https://stackoverflow.com/questions/8115044
复制相似问题