How to write tags

Greg Ward greg-hg at gerg.ca
Tue Jan 5 12:02:00 CST 2010


On Thu, Dec 24, 2009 at 8:44 PM, Frank A. Kingswood
<frank at kingswood-consulting.co.uk> wrote:
> After the revision is committed I am holding its id and if there is a p4 tag
> (the "most reasonable" being "yes the tag appears on this revision"
> irrespective of whether it exists on other revisions as well) I want to add
> it to .hgtags. But the tag functions in localrepo modify the working state,
> and tags.py does not export anything useful.
>
> So at worst I'll be reimplementing all of the .hgtag manipulation in my
> extension, something I thought is not desirable. I can just assume the
> .hgtags format is fixed and append lines to it, it just does not seem very
> maintainable.

I know I'm a bit late on this, but I was on vacation.  IMHO tags.py is
a great place to put common tag-writing functionality.  I did not
bother when I factored out tags.py because it was not needed for the
task at hand (tag caching, which is mostly to do with reading tags).
But I think there's still a fair amount of code in localrepo.py that
could move to tags.py.  If such a refactoring is useful to perfarce
(great name!), then go for it!

Greg


More information about the Mercurial-devel mailing list