yuja requested changes to this revision.
yuja added inline comments.
This revision now requires changes to proceed.


> cmdutil.py:1593
>      else:
>          def write(s, **kw):
>              fp.write(s)

We no longer need this `write()` wrapper because no labeling is required if fp 
is given.

> cmdutil.py:1620
>      else:
> -        for chunk, label in patch.diffui(repo, node1, node2, match,
> -                                         changes, opts=diffopts, 
> prefix=prefix,
> -                                         relroot=relroot,
> -                                         hunksfilterfn=hunksfilterfn):
> +        chunksiter = patch.diffui(repo, node1, node2, match, changes,
> +                                  opts=diffopts, prefix=prefix,

If we don't care labels, we can simply use `patch.diff()` and `.diffstat()` 
instead of `patch.diffui()` and `.diffstatui()` respectively.

> cmdutil.py:1624
> +
> +    from itertools import izip_longest
> +    def grouper(iterable, n):

Please move the import line to top.

> cmdutil.py:1629
> +
> +    if fp is None and ui.writenolabels():
> +        for block in grouper(chunksiter, 512):

`grouper()` could be replaced by `util.chunkbuffer()` over chunks of bytes.

  if nolabel:
      chunksiter = patch.diff()
  elif batchable:
      chunksiter = patch.diffui()
      util.chunkbuffer(ui.label(chunk, label) for chunk, label in chunksiter)

> ui.py:884
> +        if self._buffers and not opts.get(r'prompt', False):
> +            if not self._bufferapplylabels:
> +                return True

Perhaps we can simply make _colormode public instead of adding
these functions?

If ui is buffered, batchable state wouldn't matter as all write()s
will be combined into a string.

  rHG Mercurial


To: joerg.sonnenberger, #hg-reviewers, yuja
Cc: yuja, lothiraldan, mercurial-devel
Mercurial-devel mailing list

Reply via email to