# hg2git error

10 messages from 2009-05-24 to 2009-07-22. Participants: Johannes Schindelin, Sverre Rabbelier, Rocco Rutte, Matthieu Moy.
Thread: https://gitlist.dev/t/19485

## Johannes Schindelin, 2009-05-24 17:33

Subject: hg2git error
Message-ID: <alpine.DEB.1.00.0905241932301.26154@pacific.mpi-cbg.de>
URL: https://gitlist.dev/e/alpine.DEB.1.00.0905241932301.26154%40pacific.mpi-cbg.de

```
Hi,

I get this error:

Error: repository has at least one unnamed head: hg r533

How to cope with that?

Ciao,
Dscho

```

## Sverre Rabbelier, 2009-05-24 17:38

Subject: Re: hg2git error
Message-ID: <fabb9a1e0905241038x7ea22622k930f50b9c7598c6e@mail.gmail.com>
URL: https://gitlist.dev/e/fabb9a1e0905241038x7ea22622k930f50b9c7598c6e%40mail.gmail.com
In-Reply-To: <alpine.DEB.1.00.0905241932301.26154@pacific.mpi-cbg.de>

```
Heya,

On Sun, May 24, 2009 at 19:33, Johannes Schindelin
<Johannes.Schindelin@gmx.de> wrote:
> How to cope with that?

I've been working on making hg-git [0] usable as a two-way bridge
(that is, use it to interact with a hg repository using git). It is
coping just fine with unnamed heads so far :).

</shameless plug>

[0] http://hg-git.github.com/

-- 
Cheers,

Sverre Rabbelier

```

## Johannes Schindelin, 2009-05-24 18:16

Subject: Re: hg2git error
Message-ID: <alpine.DEB.1.00.0905242013080.26154@pacific.mpi-cbg.de>
URL: https://gitlist.dev/e/alpine.DEB.1.00.0905242013080.26154%40pacific.mpi-cbg.de
In-Reply-To: <fabb9a1e0905241038x7ea22622k930f50b9c7598c6e@mail.gmail.com>

```
Hi,

On Sun, 24 May 2009, Sverre Rabbelier wrote:

> On Sun, May 24, 2009 at 19:33, Johannes Schindelin
> <Johannes.Schindelin@gmx.de> wrote:
> > How to cope with that?
> 
> I've been working on making hg-git [0] usable as a two-way bridge
> (that is, use it to interact with a hg repository using git). It is
> coping just fine with unnamed heads so far :).
> 
> </shameless plug>

It says "Achtung! Alpha!".  How alpha is it?

Also, there is the issue that it is a Hg extension.  My experience with 
such extensions and their dependency on certain Hg versions make me ask: 
what version of Hg must I install before I can use Hg-git?

Ciao,
Dscho

```

## Sverre Rabbelier, 2009-05-24 18:20

Subject: Re: hg2git error
Message-ID: <fabb9a1e0905241120v65adf9f9u7b8d212e99d7f6cd@mail.gmail.com>
URL: https://gitlist.dev/e/fabb9a1e0905241120v65adf9f9u7b8d212e99d7f6cd%40mail.gmail.com
In-Reply-To: <alpine.DEB.1.00.0905242013080.26154@pacific.mpi-cbg.de>

```
Heya,

On Sun, May 24, 2009 at 20:16, Johannes Schindelin
<Johannes.Schindelin@gmx.de> wrote:
> It says "Achtung! Alpha!".  How alpha is it?

I'm using it to work on Melange, the problems I've had with it so far
have all been fixed :).

> Also, there is the issue that it is a Hg extension.  My experience with
> such extensions and their dependency on certain Hg versions make me ask:
> what version of Hg must I install before I can use Hg-git?

Right, you will need to have hg installed to bridge between git and
hg, I think the current requirements are 'python 2.5' and 'hg 1.2' but
that's mostly because that's what we're testing, not because we depend
on specific features.

-- 
Cheers,

Sverre Rabbelier

```

## Rocco Rutte, 2009-05-25 11:34

Subject: Re: hg2git error
Message-ID: <20090525113418.GA3259@robert>
URL: https://gitlist.dev/e/20090525113418.GA3259%40robert
In-Reply-To: <alpine.DEB.1.00.0905241932301.26154@pacific.mpi-cbg.de>

```
Hi,

* Johannes Schindelin wrote:

> Error: repository has at least one unnamed head: hg r533

I'm afraid there's nothing you can do except a) wait until somebody with
push access to the repo merges or b) do that yourself. The error means
that on a branch there's more than one head (i.e. childless
revision). There's no equivalent concept in git which is why I don't
know what to do. Generating fake branch names for git may be a little
messy I think.

Rocco

```

## Johannes Schindelin, 2009-05-25 11:43

Subject: Re: hg2git error
Message-ID: <alpine.DEB.1.00.0905251341370.4288@intel-tinevez-2-302>
URL: https://gitlist.dev/e/alpine.DEB.1.00.0905251341370.4288%40intel-tinevez-2-302
In-Reply-To: <20090525113418.GA3259@robert>

```
Hi,

On Mon, 25 May 2009, Rocco Rutte wrote:

> * Johannes Schindelin wrote:
> 
> > Error: repository has at least one unnamed head: hg r533
> 
> I'm afraid there's nothing you can do except a) wait until somebody with
> push access to the repo merges or b) do that yourself. The error means
> that on a branch there's more than one head (i.e. childless
> revision). There's no equivalent concept in git which is why I don't
> know what to do. Generating fake branch names for git may be a little
> messy I think.

I disagree... The worst solution is to stop working at all.  A better 
solution would be to ignore the unnamed head, and the best solution would 
probably be to generate ref names that are _not_ branch names for such 
heads.

Ciao,
Dscho

```

## Matthieu Moy, 2009-05-25 11:57

Subject: Re: hg2git error
Message-ID: <vpqprdxpf8g.fsf@bauges.imag.fr>
URL: https://gitlist.dev/e/vpqprdxpf8g.fsf%40bauges.imag.fr
In-Reply-To: <alpine.DEB.1.00.0905251341370.4288@intel-tinevez-2-302>

```
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> I disagree... The worst solution is to stop working at all.  A better 
> solution would be to ignore the unnamed head,

... or to import the commits of this unnamed head, without setting a
Git reference to it (with a message on the console saying stg like
"Unnamed head imported as commit %s\n" to let the user do something
with the sha1).

> and the best solution would probably be to generate ref names that
> are _not_ branch names for such heads.

Stg like refs/hg-heads/<branch>/<number> ? (seems to be accepted in
the Git namespace)

(my 2 cents)

-- 
Matthieu

```

## Rocco Rutte, 2009-05-25 13:22

Subject: Re: hg2git error
Message-ID: <20090525132242.GB3259@robert>
URL: https://gitlist.dev/e/20090525132242.GB3259%40robert
In-Reply-To: <alpine.DEB.1.00.0905251341370.4288@intel-tinevez-2-302>

```
Hi,

* Johannes Schindelin wrote:
> On Mon, 25 May 2009, Rocco Rutte wrote:
> > * Johannes Schindelin wrote:

> > > Error: repository has at least one unnamed head: hg r533

> > I'm afraid there's nothing you can do except a) wait until somebody with
> > push access to the repo merges or b) do that yourself. The error means
> > that on a branch there's more than one head (i.e. childless
> > revision). There's no equivalent concept in git which is why I don't
> > know what to do. Generating fake branch names for git may be a little
> > messy I think.

> I disagree... The worst solution is to stop working at all.  A better 
> solution would be to ignore the unnamed head, and the best solution would 
> probably be to generate ref names that are _not_ branch names for such 
> heads.

Both solutions require refactoring and new code that is abled to walk
the DAG mercurial gives us since in both cases we'd need to find the
fork point. I don't know mercurials good enough to say if and how much
its API can help here.

I don't use git any longer and do only fix obvious breakages for
hg-fast-export, read: since this is a new feature I'm afraid I won't
implement it.

Rocco

```

