Show More
@@ -407,15 +407,20 b' class changeset_templater(object):' | |||||
407 | '''set template string to use''' |
|
407 | '''set template string to use''' | |
408 | self.t.cache['changeset'] = t |
|
408 | self.t.cache['changeset'] = t | |
409 |
|
409 | |||
410 | def write(self, thing): |
|
410 | def write(self, thing, header=False): | |
411 | '''write expanded template. |
|
411 | '''write expanded template. | |
412 | uses in-order recursive traverse of iterators.''' |
|
412 | uses in-order recursive traverse of iterators.''' | |
413 | for t in thing: |
|
413 | for t in thing: | |
414 | if hasattr(t, '__iter__'): |
|
414 | if hasattr(t, '__iter__'): | |
415 | self.write(t) |
|
415 | self.write(t, header=header) | |
|
416 | elif header: | |||
|
417 | self.ui.write_header(t) | |||
416 | else: |
|
418 | else: | |
417 | self.ui.write(t) |
|
419 | self.ui.write(t) | |
418 |
|
420 | |||
|
421 | def write_header(self, thing): | |||
|
422 | self.write(thing, header=True) | |||
|
423 | ||||
419 | def show(self, rev=0, changenode=None, brinfo=None): |
|
424 | def show(self, rev=0, changenode=None, brinfo=None): | |
420 | '''show a single changeset or file revision''' |
|
425 | '''show a single changeset or file revision''' | |
421 | log = self.repo.changelog |
|
426 | log = self.repo.changelog | |
@@ -549,6 +554,18 b' class changeset_templater(object):' | |||||
549 | } |
|
554 | } | |
550 |
|
555 | |||
551 | try: |
|
556 | try: | |
|
557 | if self.ui.debugflag and 'header_debug' in self.t: | |||
|
558 | key = 'header_debug' | |||
|
559 | elif self.ui.quiet and 'header_quiet' in self.t: | |||
|
560 | key = 'header_quiet' | |||
|
561 | elif self.ui.verbose and 'header_verbose' in self.t: | |||
|
562 | key = 'header_verbose' | |||
|
563 | elif 'header' in self.t: | |||
|
564 | key = 'header' | |||
|
565 | else: | |||
|
566 | key = '' | |||
|
567 | if key: | |||
|
568 | self.write_header(self.t(key, **props)) | |||
552 | if self.ui.debugflag and 'changeset_debug' in self.t: |
|
569 | if self.ui.debugflag and 'changeset_debug' in self.t: | |
553 | key = 'changeset_debug' |
|
570 | key = 'changeset_debug' | |
554 | elif self.ui.quiet and 'changeset_quiet' in self.t: |
|
571 | elif self.ui.quiet and 'changeset_quiet' in self.t: | |
@@ -1897,9 +1914,11 b' def log(ui, repo, *pats, **opts):' | |||||
1897 | def __init__(self, ui): |
|
1914 | def __init__(self, ui): | |
1898 | self.ui = ui |
|
1915 | self.ui = ui | |
1899 | self.hunk = {} |
|
1916 | self.hunk = {} | |
|
1917 | self.header = {} | |||
1900 | def bump(self, rev): |
|
1918 | def bump(self, rev): | |
1901 | self.rev = rev |
|
1919 | self.rev = rev | |
1902 | self.hunk[rev] = [] |
|
1920 | self.hunk[rev] = [] | |
|
1921 | self.header[rev] = [] | |||
1903 | def note(self, *args): |
|
1922 | def note(self, *args): | |
1904 | if self.verbose: |
|
1923 | if self.verbose: | |
1905 | self.write(*args) |
|
1924 | self.write(*args) | |
@@ -1908,6 +1927,8 b' def log(ui, repo, *pats, **opts):' | |||||
1908 | self.write(*args) |
|
1927 | self.write(*args) | |
1909 | def write(self, *args): |
|
1928 | def write(self, *args): | |
1910 | self.hunk[self.rev].append(args) |
|
1929 | self.hunk[self.rev].append(args) | |
|
1930 | def write_header(self, *args): | |||
|
1931 | self.header[self.rev].append(args) | |||
1911 | def debug(self, *args): |
|
1932 | def debug(self, *args): | |
1912 | if self.debugflag: |
|
1933 | if self.debugflag: | |
1913 | self.write(*args) |
|
1934 | self.write(*args) | |
@@ -1964,6 +1985,9 b' def log(ui, repo, *pats, **opts):' | |||||
1964 | du.write("\n\n") |
|
1985 | du.write("\n\n") | |
1965 | elif st == 'iter': |
|
1986 | elif st == 'iter': | |
1966 | if count == limit: break |
|
1987 | if count == limit: break | |
|
1988 | if du.header[rev]: | |||
|
1989 | for args in du.header[rev]: | |||
|
1990 | ui.write_header(*args) | |||
1967 | if du.hunk[rev]: |
|
1991 | if du.hunk[rev]: | |
1968 | count += 1 |
|
1992 | count += 1 | |
1969 | for args in du.hunk[rev]: |
|
1993 | for args in du.hunk[rev]: |
@@ -27,6 +27,8 b' class ui(object):' | |||||
27 |
|
27 | |||
28 | self.updateopts(verbose, debug, quiet, interactive) |
|
28 | self.updateopts(verbose, debug, quiet, interactive) | |
29 | self.diffcache = None |
|
29 | self.diffcache = None | |
|
30 | self.header = [] | |||
|
31 | self.prev_header = [] | |||
30 | else: |
|
32 | else: | |
31 | # parentui may point to an ui object which is already a child |
|
33 | # parentui may point to an ui object which is already a child | |
32 | self.parentui = parentui.parentui or parentui |
|
34 | self.parentui = parentui.parentui or parentui | |
@@ -184,9 +186,18 b' class ui(object):' | |||||
184 | return self.config("paths", loc, loc) |
|
186 | return self.config("paths", loc, loc) | |
185 |
|
187 | |||
186 | def write(self, *args): |
|
188 | def write(self, *args): | |
|
189 | if self.header: | |||
|
190 | if self.header != self.prev_header: | |||
|
191 | self.prev_header = self.header | |||
|
192 | self.write(*self.header) | |||
|
193 | self.header = [] | |||
187 | for a in args: |
|
194 | for a in args: | |
188 | sys.stdout.write(str(a)) |
|
195 | sys.stdout.write(str(a)) | |
189 |
|
196 | |||
|
197 | def write_header(self, *args): | |||
|
198 | for a in args: | |||
|
199 | self.header.append(str(a)) | |||
|
200 | ||||
190 | def write_err(self, *args): |
|
201 | def write_err(self, *args): | |
191 | try: |
|
202 | try: | |
192 | if not sys.stdout.closed: sys.stdout.flush() |
|
203 | if not sys.stdout.closed: sys.stdout.flush() |
@@ -1,5 +1,7 b'' | |||||
1 | changeset = '{date|shortdate} {author|person} <{author|email}> ({node|short}{tags})\n\n\t* {files|stringify|fill68|tabindent}{desc|fill68|tabindent|strip}\n\n' |
|
1 | header = '{date|shortdate} {author|person} <{author|email}>\n\n' | |
2 | changeset_quiet = '{date|shortdate} {author|person} <{author|email}>\n\n\t* {desc|firstline|fill68|tabindent|strip}\n\n' |
|
2 | header_verbose = '' | |
|
3 | changeset = '\t* {files|stringify|fill68|tabindent}{desc|fill68|tabindent|strip}\n\t[{node|short}]{tags}\n\n' | |||
|
4 | changeset_quiet = '\t* {desc|firstline|fill68|tabindent|strip}\n\n' | |||
3 | changeset_verbose = '{date|isodate} {author|person} <{author|email}> ({node|short}{tags})\n\n\t* {file_adds|stringify|fill68|tabindent}{file_dels|stringify|fill68|tabindent}{files|stringify|fill68|tabindent}{desc|fill68|tabindent|strip}\n\n' |
|
5 | changeset_verbose = '{date|isodate} {author|person} <{author|email}> ({node|short}{tags})\n\n\t* {file_adds|stringify|fill68|tabindent}{file_dels|stringify|fill68|tabindent}{files|stringify|fill68|tabindent}{desc|fill68|tabindent|strip}\n\n' | |
4 | start_tags = ' [' |
|
6 | start_tags = ' [' | |
5 | tag = '{tag}, ' |
|
7 | tag = '{tag}, ' |
General Comments 0
You need to be logged in to leave comments.
Login now