workingctx status calls

Dirkjan Ochtman dirkjan at ochtman.nl
Sat Feb 20 08:09:34 CST 2010


On Sat, Feb 20, 2010 at 15:00, Benoit Boissinot <bboissin at gmail.com> wrote:
> diff --git a/hgext/gpg.py b/hgext/gpg.py
> --- a/hgext/gpg.py
> +++ b/hgext/gpg.py
> @@ -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)"))
> +    m = cmdutil.matchfiles(repo, '.hgsigs')
> +    s = repo.status(match=m, unknown=True, ignored=True)[:6]
> +    if sum(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)

Yeah, this looks much better.

Cheers,

Dirkjan


More information about the Mercurial-devel mailing list