[PATCH 1 of 2] mq: use exact matching in the second dirstate walking for efficiency of 'qnew'

FUJIWARA Katsunori foozy at lares.dti.ne.jp
Thu Apr 5 10:10:45 CDT 2012


# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1333637526 -32400
# Node ID 00e3ac294a5833296cb83698b77ba326662d71ed
# Parent  1d8eab6dfe655e23d9884a6830a81e1757e50e33
mq: use exact matching in the second dirstate walking for efficiency of 'qnew'

'hg qnew' with pattern/-I/-X creates matching object with them, and
uses it twice for 'dirstate.walk()': via 'repo.status()' and
'repo.commit()'.

this may cause full manifest scan in the second 'dirstate.walk()',
even though mq already knows complete target filenames at the first
'dirstate.walk()'.

this patch creates exact matching object also in this case, and use it
at 'repo.commit()' invocation to avoid full manifest scan in the
second 'dirstate.walk()'.

even though 'inclsubs' is added to 'pats' for original matching
object, it is also passed to exact matching object, because
subrepositories are deleted from result of 'dirstate.walk()' at the
end of it.

diff -r 1d8eab6dfe65 -r 00e3ac294a58 hgext/mq.py
--- a/hgext/mq.py	Tue Apr 03 22:02:04 2012 +0200
+++ b/hgext/mq.py	Thu Apr 05 23:52:06 2012 +0900
@@ -962,7 +962,7 @@
             m, a, r, d = repo.status(match=match)[:4]
         else:
             m, a, r, d = self.checklocalchanges(repo, force=True)
-            match = scmutil.matchfiles(repo, m + a + r + inclsubs)
+        match = scmutil.matchfiles(repo, m + a + r + inclsubs)
         if len(repo[None].parents()) > 1:
             raise util.Abort(_('cannot manage merge changesets'))
         commitfiles = m + a + r


More information about the Mercurial-devel mailing list