Patchwork [4,of,4] changeset_printer: hide manifest node for workingctx

login
register
mail settings
Submitter Yuya Nishihara
Date April 2, 2015, 1:35 p.m.
Message ID <750a1dab376894de36a9.1427981759@mimosa>
Download mbox | patch
Permalink /patch/8455/
State Accepted
Headers show

Comments

Yuya Nishihara - April 2, 2015, 1:35 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1426322002 -32400
#      Sat Mar 14 17:33:22 2015 +0900
# Node ID 750a1dab376894de36a913dc85e475d4f53a7f18
# Parent  6df350f6ea11b913d6d263b0af3250408efc2db3
changeset_printer: hide manifest node for workingctx

Because workingctx has no manifest, it makes sense to hide "manifest:" row
completely.
Matt Mackall - April 2, 2015, 8:39 p.m.
On Thu, 2015-04-02 at 22:35 +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1426322002 -32400
> #      Sat Mar 14 17:33:22 2015 +0900
> # Node ID 750a1dab376894de36a913dc85e475d4f53a7f18
> # Parent  6df350f6ea11b913d6d263b0af3250408efc2db3
> changeset_printer: hide manifest node for workingctx

These are queued for default, thanks. 

It's worth considering defining __cmp__ on ctxs. Obviously the semantics
of ctxa < ctxb are not a perfect match for a mere partial ordering.. but
we do have a partial ordering that we regularly use as a shortcut and we
should make it convenient.
Yuya Nishihara - April 3, 2015, 1:31 p.m.
On Thu, 02 Apr 2015 15:39:08 -0500, Matt Mackall wrote:
> It's worth considering defining __cmp__ on ctxs. Obviously the semantics
> of ctxa < ctxb are not a perfect match for a mere partial ordering.. but
> we do have a partial ordering that we regularly use as a shortcut and we
> should make it convenient.

Is your suggestion something like this?

  def __cmp__(self, other):
      return cmp(intrev(self), intrev(other))

or

  def __cmp__(self, other):
      if self == other:
          return 0
      elif other in self.ancestors():  # naive implementation
          return -1
      else:
          return 1

I agree it will be sometimes convenient, but I'm not sure how often we'll
do "ctxa < ctxb".

Regards,
Matt Mackall - April 3, 2015, 3:55 p.m.
On Fri, 2015-04-03 at 22:31 +0900, Yuya Nishihara wrote:
> On Thu, 02 Apr 2015 15:39:08 -0500, Matt Mackall wrote:
> > It's worth considering defining __cmp__ on ctxs. Obviously the semantics
> > of ctxa < ctxb are not a perfect match for a mere partial ordering.. but
> > we do have a partial ordering that we regularly use as a shortcut and we
> > should make it convenient.
> 
> Is your suggestion something like this?
> 
>   def __cmp__(self, other):
>       return cmp(intrev(self), intrev(other))

Like this.

> or
> 
>   def __cmp__(self, other):
>       if self == other:
>           return 0
>       elif other in self.ancestors():  # naive implementation
>           return -1
>       else:
>           return 1
> 
> I agree it will be sometimes convenient, but I'm not sure how often we'll
> do "ctxa < ctxb".

We already compare revs in a bunch of places.

Patch

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1151,7 +1151,7 @@  class changeset_printer(object):
                           % (pctx.rev(), hexfunc(pctx.node())),
                           label=label)
 
-        if self.ui.debugflag:
+        if self.ui.debugflag and rev is not None:
             mnode = ctx.manifestnode()
             # i18n: column positioning for "hg log"
             self.ui.write(_("manifest:    %d:%s\n") %
diff --git a/tests/test-log.t b/tests/test-log.t
--- a/tests/test-log.t
+++ b/tests/test-log.t
@@ -1633,6 +1633,15 @@  working-directory revision requires spec
   $ hg log -r 'wdir()' -q
   0:65624cd9070a+
 
+  $ hg log -r 'wdir()' --debug
+  changeset:   0:65624cd9070a035fa7191a54f2b8af39f16b0c08+
+  phase:       draft
+  parent:      0:65624cd9070a035fa7191a54f2b8af39f16b0c08
+  parent:      -1:0000000000000000000000000000000000000000
+  user:        test
+  date:        [A-Za-z0-9:+ ]+ (re)
+  extra:       branch=default
+  
 Check that adding an arbitrary name shows up in log automatically
 
   $ cat > ../names.py <<EOF