Show More
@@ -48,13 +48,13 b' stringio = util.stringio' | |||
|
48 | 48 | |
|
49 | 49 | loglimit = logcmdutil.loglimit |
|
50 | 50 | diffordiffstat = logcmdutil.diffordiffstat |
|
51 |
_changesetlabels = logcmdutil. |
|
|
52 |
changeset_printer = logcmdutil.changeset |
|
|
51 | _changesetlabels = logcmdutil.changesetlabels | |
|
52 | changeset_printer = logcmdutil.changesetprinter | |
|
53 | 53 | jsonchangeset = logcmdutil.jsonchangeset |
|
54 |
changeset_templater = logcmdutil.changeset |
|
|
54 | changeset_templater = logcmdutil.changesettemplater | |
|
55 | 55 | logtemplatespec = logcmdutil.logtemplatespec |
|
56 | 56 | makelogtemplater = logcmdutil.makelogtemplater |
|
57 |
show_changeset = logcmdutil. |
|
|
57 | show_changeset = logcmdutil.changesetdisplayer | |
|
58 | 58 | getlogrevs = logcmdutil.getlogrevs |
|
59 | 59 | getloglinerangerevs = logcmdutil.getloglinerangerevs |
|
60 | 60 | displaygraph = logcmdutil.displaygraph |
@@ -109,7 +109,7 b' def diffordiffstat(ui, repo, diffopts, n' | |||
|
109 | 109 | sub.diff(ui, diffopts, tempnode2, submatch, changes=changes, |
|
110 | 110 | stat=stat, fp=fp, prefix=prefix) |
|
111 | 111 | |
|
112 |
def |
|
|
112 | def changesetlabels(ctx): | |
|
113 | 113 | labels = ['log.changeset', 'changeset.%s' % ctx.phasestr()] |
|
114 | 114 | if ctx.obsolete(): |
|
115 | 115 | labels.append('changeset.obsolete') |
@@ -119,7 +119,7 b' def _changesetlabels(ctx):' | |||
|
119 | 119 | labels.append('instability.%s' % instability) |
|
120 | 120 | return ' '.join(labels) |
|
121 | 121 | |
|
122 |
class changeset |
|
|
122 | class changesetprinter(object): | |
|
123 | 123 | '''show changeset information when templating not requested.''' |
|
124 | 124 | |
|
125 | 125 | def __init__(self, ui, repo, matchfn, diffopts, buffered): |
@@ -172,7 +172,7 b' class changeset_printer(object):' | |||
|
172 | 172 | |
|
173 | 173 | columns = self._columns |
|
174 | 174 | self.ui.write(columns['changeset'] % scmutil.formatchangeid(ctx), |
|
175 |
label= |
|
|
175 | label=changesetlabels(ctx)) | |
|
176 | 176 | |
|
177 | 177 | # branches are shown first before any other names due to backwards |
|
178 | 178 | # compatibility |
@@ -287,11 +287,11 b' class changeset_printer(object):' | |||
|
287 | 287 | if stat or diff: |
|
288 | 288 | self.ui.write("\n") |
|
289 | 289 | |
|
290 |
class jsonchangeset(changeset |
|
|
290 | class jsonchangeset(changesetprinter): | |
|
291 | 291 | '''format changeset information.''' |
|
292 | 292 | |
|
293 | 293 | def __init__(self, ui, repo, matchfn, diffopts, buffered): |
|
294 |
changeset |
|
|
294 | changesetprinter.__init__(self, ui, repo, matchfn, diffopts, buffered) | |
|
295 | 295 | self.cache = {} |
|
296 | 296 | self._first = True |
|
297 | 297 | |
@@ -386,12 +386,12 b' class jsonchangeset(changeset_printer):' | |||
|
386 | 386 | |
|
387 | 387 | self.ui.write("\n }") |
|
388 | 388 | |
|
389 |
class changeset |
|
|
389 | class changesettemplater(changesetprinter): | |
|
390 | 390 | '''format changeset information. |
|
391 | 391 | |
|
392 | 392 | Note: there are a variety of convenience functions to build a |
|
393 |
changeset |
|
|
394 |
makelogtemplater, |
|
|
393 | changesettemplater for common cases. See functions such as: | |
|
394 | makelogtemplater, changesetdisplayer, buildcommittemplate, or other | |
|
395 | 395 | functions that use changesest_templater. |
|
396 | 396 | ''' |
|
397 | 397 | |
@@ -401,7 +401,7 b' class changeset_templater(changeset_prin' | |||
|
401 | 401 | buffered=False): |
|
402 | 402 | diffopts = diffopts or {} |
|
403 | 403 | |
|
404 |
changeset |
|
|
404 | changesetprinter.__init__(self, ui, repo, matchfn, diffopts, buffered) | |
|
405 | 405 | tres = formatter.templateresources(ui, repo) |
|
406 | 406 | self.t = formatter.loadtemplater(ui, tmplspec, |
|
407 | 407 | defaults=templatekw.keywords, |
@@ -442,7 +442,7 b' class changeset_templater(changeset_prin' | |||
|
442 | 442 | if not self.footer: |
|
443 | 443 | self.footer = "" |
|
444 | 444 | self.footer += templater.stringify(self.t(self._parts['docfooter'])) |
|
445 |
return super(changeset |
|
|
445 | return super(changesettemplater, self).close() | |
|
446 | 446 | |
|
447 | 447 | def _show(self, ctx, copies, matchfn, hunksfilterfn, props): |
|
448 | 448 | '''show a single changeset or file revision''' |
@@ -513,12 +513,12 b' def _lookuplogtemplate(ui, tmpl, style):' | |||
|
513 | 513 | return formatter.lookuptemplate(ui, 'changeset', tmpl) |
|
514 | 514 | |
|
515 | 515 | def makelogtemplater(ui, repo, tmpl, buffered=False): |
|
516 |
"""Create a changeset |
|
|
516 | """Create a changesettemplater from a literal template 'tmpl' | |
|
517 | 517 | byte-string.""" |
|
518 | 518 | spec = logtemplatespec(tmpl, None) |
|
519 |
return changeset |
|
|
519 | return changesettemplater(ui, repo, spec, buffered=buffered) | |
|
520 | 520 | |
|
521 |
def |
|
|
521 | def changesetdisplayer(ui, repo, opts, buffered=False): | |
|
522 | 522 | """show one changeset using template or regular display. |
|
523 | 523 | |
|
524 | 524 | Display format will be the first non-empty hit of: |
@@ -527,7 +527,7 b' def show_changeset(ui, repo, opts, buffe' | |||
|
527 | 527 | 3. [ui] setting 'logtemplate' |
|
528 | 528 | 4. [ui] setting 'style' |
|
529 | 529 | If all of these values are either the unset or the empty string, |
|
530 |
regular display via changeset |
|
|
530 | regular display via changesetprinter() is done. | |
|
531 | 531 | """ |
|
532 | 532 | # options |
|
533 | 533 | match = None |
@@ -540,9 +540,9 b' def show_changeset(ui, repo, opts, buffe' | |||
|
540 | 540 | spec = _lookuplogtemplate(ui, opts.get('template'), opts.get('style')) |
|
541 | 541 | |
|
542 | 542 | if not spec.ref and not spec.tmpl and not spec.mapfile: |
|
543 |
return changeset |
|
|
543 | return changesetprinter(ui, repo, match, opts, buffered) | |
|
544 | 544 | |
|
545 |
return changeset |
|
|
545 | return changesettemplater(ui, repo, spec, match, opts, buffered) | |
|
546 | 546 | |
|
547 | 547 | def _makelogmatcher(repo, revs, pats, opts): |
|
548 | 548 | """Build matcher and expanded patterns from log options |
@@ -841,7 +841,7 b' def _graphnodeformatter(ui, displayer):' | |||
|
841 | 841 | |
|
842 | 842 | spec = templater.unquotestring(spec) |
|
843 | 843 | tres = formatter.templateresources(ui) |
|
844 |
if isinstance(displayer, changeset |
|
|
844 | if isinstance(displayer, changesettemplater): | |
|
845 | 845 | tres['cache'] = displayer.cache # reuse cache of slow templates |
|
846 | 846 | templ = formatter.maketemplater(ui, spec, defaults=templatekw.keywords, |
|
847 | 847 | resources=tres) |
@@ -915,7 +915,7 b' def graphlog(ui, repo, revs, filematcher' | |||
|
915 | 915 | getrenamed = templatekw.getrenamedfn(repo, endrev=endrev) |
|
916 | 916 | |
|
917 | 917 | ui.pager('log') |
|
918 |
displayer = |
|
|
918 | displayer = changesetdisplayer(ui, repo, opts, buffered=True) | |
|
919 | 919 | displaygraph(ui, repo, revdag, displayer, graphmod.asciiedges, getrenamed, |
|
920 | 920 | filematcher) |
|
921 | 921 |
General Comments 0
You need to be logged in to leave comments.
Login now