##// END OF EJS Templates
logcmdutil: unindent diff generator of changesetprinter...
Yuya Nishihara -
r36021:d4c210ee default
parent child Browse files
Show More
@@ -282,24 +282,25 b' class changesetprinter(object):'
282 282 def _showpatch(self, ctx):
283 283 matchfn = self._makefilematcher(ctx)
284 284 hunksfilterfn = self._makehunksfilter(ctx)
285 if matchfn:
286 stat = self.diffopts.get('stat')
287 diff = self.diffopts.get('patch')
288 diffopts = patch.diffallopts(self.ui, self.diffopts)
289 node = ctx.node()
290 prev = ctx.p1().node()
291 if stat:
292 diffordiffstat(self.ui, self.repo, diffopts, prev, node,
293 match=matchfn, stat=True,
294 hunksfilterfn=hunksfilterfn)
295 if diff:
296 if stat:
297 self.ui.write("\n")
298 diffordiffstat(self.ui, self.repo, diffopts, prev, node,
299 match=matchfn, stat=False,
300 hunksfilterfn=hunksfilterfn)
301 if stat or diff:
302 self.ui.write("\n")
285 if not matchfn:
286 return
287 stat = self.diffopts.get('stat')
288 diff = self.diffopts.get('patch')
289 diffopts = patch.diffallopts(self.ui, self.diffopts)
290 node = ctx.node()
291 prev = ctx.p1().node()
292 if stat:
293 diffordiffstat(self.ui, self.repo, diffopts, prev, node,
294 match=matchfn, stat=True,
295 hunksfilterfn=hunksfilterfn)
296 if stat and diff:
297 self.ui.write("\n")
298 if diff:
299 diffordiffstat(self.ui, self.repo, diffopts, prev, node,
300 match=matchfn, stat=False,
301 hunksfilterfn=hunksfilterfn)
302 if stat or diff:
303 self.ui.write("\n")
303 304
304 305 class jsonchangeset(changesetprinter):
305 306 '''format changeset information.'''
@@ -383,22 +384,21 b' class jsonchangeset(changesetprinter):'
383 384 for k, v in copies))
384 385
385 386 matchfn = self._makefilematcher(ctx)
386 if matchfn:
387 stat = self.diffopts.get('stat')
388 diff = self.diffopts.get('patch')
389 diffopts = patch.difffeatureopts(self.ui, self.diffopts, git=True)
390 node, prev = ctx.node(), ctx.p1().node()
391 if stat:
392 self.ui.pushbuffer()
393 diffordiffstat(self.ui, self.repo, diffopts, prev, node,
394 match=matchfn, stat=True)
395 self.ui.write((',\n "diffstat": "%s"')
396 % j(self.ui.popbuffer()))
397 if diff:
398 self.ui.pushbuffer()
399 diffordiffstat(self.ui, self.repo, diffopts, prev, node,
400 match=matchfn, stat=False)
401 self.ui.write((',\n "diff": "%s"') % j(self.ui.popbuffer()))
387 stat = self.diffopts.get('stat')
388 diff = self.diffopts.get('patch')
389 diffopts = patch.difffeatureopts(self.ui, self.diffopts, git=True)
390 node, prev = ctx.node(), ctx.p1().node()
391 if matchfn and stat:
392 self.ui.pushbuffer()
393 diffordiffstat(self.ui, self.repo, diffopts, prev, node,
394 match=matchfn, stat=True)
395 self.ui.write((',\n "diffstat": "%s"')
396 % j(self.ui.popbuffer()))
397 if matchfn and diff:
398 self.ui.pushbuffer()
399 diffordiffstat(self.ui, self.repo, diffopts, prev, node,
400 match=matchfn, stat=False)
401 self.ui.write((',\n "diff": "%s"') % j(self.ui.popbuffer()))
402 402
403 403 self.ui.write("\n }")
404 404
General Comments 0
You need to be logged in to leave comments. Login now