Determining what files were touched in a changeset algorithmically
Wagner Bruna
wagner.bruna+mercurial at gmail.com
Wed Jun 22 19:29:16 CDT 2011
On 06/22/2011 08:51 PM, paul_nathan at selinc.com wrote:
> Greetings,
>
> I am working on some analysis tools for hg logs.
>
> hg log --template "{files}" is the naive way to do this.
>
> Demonstration of problem:
>
> $ hg log -r 34 --template "{file_mods}\n"
> baz baz baz foo bar spacey.txt
>
> What files were modified?
>
> In order to determine this, I have to run manifest on 34 and perform
> some lexical analysis for all files in that changeset to determine which
> files actually got modified.
>
> Reviewing the hg source code, the rendering code (showlist function in
> http://selenic.com/hg/file/8deebb577751/mercurial/templatekw.py)
> performs a join with spaces here. This is... problematic for fast
> algorithmic determination.
Perhaps you could call "hg status --change 34" instead?
> I have thousands of changesets that need to be processed repeatedly and
> shelling out on each changeset is going to be slow.
>
> Is there a better way? I'd like to only shell out to hg once and get all
> the needed information.
Although it's somewhat in early stages of development, you may wish to take a
look at the command server that'll be released with Mercurial 1.9; look for
the --cmdserver serve option, and see
http://mercurial.selenic.com/wiki/CommandServer
Regards,
Wagner
> (the file names were "baz baz baz" and "foo bar spacey.txt")
>
> - - -
> Regards,
> Paul Nathan
More information about the Mercurial
mailing list