Patchwork [stable] status: pass matcher to pathcopies()

login
register
mail settings
Submitter Martin von Zweigbergk
Date April 20, 2015, 5:33 a.m.
Message ID <45945ffd9157e344a9d5.1429508014@martinvonz.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/8743/
State Accepted
Headers show

Comments

Martin von Zweigbergk - April 20, 2015, 5:33 a.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1429505033 25200
#      Sun Apr 19 21:43:53 2015 -0700
# Branch stable
# Node ID 45945ffd9157e344a9d5673b5f5e1578ce881921
# Parent  8d7d0bf62f9f84fef087c07eef505d5cd5b4c602
status: pass matcher to pathcopies()

Just like a7f8e3584ef3 (diff: pass the diff matcher to the copy logic,
2015-04-16) sped up 'hg diff --git $path', let's speed up 'hg st -C
$path'. On the Firefox repo, this speeds up

  hg st --rev tip~40000 --rev tip -C python

from 16s to 1.8s. Those two revisions differ in 100k files, out of
which 1k is in python/.
Matt Mackall - April 20, 2015, 4:41 p.m.
On Sun, 2015-04-19 at 22:33 -0700, Martin von Zweigbergk wrote:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz@google.com>
> # Date 1429505033 25200
> #      Sun Apr 19 21:43:53 2015 -0700
> # Branch stable
> # Node ID 45945ffd9157e344a9d5673b5f5e1578ce881921
> # Parent  8d7d0bf62f9f84fef087c07eef505d5cd5b4c602
> status: pass matcher to pathcopies()

Queued for stable, thanks. This sort of perf fix is borderline for
stable, but I'm allowing it because of its simplicity / efficacy ratio.

Patch

diff -r 8d7d0bf62f9f -r 45945ffd9157 mercurial/commands.py
--- a/mercurial/commands.py	Sat Apr 18 15:27:03 2015 +0900
+++ b/mercurial/commands.py	Sun Apr 19 21:43:53 2015 -0700
@@ -5837,14 +5837,15 @@ 
         else:
             show = states[:5]
 
-    stat = repo.status(node1, node2, scmutil.match(repo[node2], pats, opts),
+    m = scmutil.match(repo[node2], pats, opts)
+    stat = repo.status(node1, node2, m,
                        'ignored' in show, 'clean' in show, 'unknown' in show,
                        opts.get('subrepos'))
     changestates = zip(states, 'MAR!?IC', stat)
 
     if (opts.get('all') or opts.get('copies')
         or ui.configbool('ui', 'statuscopies')) and not opts.get('no_status'):
-        copy = copies.pathcopies(repo[node1], repo[node2])
+        copy = copies.pathcopies(repo[node1], repo[node2], m)
 
     fm = ui.formatter('status', opts)
     fmt = '%s' + end