[PATCH 3 of 4 V5] histedit: extracts _isdirtywc function

Augie Fackler raf at durin42.com
Tue Nov 17 14:30:09 CST 2015


On Thu, Nov 12, 2015 at 02:17:46PM +0100, liscju wrote:
> # HG changeset patch
> # User liscju <piotr.listkiewicz at gmail.com>
> # Date 1447328655 -3600
> #      Thu Nov 12 12:44:15 2015 +0100
> # Node ID 9815a15a8058b59eb86d9797d84857196b04c8e9
> # Parent  8b107a3648068503b154eef2bf9f08c4cd13a51b
> histedit: extracts _isdirtywc function

Queued this one, thanks!

>
> Checking if working copy is dirty was done in few places, this
> patch extracts it in _isdirtywc procedure.
>
> diff -r 8b107a364806 -r 9815a15a8058 hgext/histedit.py
> --- a/hgext/histedit.py	Thu Nov 12 13:38:18 2015 +0100
> +++ b/hgext/histedit.py	Thu Nov 12 12:44:15 2015 +0100
> @@ -502,6 +502,9 @@
>                           editor=editor)
>      return repo.commitctx(new)
>
> +def _isdirtywc(repo):
> +    return repo[None].dirty(missing=True)
> +
>  class pick(histeditaction):
>      def run(self):
>          rulectx = self.repo[self.node]
> @@ -971,12 +974,10 @@
>
>          actobj = actiontable[action].fromrule(state, currentnode)
>
> -        s = repo.status()
> -        if s.modified or s.added or s.removed or s.deleted:
> +        if _isdirtywc(repo):
>              actobj.continuedirty()
> -            s = repo.status()
> -            if s.modified or s.added or s.removed or s.deleted:
> -                raise error.Abort(_("working copy still dirty"))
> +            if _isdirtywc(repo):
> +                raise util.Abort(_("working copy still dirty"))
>
>          parentctx, replacements = actobj.continueclean()
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list