status to only show parent dir of many unknown files
Harvey Chapman
hchapman-hg at 3gfp.com
Fri Feb 20 18:15:57 UTC 2015
> On Feb 20, 2015, at 11:26 AM, Augie Fackler <lists at durin42.com> wrote:
>
> On Fri, Feb 20, 2015 at 8:32 AM, Harvey Chapman <hchapman-hg at 3gfp.com> wrote:
>>> https://bitbucket.org/mg/terse-status
>>
>> Ah, thank you! It seems broken at the moment with 3.3, but I’ll look and see if it’s something obvious.
>
>
> https://bitbucket.org/durin42/terse-status has the fix. Note that I'd
> like to talk to mpm this cycle and see if we can put this in hgext
> (with an eye towards it being part of FriendlyHG when I get around to
> that config knob.)
I ended up fixing it in a similar fashion. I put a little bit of logic to make it still work with 3.1+ (the original supported set of hg versions). I didn’t know whether to wrap buildstatus or dirstatestatus, though.
diff --git a/terse-status.py b/terse-status.py
--- a/terse-status.py
+++ b/terse-status.py
@@ -1,12 +1,13 @@
import os
-from mercurial import extensions, context
+from mercurial import extensions, context, scmutil
-def _poststatus(orig, self, other, s, match, listignored, listclean,
+def _buildstatus(orig, self, other, s, match, listignored, listclean,
listunknown):
+ s = orig(self, other, s, match, listignored, listclean,
+ listunknown)
if not listunknown:
- return orig(self, other, s, match, listignored, listclean,
- listunknown)
+ return s
unknown = s[4]
results = set()
@@ -30,11 +31,16 @@
else:
results.add(path)
+ try:
+ was_status = isinstance(s, scmutil.status)
+ except AttributeError:
+ was_status = False
+ s = list(s)
s[4] = list(results)
- return orig(self, other, s, match, listignored, listclean, listunknown)
+ return scmutil.status(*s) if was_status else s
def extsetup(ui):
if not ui.plain():
extensions.wrapfunction(context.workingctx,
- '_poststatus', _poststatus)
+ '_buildstatus', _buildstatus)
More information about the Mercurial
mailing list