[PATCH 3 of 5] histedit: do not close stdin

Yuya Nishihara yuya at tcha.org
Thu Mar 17 10:09:25 EDT 2016


On Tue, 15 Mar 2016 09:58:34 +0000, Jun Wu wrote:
> # HG changeset patch
> # User Jun Wu <quark at fb.com>
> # Date 1458002553 0
> #      Tue Mar 15 00:42:33 2016 +0000
> # Node ID c769f8196ccfdfa546862b0c4f608b78ca80a1c7
> # Parent  cab663c8ba601c8ed617d18344ed8e232f86284b
> histedit: do not close stdin
> 
> Closing stdin is unexpected by chgserver and is not a good idea generally.

Sure, queued 2 and 3 to the clowncopter, thanks.

> diff --git a/hgext/histedit.py b/hgext/histedit.py
> --- a/hgext/histedit.py
> +++ b/hgext/histedit.py
> @@ -998,6 +998,13 @@
>          return goaleditplan
>      return goalnew
>  
> +def _readfile(path):
> +    if path == '-':
> +        return sys.stdin.read()
> +    else:
> +        with open(path, 'rb') as f:
> +            return f.read()

OT: reading sys.stdin doesn't work in pure command server. it should be
ui.fin.read().


More information about the Mercurial-devel mailing list