[PATCH 1 of 7] blackbox: log working directory version

Durham Goode durham at fb.com
Wed Feb 3 21:39:01 UTC 2016



On 2/1/16 8:14 PM, timeless wrote:
> # HG changeset patch
> # User timeless <timeless at mozdev.org>
> # Date 1454011674 0
> #      Thu Jan 28 20:07:54 2016 +0000
> # Node ID 13667e60c651f6db247234ec46fd040e002420fc
> # Parent  8e79ad2da8a69735488402fd018dd82bc1eb9309
> blackbox: log working directory version
>
> This includes a `+` for dirty repositories.
>
> diff --git a/hgext/blackbox.py b/hgext/blackbox.py
> --- a/hgext/blackbox.py
> +++ b/hgext/blackbox.py
> @@ -42,6 +42,13 @@
>   testedwith = 'internal'
>   lastblackbox = None
>   
> +def hexfn(ui, node):
> +    fm = ui.formatter('blackbox', {})
> +    if node is None:
> +        return None
> +    else:
> +        return fm.hexfunc(node)
> +
>   def wrapui(ui):
>       class blackboxui(ui.__class__):
>           @util.propertycache
> @@ -109,16 +116,26 @@
>                   user = util.getuser()
>                   pid = str(os.getpid())
>                   formattedmsg = msg[0] % msg[1:]
> +                rev = '(unknown)'
> +                changed = ''
> +                if util.safehasattr(self, '_bbopenerrepo'):
> +                    ctx = self._bbopenerrepo['.']
> +                    rev = hexfn(self, ctx.node())
> +                    if (any(self._bbopenerrepo.status())
> +                        or any(ctx.sub(s).dirty() for s in ctx.substate)):
> +                        changed = '+'
Does this mean every hg command will be running 'hg status' under the 
hood to populate the '+'?  And is it happening for every ui.log() as 
well, when the blackbox is enabled?

If that's the case, that would introduce some major perf issues I think.



More information about the Mercurial-devel mailing list