gpg: do not call status on the whole repository, only on '.hgsigs' stable
authorBenoit Boissinot <benoit.boissinot@ens-lyon.org>
Sat, 20 Feb 2010 15:18:59 +0100
branchstable
changeset 10517 13448eab08ca
parent 10516 80a1161bc3b5
child 10518 5fe51d348daf
gpg: do not call status on the whole repository, only on '.hgsigs'
hgext/gpg.py
--- a/hgext/gpg.py	Fri Feb 19 22:16:42 2010 -0500
+++ b/hgext/gpg.py	Sat Feb 20 15:18:59 2010 +0100
@@ -6,7 +6,7 @@
 '''commands to sign and verify changesets'''
 
 import os, tempfile, binascii
-from mercurial import util, commands, match
+from mercurial import util, commands, match, cmdutil
 from mercurial import node as hgnode
 from mercurial.i18n import _
 
@@ -237,11 +237,12 @@
         repo.opener("localsigs", "ab").write(sigmessage)
         return
 
-    for x in repo.status(unknown=True)[:5]:
-        if ".hgsigs" in x and not opts["force"]:
-            raise util.Abort(_("working copy of .hgsigs is changed "
-                               "(please commit .hgsigs manually "
-                               "or use --force)"))
+    msigs = cmdutil.matchfiles(repo, ['.hgsigs'])
+    s = repo.status(match=msigs, unknown=True, ignored=True)[:6]
+    if util.any(s) and not opts["force"]:
+        raise util.Abort(_("working copy of .hgsigs is changed "
+                           "(please commit .hgsigs manually "
+                           "or use --force)"))
 
     repo.wfile(".hgsigs", "ab").write(sigmessage)
 
@@ -258,8 +259,7 @@
                              % hgnode.short(n)
                              for n in nodes])
     try:
-        m = match.exact(repo.root, '', ['.hgsigs'])
-        repo.commit(message, opts['user'], opts['date'], match=m)
+        repo.commit(message, opts['user'], opts['date'], match=msigs)
     except ValueError, inst:
         raise util.Abort(str(inst))