Re: Getting the revisions of .hgtags programatically

2021-01-24 Thread Roy Marples via Mercurial-devel

On 24/01/2021 22:50, Joerg Sonnenberger wrote:

On Sun, Jan 24, 2021 at 10:16:46PM +, Roy Marples wrote:

Hi Joerg

On 24/01/2021 22:03, Joerg Sonnenberger wrote:

Hello Roy,
isn't repo.tagslist() (and maybe filtering out local tags) already doing
what you want?


It is sort of. I use it to get a list of tag and yes, I filter out non
globals already.
However, it only returns the revision tagged with the name, not which
revision created the tag.


Why do you care?


Because fast-import requires the author and date to create the equivalent tag.
This could be different from the author and date of the commit tagged and if any 
commit message is given for the tag, that would likely be different also.


Currently to get by, I create a light-weight tag instead, but this lacks any 
author or date information and unlike the fast-import tag command is not 
versioned in the repository like our global tags.


But more importantly, why do I care? Because the information that should be 
exportable is then lost and I have zero tolerance for lost data.


Roy
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: Getting the revisions of .hgtags programatically

2021-01-24 Thread Roy Marples via Mercurial-devel

Hi Joerg

On 24/01/2021 22:03, Joerg Sonnenberger wrote:

Hello Roy,
isn't repo.tagslist() (and maybe filtering out local tags) already doing
what you want?


It is sort of. I use it to get a list of tag and yes, I filter out non globals 
already.
However, it only returns the revision tagged with the name, not which revision 
created the tag.


Roy
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: Getting the revisions of .hgtags programatically

2021-01-24 Thread Roy Marples via Mercurial-devel

On 24/01/2021 20:08, Pierre-Yves David wrote:
Just a small note: Finding the revision introducing a tag is not that simpleā€¦ 
because:


1) they might be multiple of them
2) merge "introduce" tags without being their first appearance.

So you best bet is probably to walk history of the .hgtags revlogs (which might 
be what your are suggesting) and compare which tags are being newly introduced 
(actually, (name, node) pair).


That is probably the "best" you can hope for that.


Yes, that is what I was suggesting.
Is there some sample code to access .hgtags revlog directly, or is looking at 
the way annotate walks the tree with a matcher the best bet?


If you are a repository using some filtering (eg: evolution) it can become 
trickier since the `linkrev` pointer can point to filtered content, making it 
useless. In that case you need to walk the normal changelog revision (I would 
recommende walking up) and apply the same logic when the .hgtags files changed.


Wouldn't the filtering only be applied if you were on an active topic?

Thanks

Roy
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Getting the revisions of .hgtags programatically

2021-01-23 Thread Roy Marples via Mercurial-devel

Hi List

I'm working on added tag support to the fastexport extension.
I have little idea about the internals of mercurial so asking here for guidance.

My idea is to walk the revisions of .hgtags backwards until I find a changeset 
which added the tag name.

Once found I can export the user, date and message into the fastexport.

What is the best way of achieving this please?
I am currently looking at the annotate code as that gets what I want, but it's 
slow going working it all out and would appreciate somem guidance if possible.


Please include me directly in replies as I'm not subbed to this list.
Thanks

Roy
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel