[Python-Dev] Mercurial migration readiness

Éric Araujo merwok at netwok.org
Sun Jul 4 01:16:54 CEST 2010


> 2, throwing away local changes is not that easy in Mercurial,
>    if you have committed them already. There are extensions to
>    uncommit, but they are discouraged and have limitations. So it's
>    best to throw away everything and start over fresh, which is
>    faster if you have a pristine clone.

If you’re using named branches or bookmarks, there is an easy way to
throw away the whole branch. Say you have a clone with branches default,
fix8888, fix9008, shlex-unicode (default is clean upstream Python 3.2,
the other three are branches you made for bug fixes or features). Now
you want to discard shlex-unicode.

 $ cd ..
 $ mv cpython cpython.old
 $ hg clone cpython.old cpython -r default -r fix8888 -r fix9008
 $ rm -r cpython.old

The new repo will only contain the branches you ask for. Giving all
names on the command line may be cumbersome if you’re on a lot of
branches at one, but it’s okay for a small number. A small bit of shell
scripting can automate that easily (get all branches, remove the one
given as argument to the shell function, mv, hg clone, rm).

Of course, a branch you wan to abandon can stay in your repo for a while
if you don’t want to clean up now.

HTH. Regards




More information about the Python-Dev mailing list