##// END OF EJS Templates
histedit: use new function for getting first line of a string...
Martin von Zweigbergk -
r49886:e160f073 default
parent child Browse files
Show More
@@ -552,9 +552,7 b' class histeditaction:'
552 summary = cmdutil.rendertemplate(
552 summary = cmdutil.rendertemplate(
553 ctx, ui.config(b'histedit', b'summary-template')
553 ctx, ui.config(b'histedit', b'summary-template')
554 )
554 )
555 # Handle the fact that `''.splitlines() => []`
555 line = b'%s %s %s' % (self.verb, ctx, stringutil.firstline(summary))
556 summary = summary.splitlines()[0] if summary else b''
557 line = b'%s %s %s' % (self.verb, ctx, summary)
558 # trim to 75 columns by default so it's not stupidly wide in my editor
556 # trim to 75 columns by default so it's not stupidly wide in my editor
559 # (the 5 more are left for verb)
557 # (the 5 more are left for verb)
560 maxlen = self.repo.ui.configint(b'histedit', b'linelen')
558 maxlen = self.repo.ui.configint(b'histedit', b'linelen')
@@ -1192,7 +1190,7 b' class histeditrule:'
1192 # This is split off from the prefix property so that we can
1190 # This is split off from the prefix property so that we can
1193 # separately make the description for 'roll' red (since it
1191 # separately make the description for 'roll' red (since it
1194 # will get discarded).
1192 # will get discarded).
1195 return self.ctx.description().splitlines()[0].strip()
1193 return stringutil.firstline(self.ctx.description())
1196
1194
1197 def checkconflicts(self, other):
1195 def checkconflicts(self, other):
1198 if other.pos > self.pos and other.origpos <= self.origpos:
1196 if other.pos > self.pos and other.origpos <= self.origpos:
@@ -1291,7 +1289,7 b' class _chistedit_state:'
1291 line = b"bookmark: %s" % b' '.join(bms)
1289 line = b"bookmark: %s" % b' '.join(bms)
1292 win.addstr(3, 1, line[:length])
1290 win.addstr(3, 1, line[:length])
1293
1291
1294 line = b"summary: %s" % (ctx.description().splitlines()[0])
1292 line = b"summary: %s" % stringutil.firstline(ctx.description())
1295 win.addstr(4, 1, line[:length])
1293 win.addstr(4, 1, line[:length])
1296
1294
1297 line = b"files: "
1295 line = b"files: "
@@ -2324,9 +2322,7 b' def _getsummary(ctx):'
2324 # a common pattern is to extract the summary but default to the empty
2322 # a common pattern is to extract the summary but default to the empty
2325 # string
2323 # string
2326 summary = ctx.description() or b''
2324 summary = ctx.description() or b''
2327 if summary:
2325 return stringutil.firstline(summary)
2328 summary = summary.splitlines()[0]
2329 return summary
2330
2326
2331
2327
2332 def bootstrapcontinue(ui, state, opts):
2328 def bootstrapcontinue(ui, state, opts):
General Comments 0
You need to be logged in to leave comments. Login now