mercurial/logcmdutil.py
changeset 35961 0ff41ced4c12
parent 35955 218b77c4c87a
child 36002 f8ad57d24252
equal deleted inserted replaced
35960:580f7b1b88c7 35961:0ff41ced4c12
    77     if stat:
    77     if stat:
    78         diffopts = diffopts.copy(context=0, noprefix=False)
    78         diffopts = diffopts.copy(context=0, noprefix=False)
    79         width = 80
    79         width = 80
    80         if not ui.plain():
    80         if not ui.plain():
    81             width = ui.termwidth()
    81             width = ui.termwidth()
    82         chunks = patch.diff(repo, node1, node2, match, changes, opts=diffopts,
    82 
    83                             prefix=prefix, relroot=relroot,
    83     chunks = patch.diff(repo, node1, node2, match, changes, opts=diffopts,
    84                             hunksfilterfn=hunksfilterfn)
    84                         prefix=prefix, relroot=relroot,
    85         for chunk, label in patch.diffstatui(util.iterlines(chunks),
    85                         hunksfilterfn=hunksfilterfn)
    86                                              width=width):
    86 
    87             write(chunk, label=label)
    87     if fp is not None or ui.canwritewithoutlabels():
       
    88         if stat:
       
    89             chunks = patch.diffstat(util.iterlines(chunks), width=width)
       
    90         for chunk in util.filechunkiter(util.chunkbuffer(chunks)):
       
    91             write(chunk)
    88     else:
    92     else:
    89         for chunk, label in patch.diffui(repo, node1, node2, match,
    93         if stat:
    90                                          changes, opts=diffopts, prefix=prefix,
    94             chunks = patch.diffstatui(util.iterlines(chunks), width=width)
    91                                          relroot=relroot,
    95         else:
    92                                          hunksfilterfn=hunksfilterfn):
    96             chunks = patch.difflabel(lambda chunks, **kwargs: chunks, chunks,
    93             write(chunk, label=label)
    97                                      opts=diffopts)
       
    98         if ui.canbatchlabeledwrites():
       
    99             def gen():
       
   100                 for chunk, label in chunks:
       
   101                     yield ui.label(chunk, label=label)
       
   102             for chunk in util.filechunkiter(util.chunkbuffer(gen())):
       
   103                 write(chunk)
       
   104         else:
       
   105             for chunk, label in chunks:
       
   106                 write(chunk, label=label)
    94 
   107 
    95     if listsubrepos:
   108     if listsubrepos:
    96         ctx1 = repo[node1]
   109         ctx1 = repo[node1]
    97         ctx2 = repo[node2]
   110         ctx2 = repo[node2]
    98         for subpath, sub in scmutil.itersubrepos(ctx1, ctx2):
   111         for subpath, sub in scmutil.itersubrepos(ctx1, ctx2):