Mercurial confusion

12 views
Skip to first unread message

Tduell

unread,
Jun 1, 2010, 7:14:41 PM6/1/10
to hugin and other free panoramic software
Hullo All,
The way the Mercurial repository works has me a bit baffled.
To clone the hugin trunk I used...

hg clone http://hugin.hg.sourceforge.net:8000/hgroot/hugin/hugin
mytrunk

and that worked OK, putting the clone into local dir "mytrunk".
Yesterday I wanted to get the branch (if that is what it is) with the
gsoc2010_patent_free_cpm and test that, and my perusing of the
mercurial repo on sourceforge led me to the conclusion that I could
get it using...

hg clone http://hugin.hg.sourceforge.net:8000/hgroot/hugin/hugin/gsoc2010_patent_free_cpm
mycpmtrunk

It downloaded OK, but what I got was the hugin trunk, exactly what I
have (after an update) in mytrunk. The patent free stuff (dirs and
files) I see when browsing on sourceforge are nowhere to be seen in my
clone.
I have done some homework on the mercurial business, but clearly I
have a poor understanding of it.
Can someone please enlighten me, or at least point me to a good source
of info that will make it all clear to me?

Cheers,
Terry

Bruno Postle

unread,
Jun 1, 2010, 7:55:31 PM6/1/10
to hugin and other free panoramic software
On Tue 01-Jun-2010 at 16:14 -0700, Terry Duell wrote:
>The way the Mercurial repository works has me a bit baffled.
>To clone the hugin trunk I used...
>
> hg clone http://hugin.hg.sourceforge.net:8000/hgroot/hugin/hugin mytrunk

>and that worked OK, putting the clone into local dir "mytrunk".
>Yesterday I wanted to get the branch (if that is what it is) with the
>gsoc2010_patent_free_cpm and test that

The hg clone command fetches the entire repository including all
history and branches, but by default it gives you the sourcecode for
the 'default' branch (i.e. the trunk).

You can get a list of branches with 'heads':

hg heads

Switch to one of these branches with 'update':

hg update gsoc2010_patent_free_cpm

Switch back to the trunk like so:

hg update default

(mercurial will stop you if there are any uncommitted changes,
discard them with `hg revert`)

Don't forget to fetch the latest changes for all 'branches'
occasionally with `hg pull`, then update the visible branch with `hg
update`.

--
Bruno

Tduell

unread,
Jun 2, 2010, 3:34:57 AM6/2/10
to hugin and other free panoramic software
Hullo Bruno,


On Jun 2, 9:55 am, Bruno Postle <br...@postle.net> wrote:
> On Tue 01-Jun-2010 at 16:14 -0700, Terry Duell wrote:
[snip]
>
> The hg clone command fetches the entire repository including all
> history and branches, but by default it gives you the sourcecode for
> the 'default' branch (i.e. the trunk).
>
> You can get a list of branches with 'heads':
>
>    hg heads
>
> Switch to one of these branches with 'update':
>
>    hg update gsoc2010_patent_free_cpm
>
> Switch back to the trunk like so:
>
>    hg update default
>
> (mercurial will stop you if there are any uncommitted changes,
> discard them with `hg revert`)
>
> Don't forget to fetch the latest changes for all 'branches'
> occasionally with `hg pull`, then update the visible branch with `hg
> update`.


Thank you.

Cheers,
Terry

Yuv

unread,
Jun 2, 2010, 10:03:49 PM6/2/10
to hugin and other free panoramic software
On Jun 1, 7:55 pm, Bruno Postle <br...@postle.net> wrote:
> On Tue 01-Jun-2010 at 16:14 -0700, Terry Duell wrote:
>
> >The way the Mercurial repository works has me a bit baffled.
> >To clone the hugin trunk I used...
>
> > hg clone http://hugin.hg.sourceforge.net:8000/hgroot/hugin/hugin mytrunk
> >and that worked OK, putting the clone into local dir "mytrunk".
> >Yesterday I wanted to get the branch (if that is what it is) with the
> >gsoc2010_patent_free_cpm and test that
>
> The hg clone command fetches the entire repository including all
> history and branches, but by default it gives you the sourcecode for
> the 'default' branch (i.e. the trunk).
>
> You can get a list of branches with 'heads':
>
>    hg heads
>
> Switch to one of these branches with 'update':
>
>    hg update gsoc2010_patent_free_cpm
>
> Switch back to the trunk like so:
>
>    hg update default

