2011-11-13 16 views
12

Estoy tratando de usar hg push en un repositorio de git, pero falla silenciosamente. Encontré a single post on the mailing list y a registered hg-git issue, pero ambos tienen alrededor de medio año sin mucha actividad. Entonces comencé a pensar que entendía mal/configuré mal algo. Mi ~/.hgrc contienehg-git push silenciosamente falla

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

Este fragmento reproduce el problema:

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 

He intentado tanto hg-git 0.2.6-2 enviado con Ubuntu 11.10, y la última versión etiquetada, 0.3.1. Mi mercurial es la versión 1.9.1

Incluso probé dos soluciones propuestas, hg update master antes de comprometerme, y hg bookmark -f master después del compromiso, pero ambas dieron un error.

ACTUALIZACIÓN:

que creó un new issue for this

Respuesta

19

Hay dos cuestiones aquí: empuje debe fallar de forma explícita, y hg-GIT deben informar de ello (pero no lo hace).

El empuje debe fallar, dando "abort: git remote error: refs/heads/master failed to update" when pushing to local clone, porque es un empujón a un repositorio no desnudo (consulte more on that from a mercurial user's perspective). Una versión de trabajo del fragmento de arriba es esto (tenga en cuenta el uso del repositorio 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 

En cuanto a por qué hg-git esconde este error, sospecho que es un problema con las versiones más recientes se incluyen con Ubuntu. Lo que hice fue

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

Se retira dulwich 0.7.1, e instalado 0.8 que se requiere según el sitio hg-git. Ahora, funciona para mí. La versión mercurial (1.9.1) parece funcionar bien.

Cuestiones relacionadas