comparison mercurial/cmdutil.py @ 25763:60c791592aa7

changeset_printer: change flush() to accept ctx instead of rev Because flush() is the function to write data buffered by show(ctx), flush(ctx) is more consistent than flush(rev). This makes sure that buffered header and hunk are always keyed by ctx.rev(). This patch will allow us to give an integer to the wdir while keeping wctx.rev() -> None.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 12 Apr 2015 21:52:02 +0900
parents f4412380d357
children 69145daacdfa
comparison
equal deleted inserted replaced
25762:f4412380d357 25763:60c791592aa7
1117 self.header = {} 1117 self.header = {}
1118 self.hunk = {} 1118 self.hunk = {}
1119 self.lastheader = None 1119 self.lastheader = None
1120 self.footer = None 1120 self.footer = None
1121 1121
1122 def flush(self, rev): 1122 def flush(self, ctx):
1123 rev = ctx.rev()
1123 if rev in self.header: 1124 if rev in self.header:
1124 h = self.header[rev] 1125 h = self.header[rev]
1125 if h != self.lastheader: 1126 if h != self.lastheader:
1126 self.lastheader = h 1127 self.lastheader = h
1127 self.ui.write(h) 1128 self.ui.write(h)
2154 revmatchfn = filematcher(ctx.rev()) 2155 revmatchfn = filematcher(ctx.rev())
2155 displayer.show(ctx, copies=copies, matchfn=revmatchfn) 2156 displayer.show(ctx, copies=copies, matchfn=revmatchfn)
2156 lines = displayer.hunk.pop(rev).split('\n') 2157 lines = displayer.hunk.pop(rev).split('\n')
2157 if not lines[-1]: 2158 if not lines[-1]:
2158 del lines[-1] 2159 del lines[-1]
2159 displayer.flush(rev) 2160 displayer.flush(ctx)
2160 edges = edgefn(type, char, lines, seen, rev, parents) 2161 edges = edgefn(type, char, lines, seen, rev, parents)
2161 for type, char, lines, coldata in edges: 2162 for type, char, lines, coldata in edges:
2162 graphmod.ascii(ui, state, type, char, lines, coldata) 2163 graphmod.ascii(ui, state, type, char, lines, coldata)
2163 displayer.close() 2164 displayer.close()
2164 2165