##// END OF EJS Templates
histeditrule: split __bytes__ property into prefix and desc...
Jordi Gutiérrez Hermoso -
r44061:4323a32c default
parent child Browse files
Show More
@@ -1119,32 +1119,42 b' class histeditrule(object):'
1119 self.conflicts = []
1119 self.conflicts = []
1120
1120
1121 def __bytes__(self):
1121 def __bytes__(self):
1122 # Some actions ('fold' and 'roll') combine a patch with a previous one.
1122 # Example display of several histeditrules:
1123 # Add a marker showing which patch they apply to, and also omit the
1124 # description for 'roll' (since it will get discarded). Example display:
1125 #
1123 #
1126 # #10 pick 316392:06a16c25c053 add option to skip tests
1124 # #10 pick 316392:06a16c25c053 add option to skip tests
1127 # #11 ^roll 316393:71313c964cc5
1125 # #11 ^roll 316393:71313c964cc5 <RED>oops a fixup commit</RED>
1128 # #12 pick 316394:ab31f3973b0d include mfbt for mozilla-config.h
1126 # #12 pick 316394:ab31f3973b0d include mfbt for mozilla-config.h
1129 # #13 ^fold 316395:14ce5803f4c3 fix warnings
1127 # #13 ^fold 316395:14ce5803f4c3 fix warnings
1130 #
1128 #
1131 # The carets point to the changeset being folded into ("roll this
1129 # The carets point to the changeset being folded into ("roll this
1132 # changeset into the changeset above").
1130 # changeset into the changeset above").
1131 return b'%s%s' % (self.prefix, self.desc)
1132
1133 __str__ = encoding.strmethod(__bytes__)
1134
1135 @property
1136 def prefix(self):
1137 # Some actions ('fold' and 'roll') combine a patch with a
1138 # previous one. Add a marker showing which patch they apply
1139 # to.
1133 action = ACTION_LABELS.get(self.action, self.action)
1140 action = ACTION_LABELS.get(self.action, self.action)
1141
1134 h = self.ctx.hex()[0:12]
1142 h = self.ctx.hex()[0:12]
1135 r = self.ctx.rev()
1143 r = self.ctx.rev()
1136 desc = self.ctx.description().splitlines()[0].strip()
1144
1137 if self.action == b'roll':
1145 return b"#%s %s %d:%s " % (
1138 desc = b''
1139 return b"#%s %s %d:%s %s" % (
1140 (b'%d' % self.origpos).ljust(2),
1146 (b'%d' % self.origpos).ljust(2),
1141 action.ljust(6),
1147 action.ljust(6),
1142 r,
1148 r,
1143 h,
1149 h,
1144 desc,
1145 )
1150 )
1146
1151
1147 __str__ = encoding.strmethod(__bytes__)
1152 @property
1153 def desc(self):
1154 # This is split off from the prefix property so that we can
1155 # separately make the description for 'roll' red (since it
1156 # will get discarded).
1157 return self.ctx.description().splitlines()[0].strip()
1148
1158
1149 def checkconflicts(self, other):
1159 def checkconflicts(self, other):
1150 if other.pos > self.pos and other.origpos <= self.origpos:
1160 if other.pos > self.pos and other.origpos <= self.origpos:
General Comments 0
You need to be logged in to leave comments. Login now