[PATCH 2 of 2] setup: retrieve tag from .hg_archival.txt

Mads Kiilerich mads at kiilerich.com
Fri Aug 7 03:32:39 CDT 2009


Gilles Moris wrote, On 08/07/2009 10:00 AM:
>   setup.py |  5 +++--
>   1 files changed, 3 insertions(+), 2 deletions(-)
>
>
> # HG changeset patch
> # User Gilles Moris<gilles.moris at free.fr>
> # Date 1249632003 -7200
> # Node ID 75dab79e63bc781284331c3e1997643b3bd98f16
> # Parent  df6273f8f6268cba0124761e5b659eb06e5a6dcf
> setup: retrieve tag from .hg_archival.txt
>
> diff --git a/setup.py b/setup.py
> --- a/setup.py
> +++ b/setup.py
> @@ -139,8 +139,9 @@
>       hgarchival = open('.hg_archival.txt')
>       for line in hgarchival:
>           if line.startswith('node:'):
> -            version = line.split(':')[1].strip()[:12]
> -            break
>    
> +            version = line.split(' ')[1].strip()[:12]
>    

Eh? Why not keep splitting on ':'?

> +        if line.startswith('tags:'):
> +            version = line.split(' ')[1].strip()
>    

Tag names can contain spaces. Joining names with space might make sense 
for informal display but parsing them by splitting on space sounds 
risky. Perhaps it would be better to just use all tag names in this rare 
case - just like for lasttag. Or did you mean split(' ',1)?

This functionality should obviously use your lasttag functionality. Why 
not put it in the same patch queue and show how they should be integrated?

/Mads


More information about the Mercurial-devel mailing list