mercurial/logcmdutil.py
changeset 37838 3fe1c9263024
parent 37837 e0f30c91dfd8
child 38167 ec37df9042f9
equal deleted inserted replaced
37837:e0f30c91dfd8 37838:3fe1c9263024
   153         self.ui = ui
   153         self.ui = ui
   154         self.repo = repo
   154         self.repo = repo
   155         self.buffered = buffered
   155         self.buffered = buffered
   156         self._differ = differ or changesetdiffer()
   156         self._differ = differ or changesetdiffer()
   157         self._diffopts = patch.diffallopts(ui, diffopts)
   157         self._diffopts = patch.diffallopts(ui, diffopts)
   158         self.diffopts = diffopts or {}
   158         self._includestat = diffopts and diffopts.get('stat')
       
   159         self._includediff = diffopts and diffopts.get('patch')
   159         self.header = {}
   160         self.header = {}
   160         self.hunk = {}
   161         self.hunk = {}
   161         self.lastheader = None
   162         self.lastheader = None
   162         self.footer = None
   163         self.footer = None
   163         self._columns = templatekw.getlogcolumns()
   164         self._columns = templatekw.getlogcolumns()
   297     def _exthook(self, ctx):
   298     def _exthook(self, ctx):
   298         '''empty method used by extension as a hook point
   299         '''empty method used by extension as a hook point
   299         '''
   300         '''
   300 
   301 
   301     def _showpatch(self, ctx):
   302     def _showpatch(self, ctx):
   302         stat = self.diffopts.get('stat')
   303         if self._includestat:
   303         diff = self.diffopts.get('patch')
       
   304         if stat:
       
   305             self._differ.showdiff(self.ui, ctx, self._diffopts, stat=True)
   304             self._differ.showdiff(self.ui, ctx, self._diffopts, stat=True)
   306         if stat and diff:
   305         if self._includestat and self._includediff:
   307             self.ui.write("\n")
   306             self.ui.write("\n")
   308         if diff:
   307         if self._includediff:
   309             self._differ.showdiff(self.ui, ctx, self._diffopts, stat=False)
   308             self._differ.showdiff(self.ui, ctx, self._diffopts, stat=False)
   310         if stat or diff:
   309         if self._includestat or self._includediff:
   311             self.ui.write("\n")
   310             self.ui.write("\n")
   312 
   311 
   313 class changesetformatter(changesetprinter):
   312 class changesetformatter(changesetprinter):
   314     """Format changeset information by generic formatter"""
   313     """Format changeset information by generic formatter"""
   315 
   314 
   366             fm.data(files=fm.formatlist(ctx.files(), name='file'))
   365             fm.data(files=fm.formatlist(ctx.files(), name='file'))
   367             if copies:
   366             if copies:
   368                 fm.data(copies=fm.formatdict(copies,
   367                 fm.data(copies=fm.formatdict(copies,
   369                                              key='name', value='source'))
   368                                              key='name', value='source'))
   370 
   369 
   371         stat = self.diffopts.get('stat')
   370         if self._includestat:
   372         diff = self.diffopts.get('patch')
       
   373         if stat:
       
   374             self.ui.pushbuffer()
   371             self.ui.pushbuffer()
   375             self._differ.showdiff(self.ui, ctx, self._diffopts, stat=True)
   372             self._differ.showdiff(self.ui, ctx, self._diffopts, stat=True)
   376             fm.data(diffstat=self.ui.popbuffer())
   373             fm.data(diffstat=self.ui.popbuffer())
   377         if diff:
   374         if self._includediff:
   378             self.ui.pushbuffer()
   375             self.ui.pushbuffer()
   379             self._differ.showdiff(self.ui, ctx, self._diffopts, stat=False)
   376             self._differ.showdiff(self.ui, ctx, self._diffopts, stat=False)
   380             fm.data(diff=self.ui.popbuffer())
   377             fm.data(diff=self.ui.popbuffer())
   381 
   378 
   382 class changesettemplater(changesetprinter):
   379 class changesettemplater(changesetprinter):