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