hg undo; hg co fails
Thomas Arendsen Hein
thomas at intevation.de
Sun Jun 5 10:51:46 UTC 2005
* Arun Sharma <arun at sharma-home.net> [20050605 10:16]:
> Matt Mackall wrote:
>
> >>(Should there be a hg version command which gives the hash on which
> >>the installation is based?)
> >
> >Not sure how I'd implement that, perhaps with a hack to setup.py?
>
> Patch attached.
> --- a/setup.py Sun Jun 5 07:37:11 2005
> +++ b/setup.py Sun Jun 5 01:12:15 2005
> +f1 = os.popen("hg tip")
> +f2 = open("mercurial/version.py", 'w')
Some comments:
1. os.popen("hg tip") only works if hg is already installed
2. it only looks at the current tip, not at the current checkout
3. mercurial/version.py has to be in .hgignore
4. it ignores tags.
Maybe there is a need for $Id$ like functionality, but on the other
hand I often had problems with this kind of magic, too, e.g. when
managing local configuration files with RCS which had a $Id$ to
indicate their version in upstream's CVS.
I think there must be something which gets updated when using hg,
but can be distributed with tarballs. Additionally it should mention
changes done to the working dir before installing or packaging, and
it should lookup tags.
Maybe something similar to 'hg tip', but producing one of the
following lines:
If the working directory is an unmodified checkout of rev 259:
259:45c293b7134100c027ae3697cfe34921e152170e
If the working directory is an unmodified checkout of tag 0.5b:
193:0a28dfe59f8fab54a5118c5be4f40da34a53cdb7 0.5b
If the working directory is a modified checkout of rev 259:
259:45c293b7134100c027ae3697cfe34921e152170e+
If the working directory is a modified checkout of tag 0.5b:
193:0a28dfe59f8fab54a5118c5be4f40da34a53cdb7+ 0.5b
Maybe 'hg [identify|id]'?
Of course, 1. still applies then, but packaging using distutils can
run 'hg id' to create this file and distribute it in the tarball.
Thomas
--
Email: thomas at intevation.de
http://intevation.de/~thomas/
More information about the Mercurial
mailing list