[PATCH 1 of 4] latesttag: make latesttaginfo available as a global function

Mads Kiilerich mads at kiilerich.com
Tue Oct 6 05:35:10 CDT 2009


On 10/06/2009 10:18 AM, Gilles Moris wrote:
>   mercurial/cmdutil.py |  55 +++++++++++++++++++++++++++++--------------------------
>   1 files changed, 29 insertions(+), 26 deletions(-)
>
>
> # HG changeset patch
> # User Gilles Moris<gilles.moris at free.fr>
> # Date 1254816828 -7200
> # Node ID c900201dd7709e704caac923cab31f423816afcd
> # Parent  c777835db6a7b00fbcb255f9d467b331bd97b533
> latesttag: make latesttaginfo available as a global function

Please add a description of why you move it to a function.


But the root of the problem is that latesttaginfo not only is 
interesting for the templater. I think it would fit more natural as a 
method on the repo objects, but I don't know if such high-level 
functionality is welcome in the repo class?

> I had to make the latesttaginfo a global function, that I choose to make
> reentrant. May be it would be better to make latesttagcache a global
> variable. Please advise.

The cache _is_ a function of the repo graph, so I think it fits more 
natural on the repo objects. Also, AFAICS the algorithm will work with 
long-lived caches as long as revisions only are added and not stripped. 
I do however not know _how_ long-lived the repo objects are.

"Just say no to global variables". But caches might by design be an 
exception to that.

/Mads


More information about the Mercurial-devel mailing list