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