##// END OF EJS Templates
py3: make chistedit render...
Martin von Zweigbergk -
r43685:d8215ff0 stable
parent child Browse files
Show More
@@ -217,6 +217,7 b' from mercurial import ('
217 copies,
217 copies,
218 destutil,
218 destutil,
219 discovery,
219 discovery,
220 encoding,
220 error,
221 error,
221 exchange,
222 exchange,
222 extensions,
223 extensions,
@@ -1117,7 +1118,7 b' class histeditrule(object):'
1117 self.pos = pos
1118 self.pos = pos
1118 self.conflicts = []
1119 self.conflicts = []
1119
1120
1120 def __str__(self):
1121 def __bytes__(self):
1121 # Some actions ('fold' and 'roll') combine a patch with a previous one.
1122 # Some actions ('fold' and 'roll') combine a patch with a previous one.
1122 # Add a marker showing which patch they apply to, and also omit the
1123 # Add a marker showing which patch they apply to, and also omit the
1123 # description for 'roll' (since it will get discarded). Example display:
1124 # description for 'roll' (since it will get discarded). Example display:
@@ -1135,10 +1136,16 b' class histeditrule(object):'
1135 desc = self.ctx.description().splitlines()[0].strip()
1136 desc = self.ctx.description().splitlines()[0].strip()
1136 if self.action == b'roll':
1137 if self.action == b'roll':
1137 desc = b''
1138 desc = b''
1138 return b"#{0:<2} {1:<6} {2}:{3} {4}".format(
1139 return b"#%s %s %d:%s %s" % (
1139 self.origpos, action, r, h, desc
1140 (b'%d' % self.origpos).ljust(2),
1141 action.ljust(6),
1142 r,
1143 h,
1144 desc,
1140 )
1145 )
1141
1146
1147 __str__ = encoding.strmethod(__bytes__)
1148
1142 def checkconflicts(self, other):
1149 def checkconflicts(self, other):
1143 if other.pos > self.pos and other.origpos <= self.origpos:
1150 if other.pos > self.pos and other.origpos <= self.origpos:
1144 if set(other.ctx.files()) & set(self.ctx.files()) != set():
1151 if set(other.ctx.files()) & set(self.ctx.files()) != set():
@@ -1324,7 +1331,7 b' def addln(win, y, x, line, color=None):'
1324 whitespace characters, so that the color appears on the whole line"""
1331 whitespace characters, so that the color appears on the whole line"""
1325 maxy, maxx = win.getmaxyx()
1332 maxy, maxx = win.getmaxyx()
1326 length = maxx - 1 - x
1333 length = maxx - 1 - x
1327 line = (b"{0:<%d}" % length).format(str(line).strip())[:length]
1334 line = bytes(line).ljust(length)[:length]
1328 if y < 0:
1335 if y < 0:
1329 y = maxy + y
1336 y = maxy + y
1330 if x < 0:
1337 if x < 0:
@@ -1395,17 +1402,17 b' def _chisteditmain(repo, rules, stdscr):'
1395 maxy, maxx = win.getmaxyx()
1402 maxy, maxx = win.getmaxyx()
1396 length = maxx - 3
1403 length = maxx - 3
1397
1404
1398 line = b"changeset: {0}:{1:<12}".format(ctx.rev(), ctx)
1405 line = b"changeset: %d:%s" % (ctx.rev(), ctx.hex())
1399 win.addstr(1, 1, line[:length])
1406 win.addstr(1, 1, line[:length])
1400
1407
1401 line = b"user: {0}".format(ctx.user())
1408 line = b"user: %s" % ctx.user()
1402 win.addstr(2, 1, line[:length])
1409 win.addstr(2, 1, line[:length])
1403
1410
1404 bms = repo.nodebookmarks(ctx.node())
1411 bms = repo.nodebookmarks(ctx.node())
1405 line = b"bookmark: {0}".format(b' '.join(bms))
1412 line = b"bookmark: %s" % b' '.join(bms)
1406 win.addstr(3, 1, line[:length])
1413 win.addstr(3, 1, line[:length])
1407
1414
1408 line = b"summary: {0}".format(ctx.description().splitlines()[0])
1415 line = b"summary: %s" % (ctx.description().splitlines()[0])
1409 win.addstr(4, 1, line[:length])
1416 win.addstr(4, 1, line[:length])
1410
1417
1411 line = b"files: "
1418 line = b"files: "
@@ -1426,7 +1433,7 b' def _chisteditmain(repo, rules, stdscr):'
1426 conflicts = rule.conflicts
1433 conflicts = rule.conflicts
1427 if len(conflicts) > 0:
1434 if len(conflicts) > 0:
1428 conflictstr = b','.join(map(lambda r: str(r.ctx), conflicts))
1435 conflictstr = b','.join(map(lambda r: str(r.ctx), conflicts))
1429 conflictstr = b"changed files overlap with {0}".format(conflictstr)
1436 conflictstr = b"changed files overlap with %s" % conflictstr
1430 else:
1437 else:
1431 conflictstr = b'no overlap'
1438 conflictstr = b'no overlap'
1432
1439
General Comments 0
You need to be logged in to leave comments. Login now