Re: Getting the revisions of .hgtags programatically
On Sun, Jan 24, 2021 at 10:59:30PM +, Roy Marples wrote: > 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. Well, the point of the question is that it is a not very well defined property. I mean just look at the rules to decide which value is visible for conflicting defitions. tags._updatetags is where the merge rules are defined. The relationship to the commit graph is ...interesting at best. So, no, I don't think "tagger" and "tag time" are properties I would naturally associate with a tag. Joerg ___ 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
On 1/24/21 11:16 PM, Roy Marples via Mercurial-devel 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. > For the record, we have a similar problem in Heptapod, which exposes to a machinery heavily tailored for Git, namely GitLab. It would make sense to consider the details (author, description) of the tagging changesets to be the equivalent of annotated Git tags. At the time I looked into it, I couldn't find any internal API to retrieve that information in an efficient way. But I didn't spend more than half an hour on this and went on to more pressing matters. Maybe would something like that counter-balance the heaviness of our global tags by giving it more applications? In any case, it's still low on my personal list of problems to tackle. For reference, here's our tracking issue for this: https://foss.heptapod.net/heptapod/hgitaly/-/issues/5 Best, -- Georges Racinet https://octobus.net, https://about.heptapod.host, https://heptapod.net GPG: BF5456F4DC625443849B6E58EE20CA44EF691D39, sur serveurs publics ___ 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
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
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? Joerg ___ 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
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
Hello Roy, isn't repo.tagslist() (and maybe filtering out local tags) already doing what you want? Joerg On Sat, Jan 23, 2021 at 01:56:52AM +, Roy Marples via Mercurial-devel wrote: > 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 ___ 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
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
Re: Getting the revisions of .hgtags programatically
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. 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. I hope this help. On 1/23/21 2:56 AM, Roy Marples via Mercurial-devel wrote: 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 -- Pierre-Yves David ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Getting the revisions of .hgtags programatically
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