[PATCH 1 of 2] changelog: add a new method to get files modified by a changeset

Laurent Charignon lcharignon at fb.com
Fri Dec 18 15:42:40 CST 2015


> On Dec 18, 2015, at 1:30 PM, Matt Mackall <mpm at selenic.com> wrote:
> 
> On Fri, 2015-12-18 at 12:55 -0800, Laurent Charignon wrote:
>> # HG changeset patch
>> # User Laurent Charignon <lcharignon at fb.com>
>> # Date 1450469125 28800
>> #      Fri Dec 18 12:05:25 2015 -0800
>> # Node ID 7f4515a7218a55d0cb6770dcc04f6bbccfdae8dc
>> # Parent  71aa5a26162d6e4a165b68f07b331e3e2eedc117
>> changelog: add a new method to get files modified by a changeset
>> 
>> This patch adds a new method "readfiles" to get the files modified by
>> a
>> changeset. It extracts some logic from "read" to only return the
>> files modified
>> by a changeset as efficiently as possible. This is used in the next
>> patch to
>> speed up hg log <file|folder>
>> 
>> diff --git a/mercurial/changelog.py b/mercurial/changelog.py
>> --- a/mercurial/changelog.py
>> +++ b/mercurial/changelog.py
>> @@ -360,6 +360,17 @@
>>          files = l[3:]
>>          return (manifest, user, (time, timezone), files, desc,
>> extra)
>>  
>> +    def readfiles(self, node):
>> +        """
>> +        short version of read that only returns the files modified
>> by the cset
>> +        """
>> +        text = self.revision(node)
>> +        if not text:
>> +            return (nullid, "", (0, 0), [], "", _defaultextra)
> 
> This probably wants to be the empty list, right?

Yes, sorry, my bad, I will send a V2.

> 
> -- 
> Mathematics is the supreme nostalgia of our time.



More information about the Mercurial-devel mailing list