There must be a way to avoid the switching forth and back. The
following may work (I have not tested in depth, so far it seems to be
ok):

mkdir -p ~/src/hugin
cd ~/src/hugin
hg clone http://hugin.hg.sourceforge.net:8000/hgroot/hugin/hugin trunk
cd trunk
hg update
cd ..
mkdir cpm
cd cpm
ln -s ../trunk/.hg
hg update -C gsoc2010_patent_free_cpm

now you should have two folders with two branches: trunk and cpm.
the .hg folder in the clone is the full repository with all branches

I have not tried how this reacts to commits / pulls / updates. it may
work. there may be a need for more tweaking in how the .hg folder is
linked.

Yuv

Cyrille Berger

unread,
Jun 3, 2010, 3:54:42 AM6/3/10
to hugi...@googlegroups.com
On Thursday 03 June 2010, Yuv wrote:
> There must be a way to avoid the switching forth and back. The
> following may work (I have not tested in depth, so far it seems to be
> ok):
>
> mkdir -p ~/src/hugin
> cd ~/src/hugin
> hg clone http://hugin.hg.sourceforge.net:8000/hgroot/hugin/hugin trunk
> cd trunk
> hg update
> cd ..
> mkdir cpm
> cd cpm

don't do the following:


> ln -s ../trunk/.hg
> hg update -C gsoc2010_patent_free_cpm

Instead:

hg clone ../trunk
hg update -C gsoc2010_patent_free_cpm

It will use hard links (so no abuse of disk space), and it is guaranteed to
work (while symbolic linking of .hg is guaranteed to fail, after all the name
of the current branch is stored inside .hg). But to move patches between
checkouts you will have to do push/pull.

--
Cyrille Berger

Yuv

unread,
Jun 3, 2010, 7:40:23 AM6/3/10
to hugin and other free panoramic software
merci Cyrille,

On Jun 3, 3:54 am, Cyrille Berger <cyrille.ber...@gmail.com> wrote:
> On Thursday 03 June 2010, Yuv wrote:

> > mkdir cpm
> > cd cpm
>
> don't do the following:
>
> > ln -s ../trunk/.hg
> > hg update -C gsoc2010_patent_free_cpm
>
> Instead:
>
> hg clone ../trunk
> hg update -C gsoc2010_patent_free_cpm

that's it. just to reach the intended result it's the last four
commands in my sequence that have to be changed:

mkdir -p ~/src/hugin
cd ~/src/hugin
hg clone http://hugin.hg.sourceforge.net:8000/hgroot/hugin/hugin trunk
cd trunk
hg update
cd ..
hg clone trunk gsoc2010_cpm
cd gsoc2010_cpm
hg update -C gsoc2010_patent_free_cpm

that will yield two folders, side by side, one is trunk and the other
one is the gsoc project.

Yuv

Tduell

unread,
Jun 3, 2010, 7:02:16 PM6/3/10
to hugin and other free panoramic software
Hullo Yuv,

On Jun 3, 9:40 pm, Yuv <goo...@levy.ch> wrote:

> mkdir -p ~/src/hugin
> cd ~/src/hugin
> hg clonehttp://hugin.hg.sourceforge.net:8000/hgroot/hugin/hugintrunk
> cd trunk
> hg update
> cd ..
> hg clone trunk gsoc2010_cpm
> cd gsoc2010_cpm
> hg update -C gsoc2010_patent_free_cpm
>
> that will yield two folders, side by side, one is trunk and the other
> one is the gsoc project.

Excellent. That works OK.

Cheers
Terry
Reply all
Reply to author
Forward
0 new messages