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