[PATCH 3 of 3] log: Speed up hg log on untracked files (issue1340)
Matt Mackall
mpm at selenic.com
Thu Sep 13 15:31:14 CDT 2012
On Thu, 2012-09-13 at 10:41 -0700, S Muralidhar wrote:
> # HG changeset patch
> # User smuralid
> # Date 1347511152 25200
> # Node ID 46c4a5f7f808504706ecf584f470cfd5406dafbd
> # Parent 53e10b4a0769c55d7f475a2669d8fa9294352aae
> log: Speed up hg log on untracked files (issue1340)
^
ContributingChanges:
* first line of commit message is of the form "topic: uncapitalized, no
trailing period"
> 'hg log' on untracked files tends to be fairly slow. The root cause is
> that we end up using the 'slowpath' when we can't find a revlog for
> the files listed. This could happen if the file in question is an
> untracked file, or it is a directory.
This changes semantics. A performance patch should avoid changing
semantics.
Here's an implementation of what I suggested earlier, which leaves all
tests unchanged:
diff -r 17f1ef5cfaa5 mercurial/cmdutil.py
--- a/mercurial/cmdutil.py Wed Sep 12 21:30:51 2012 -0700
+++ b/mercurial/cmdutil.py Thu Sep 13 15:24:43 2012 -0500
@@ -1110,6 +1110,19 @@
wanted.add(rev)
if copied:
copies.append(copied)
+
+ # We decided to fall back to the slowpath because at least one
+ # path was not a file. Make sure at least one of the paths
+ # existed in history.
+ if slowpath:
+ for path in match.files():
+ if path == '.':
+ break
+ if path in repo.store:
+ break
+ else:
+ return []
+
if slowpath:
# We have to read the changelog to match filenames against
# changed files
..but there are still problems with non-fncache repos.
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial-devel
mailing list