diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -1119,32 +1119,42 @@ class histeditrule(object): self.conflicts = [] def __bytes__(self): - # Some actions ('fold' and 'roll') combine a patch with a previous one. - # Add a marker showing which patch they apply to, and also omit the - # description for 'roll' (since it will get discarded). Example display: + # Example display of several histeditrules: # # #10 pick 316392:06a16c25c053 add option to skip tests - # #11 ^roll 316393:71313c964cc5 + # #11 ^roll 316393:71313c964cc5 oops a fixup commit # #12 pick 316394:ab31f3973b0d include mfbt for mozilla-config.h # #13 ^fold 316395:14ce5803f4c3 fix warnings # # The carets point to the changeset being folded into ("roll this # changeset into the changeset above"). + return b'%s%s' % (self.prefix, self.desc) + + __str__ = encoding.strmethod(__bytes__) + + @property + def prefix(self): + # Some actions ('fold' and 'roll') combine a patch with a + # previous one. Add a marker showing which patch they apply + # to. action = ACTION_LABELS.get(self.action, self.action) + h = self.ctx.hex()[0:12] r = self.ctx.rev() - desc = self.ctx.description().splitlines()[0].strip() - if self.action == b'roll': - desc = b'' - return b"#%s %s %d:%s %s" % ( + + return b"#%s %s %d:%s " % ( (b'%d' % self.origpos).ljust(2), action.ljust(6), r, h, - desc, ) - __str__ = encoding.strmethod(__bytes__) + @property + def desc(self): + # This is split off from the prefix property so that we can + # separately make the description for 'roll' red (since it + # will get discarded). + return self.ctx.description().splitlines()[0].strip() def checkconflicts(self, other): if other.pos > self.pos and other.origpos <= self.origpos: