##// END OF EJS Templates
changeset_printer: replace _meaningful_parentrevs() by changeset_templater's...
Yuya Nishihara -
r24484:ca62ae36 default
parent child Browse files
Show More
@@ -1115,9 +1115,6 class changeset_printer(object):
1115 else:
1115 else:
1116 hexfunc = short
1116 hexfunc = short
1117
1117
1118 parents = [self.repo[p]
1119 for p in self._meaningful_parentrevs(log, rev)]
1120
1121 # i18n: column positioning for "hg log"
1118 # i18n: column positioning for "hg log"
1122 self.ui.write(_("changeset: %d:%s\n") % (rev, hexfunc(changenode)),
1119 self.ui.write(_("changeset: %d:%s\n") % (rev, hexfunc(changenode)),
1123 label='log.changeset changeset.%s' % ctx.phasestr())
1120 label='log.changeset changeset.%s' % ctx.phasestr())
@@ -1145,7 +1142,7 class changeset_printer(object):
1145 # i18n: column positioning for "hg log"
1142 # i18n: column positioning for "hg log"
1146 self.ui.write(_("phase: %s\n") % _(ctx.phasestr()),
1143 self.ui.write(_("phase: %s\n") % _(ctx.phasestr()),
1147 label='log.phase')
1144 label='log.phase')
1148 for pctx in parents:
1145 for pctx in self._meaningful_parentrevs(ctx):
1149 label = 'log.parent changeset.%s' % pctx.phasestr()
1146 label = 'log.parent changeset.%s' % pctx.phasestr()
1150 # i18n: column positioning for "hg log"
1147 # i18n: column positioning for "hg log"
1151 self.ui.write(_("parent: %d:%s\n")
1148 self.ui.write(_("parent: %d:%s\n")
@@ -1229,19 +1226,20 class changeset_printer(object):
1229 match=matchfn, stat=False)
1226 match=matchfn, stat=False)
1230 self.ui.write("\n")
1227 self.ui.write("\n")
1231
1228
1232 def _meaningful_parentrevs(self, log, rev):
1229 def _meaningful_parentrevs(self, ctx):
1233 """Return list of meaningful (or all if debug) parentrevs for rev.
1230 """Return list of meaningful (or all if debug) parentrevs for rev.
1234
1231
1235 For merges (two non-nullrev revisions) both parents are meaningful.
1232 For merges (two non-nullrev revisions) both parents are meaningful.
1236 Otherwise the first parent revision is considered meaningful if it
1233 Otherwise the first parent revision is considered meaningful if it
1237 is not the preceding revision.
1234 is not the preceding revision.
1238 """
1235 """
1239 parents = log.parentrevs(rev)
1236 parents = ctx.parents()
1240 if not self.ui.debugflag and parents[1] == nullrev:
1237 if len(parents) > 1:
1241 if parents[0] >= rev - 1:
1238 return parents
1242 parents = []
1239 if self.ui.debugflag:
1243 else:
1240 return [parents[0], self.repo['null']]
1244 parents = [parents[0]]
1241 if parents[0].rev() >= ctx.rev() - 1:
1242 return []
1245 return parents
1243 return parents
1246
1244
1247 class jsonchangeset(changeset_printer):
1245 class jsonchangeset(changeset_printer):
@@ -1355,18 +1353,6 class changeset_templater(changeset_prin
1355
1353
1356 self.cache = {}
1354 self.cache = {}
1357
1355
1358 def _meaningful_parentrevs(self, ctx):
1359 """Return list of meaningful (or all if debug) parentrevs for rev.
1360 """
1361 parents = ctx.parents()
1362 if len(parents) > 1:
1363 return parents
1364 if self.ui.debugflag:
1365 return [parents[0], self.repo['null']]
1366 if parents[0].rev() >= ctx.rev() - 1:
1367 return []
1368 return parents
1369
1370 def _show(self, ctx, copies, matchfn, props):
1356 def _show(self, ctx, copies, matchfn, props):
1371 '''show a single changeset or file revision'''
1357 '''show a single changeset or file revision'''
1372
1358
General Comments 0
You need to be logged in to leave comments. Login now