## Johannes Schindelin, 2009-07-22 17:47

Subject: Re: hg2git error
Message-ID: <alpine.DEB.1.00.0907221946590.7343@intel-tinevez-2-302>
URL: https://gitlist.dev/e/alpine.DEB.1.00.0907221946590.7343%40intel-tinevez-2-302
In-Reply-To: <fabb9a1e0905241120v65adf9f9u7b8d212e99d7f6cd@mail.gmail.com>

```
Hi,

On Sun, 24 May 2009, Sverre Rabbelier wrote:

> On Sun, May 24, 2009 at 20:16, Johannes Schindelin 
> <Johannes.Schindelin@gmx.de> wrote:
> > It says "Achtung! Alpha!".  How alpha is it?
> 
> I'm using it to work on Melange, the problems I've had with it so far 
> have all been fixed :).
> 
> > Also, there is the issue that it is a Hg extension.  My experience 
> > with such extensions and their dependency on certain Hg versions make 
> > me ask: what version of Hg must I install before I can use Hg-git?
> 
> Right, you will need to have hg installed to bridge between git and hg, 
> I think the current requirements are 'python 2.5' and 'hg 1.2' but 
> that's mostly because that's what we're testing, not because we depend 
> on specific features.

Could you give me a quick run-through how to install it and use it to 
mirror, say, the netbeans repository?

Thanks,
Dscho

```

## Sverre Rabbelier, 2009-07-22 18:05

Subject: Re: hg2git error
Message-ID: <fabb9a1e0907221105n319391es3c928b1bcab4e86a@mail.gmail.com>
URL: https://gitlist.dev/e/fabb9a1e0907221105n319391es3c928b1bcab4e86a%40mail.gmail.com
In-Reply-To: <alpine.DEB.1.00.0907221946590.7343@intel-tinevez-2-302>

```
Heya,

On Wed, Jul 22, 2009 at 17:47, Johannes
Schindelin<Johannes.Schindelin@gmx.de> wrote:
> Could you give me a quick run-through how to install it and use it to
> mirror, say, the netbeans repository?

Sure, feel free to ping me on IRC if you have any questions, I'll
explain my workflow for Melange, I reckon you can adapt it to suit
your needs.

1. clone hg-git
ˋˋˋ
mkdir ~/code
git clone git://github.com/schacon/hg-git.git ~/code
ˋˋˋ
2. edit your .hgrc to include the following to turn on the hg-git
plugin, and the bookmarks plugin which hg-git likes to use to store
branches from your git repository:
ˋˋˋ
[extensions]
hgext.bookmarks =
git = ~/code/hg-git
ˋˋˋ
3. hg clone the repository of your choice, I'll pretend it's ~/code/Melange
4. add the following to ~/code/Melange/.hg/hgrc:
ˋˋˋ
[git]
intree=1
ˋˋˋ
5. if possible, add '.git' to .hgignore, if not possible you'll just
have to live with it showing up in 'hg status'
6. run `hg gexport`, this will create a ~/code/Melange/.git which is a
regular git repository
7. add .hg to ~/code/Melange/.git/info/exclude
8. now each time you want to pull in new hg updates, run 'hg pull && hg gexport'
9. Depending on your preferences, you might want to add the following
to your ~/code/Melange/.hg/hgrc below intree=1:
ˋˋˋ
exportbranch=refs/heads/from-hg
ˋˋˋ

Doing so will cause `hg gexport` to override the 'from-hg' branch
instead of 'refs/heads/master', allowing you to work in the git
repository without worrying about losing any changes when you run `hg
gexport`.
10. Push from the git repository as usual:
ˋˋˋ
git remote add origin ssh://srabbelier@repo.or.cz/srv/git/Melange.git
git push origin master
ˋˋˋ

If you have any questions, feel free to ask :).

-- 
Cheers,

Sverre Rabbelier

```
