Mercurial > public > mercurial-scm > hg
comparison mercurial/changelog.py @ 27439:ed003859f1d8
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>
author | Laurent Charignon <lcharignon@fb.com> |
---|---|
date | Fri, 18 Dec 2015 13:45:55 -0800 |
parents | df41c7be16d6 |
children | d698c11bd189 |
comparison
equal
deleted
inserted
replaced
27438:f121cf57ca9a | 27439:ed003859f1d8 |
---|---|
358 extra = decodeextra(tdata[2]) | 358 extra = decodeextra(tdata[2]) |
359 | 359 |
360 files = l[3:] | 360 files = l[3:] |
361 return (manifest, user, (time, timezone), files, desc, extra) | 361 return (manifest, user, (time, timezone), files, desc, extra) |
362 | 362 |
363 def readfiles(self, node): | |
364 """ | |
365 short version of read that only returns the files modified by the cset | |
366 """ | |
367 text = self.revision(node) | |
368 if not text: | |
369 return [] | |
370 last = text.index("\n\n") | |
371 l = text[:last].split('\n') | |
372 return l[3:] | |
373 | |
363 def add(self, manifest, files, desc, transaction, p1, p2, | 374 def add(self, manifest, files, desc, transaction, p1, p2, |
364 user, date=None, extra=None): | 375 user, date=None, extra=None): |
365 # Convert to UTF-8 encoded bytestrings as the very first | 376 # Convert to UTF-8 encoded bytestrings as the very first |
366 # thing: calling any method on a localstr object will turn it | 377 # thing: calling any method on a localstr object will turn it |
367 # into a str object and the cached UTF-8 string is thus lost. | 378 # into a str object and the cached UTF-8 string is thus lost. |