[PATCH 3 of 4] log: add a marker for closed heads

Gilles Moris gilles.moris at free.fr
Thu May 13 09:32:02 CDT 2010


On Wednesday 12 May 2010 11:33:30 pm Gilles Moris wrote:
> On Wednesday 12 May 2010 05:56:23 pm Matt Mackall wrote:
> > Again, my plea to show us what it looks like up front.
> >
> > > changeset:   11:c84627f3c15d
> > > + (closed)
> > >  branch:      b
> > >  user:        test
> > >  date:        Thu Jan 01 00:00:09 1970 +0000
> >
> > Yuck!
> >
> > Folks, you have to be more imaginative. And by that, I mean you're
> > failing to imagine just how stupid and LAZY your fellow programmers and
> > admins have already been when coding up hacks IN SHELL SCRIPTS to parse
> > these things for their build systems after we've guaranteed they won't
> > change.
> >
> > We can't stick a new line in there. And we definitely can't stick in a
> > line without a colon! Nor can it go at the end of any existing
> > fixed-form lines. I frankly don't think we can fix this without a new
> > log option or sticking it under --debug.
> >
> > For now, please send me just the code that implements a new template
> > element (and not the modified templates).
>
> First thanks for queuing the other ones.
>
> OK, OK, not so nice, indeed. I was not expecting this one to go in anyway.
> I was just seeking some more feedback... Received.
> So this gave me another idea (also coming from the summary commit line
> implementation) I'd like to submit to see if there is any interest in the
> community. Instead of having a simple {closed} keyword, why not having a
> {changesettype} or equivalent that could return:
> - head closed
> - merge: have 2 parents
> - head: no children
> - branch head: no children on same branch. Not sure a distinction between
> head and branch head is needed.
> - root: no parent
> - branch root: no parent on same branch
> - branch merge: parents on a different branch
> Should it be multi-valued ? "merge, head"
> Or some should have precedence ? head closed > head > merge > ... > root
>
> This could be later an additional "type:" or whatever line, while I don't
> see {closed} having its own line.
>
> Feedback ?
>
> Regards.
> Gilles.

Complementary concept: hidden text for the HG core:
ui.write('some text', label='hidden')
does not print anything.

When overridden in the color.py extension, this additional output is printed. 
Alternatively, could be conditional to HGPLAIN.

Something like:

diff -r c6fe3727d0dd -r b1f14c4aa15d hgext/color.py
--- a/hgext/color.py    Mon May 10 09:56:06 2010 +0200
+++ b/hgext/color.py    Thu May 13 15:39:02 2010 +0200
@@ -159,9 +159,13 @@
         return ''.join(style(a, label) for a, label in _buffers.pop())
     return ''.join(a for a, label in _buffers.pop())

+def filtereffect(label):
+    return ' '.join([l for l in label.split() if l != 'hidden'])
+
 mode = 'ansi'
 def write(orig, *args, **opts):
-    label = opts.get('label', '')
+    label = filtereffect(opts.get('label', ''))
+    opts['label'] = label
     global _buffers
     if _buffers:
         _buffers[-1].extend([(str(a), label) for a in args])
@@ -172,7 +176,8 @@
         return orig(*[style(str(a), label) for a in args], **opts)

 def write_err(orig, *args, **opts):
-    label = opts.get('label', '')
+    label = filtereffect(opts.get('label', ''))
+    opts['label'] = label
     if mode == 'win32':
         for a in args:
             win32print(a, orig, **opts)
diff -r c6fe3727d0dd -r b1f14c4aa15d mercurial/ui.py
--- a/mercurial/ui.py   Mon May 10 09:56:06 2010 +0200
+++ b/mercurial/ui.py   Thu May 13 15:39:02 2010 +0200
@@ -340,6 +340,9 @@
         "cmdname.type" is recommended. For example, status issues
         a label of "status.modified" for modified files.
         '''
+        if 'hidden' in opts.get('label', '').split():
+            return
+
         if self._buffers:
             self._buffers[-1].extend([str(a) for a in args])
         else:





More information about the Mercurial-devel mailing list