Enriching a file log by branches, tags and bookmarks

Marc Strapetz marc.strapetz at syntevo.com
Thu Apr 2 14:54:08 UTC 2015


Dave, sorry, I completely missed your reply.

> Are you trying to track the history of individual files, rather than the
> default of repository history?

Yes, I do.

 > hg log -f --template "{rev} {tags} {branch} {files}\n"
 > controllers/default.py

Unfortunately this does not give me the desired information. I've tried 
with setup.py from Mercurial's own repository. Here are the first lines 
of output, which do not show up any tags at all:

17926  default setup.py
17732  default .hgignore mercurial/exewrapper.c setup.py
17709  default setup.py
17606  default mercurial/parsers.c mercurial/pathencode.c setup.py
17246  stable setup.py
17121  default setup.py

And here is what I'm looking for:

http://i.imgur.com/AYt885I.png

Any more ideas?

-Marc



On 23.02.2015 19:40, Dave S wrote:
> Are you trying to track the history of individual files, rather than the
> default of repository history?
>
> You want to use templates, but I don't see a template option that gives
> just the name of the file you asked about on the command line.
>
> hg log -f --template "{rev} {tags} {branch} {files}\n"
> controllers/default.py
>
> is close, but gives you all the files changed in the applicable
> revisions.  If you drop the {files}, you don't get a file name at all
> (but you already know the filename, since you put it on the command line).
>
> An alternative would be to use the XML style:
>
> hg log -f --style xml controllers/default.py
>
>
> This doesn't seem to show the filename, either, but again you specified
> the file so you know the file.
>
> Take a look at templates in the hg help system.
>
> /dps
>
>
> On Mon, Feb 16, 2015 at 5:03 AM, Marc Strapetz
> <marc.strapetz at syntevo.com <mailto:marc.strapetz at syntevo.com>> wrote:
>
>     I'm looking for a way to enrich a file log (or sub-tree log) by
>     branches, tags and bookmarks: every such "tag" should be displayed
>     at the "closest" commit of the file log, i.e. at that commit which
>     contains the file in identical state (content). Example:
>
>     A* - B - C* - D [tag] - E*
>            \
>             F - G - H* [branch]
>
>     Let's consider the file has been changed in *-commits only, namely
>     A, C, E and H, then "branch" should be assigned to H and "tag"
>     should be assigned to C, resulting in following file log:
>
>     A - C [tag] - E
>       \
>        H [branch]
>
>     Note, that I'm not interesting in how the information is displayed,
>     any output which is reasonably parseable is fine.
>
>     As far as I understand, there is currently no such command line
>     functionality in Mercurial?
>
>     If so, is there any (high-level) API which could be used to write an
>     extension which performs this task?
>
>     If not, any ideas/suggestions how to address this problem with
>     reasonable performance? Running through the entire repository log
>     and manually shifting "tags" to those commits which are present in
>     the file/sub-tree log is my last option.
>
>     -Marc
>
>
>
>
>     _________________________________________________
>     Mercurial mailing list
>     Mercurial at selenic.com <mailto:Mercurial at selenic.com>
>     http://selenic.com/mailman/__listinfo/mercurial
>     <http://selenic.com/mailman/listinfo/mercurial>
>
>
>
>
> --
> test signature -- please apply at front gate on Tuesdays only.


More information about the Mercurial mailing list