mercurial/logcmdutil.py
changeset 44889 3b7aabd02e11
parent 44379 14d0e89520a2
child 45216 4ebc5f325bed
child 45289 dfb67cd1da7f
equal deleted inserted replaced
44888:118f067f6bd1 44889:3b7aabd02e11
    70 
    70 
    71 def diffordiffstat(
    71 def diffordiffstat(
    72     ui,
    72     ui,
    73     repo,
    73     repo,
    74     diffopts,
    74     diffopts,
    75     node1,
    75     ctx1,
    76     node2,
    76     ctx2,
    77     match,
    77     match,
    78     changes=None,
    78     changes=None,
    79     stat=False,
    79     stat=False,
    80     fp=None,
    80     fp=None,
    81     graphwidth=0,
    81     graphwidth=0,
    83     root=b'',
    83     root=b'',
    84     listsubrepos=False,
    84     listsubrepos=False,
    85     hunksfilterfn=None,
    85     hunksfilterfn=None,
    86 ):
    86 ):
    87     '''show diff or diffstat.'''
    87     '''show diff or diffstat.'''
    88     ctx1 = repo[node1]
       
    89     ctx2 = repo[node2]
       
    90     if root:
    88     if root:
    91         relroot = pathutil.canonpath(repo.root, repo.getcwd(), root)
    89         relroot = pathutil.canonpath(repo.root, repo.getcwd(), root)
    92     else:
    90     else:
    93         relroot = b''
    91         relroot = b''
    94     copysourcematch = None
    92     copysourcematch = None
   171                 ui.write(chunk)
   169                 ui.write(chunk)
   172         else:
   170         else:
   173             for chunk, label in chunks:
   171             for chunk, label in chunks:
   174                 ui.write(chunk, label=label)
   172                 ui.write(chunk, label=label)
   175 
   173 
       
   174     node2 = ctx2.node()
   176     for subpath, sub in scmutil.itersubrepos(ctx1, ctx2):
   175     for subpath, sub in scmutil.itersubrepos(ctx1, ctx2):
   177         tempnode2 = node2
   176         tempnode2 = node2
   178         try:
   177         try:
   179             if node2 is not None:
   178             if node2 is not None:
   180                 tempnode2 = ctx2.substate[subpath][1]
   179                 tempnode2 = ctx2.substate[subpath][1]
   206 
   205 
   207     def _makehunksfilter(self, ctx):
   206     def _makehunksfilter(self, ctx):
   208         return None
   207         return None
   209 
   208 
   210     def showdiff(self, ui, ctx, diffopts, graphwidth=0, stat=False):
   209     def showdiff(self, ui, ctx, diffopts, graphwidth=0, stat=False):
   211         repo = ctx.repo()
       
   212         node = ctx.node()
       
   213         prev = ctx.p1().node()
       
   214         diffordiffstat(
   210         diffordiffstat(
   215             ui,
   211             ui,
   216             repo,
   212             ctx.repo(),
   217             diffopts,
   213             diffopts,
   218             prev,
   214             ctx.p1(),
   219             node,
   215             ctx,
   220             match=self._makefilematcher(ctx),
   216             match=self._makefilematcher(ctx),
   221             stat=stat,
   217             stat=stat,
   222             graphwidth=graphwidth,
   218             graphwidth=graphwidth,
   223             hunksfilterfn=self._makehunksfilter(ctx),
   219             hunksfilterfn=self._makehunksfilter(ctx),
   224         )
   220         )