make_file: always return a fresh file handle that can be closed
Currently, cmdutil.make_file() will return a freshly made file handle,
except when given a pattern of '-'. If callers would want to close the
handle, they would have to make sure that it's neither sys.stdin or
sys.stdout. Instead, returning a duplicate of either of the two
ensures that make_file() lives up to its name and creates a new
file handle regardless of the input.
hg debuginstall
$ hg debuginstall
Checking encoding (ascii)...
Checking installed modules (*/mercurial)... (glob)
Checking templates...
Checking patch...
Checking commit editor...
Checking username...
No problems detected
hg debuginstall with no username
$ HGUSER= hg debuginstall
Checking encoding (ascii)...
Checking installed modules (*/mercurial)... (glob)
Checking templates...
Checking patch...
Checking commit editor...
Checking username...
no username supplied (see "hg help config")
(specify a username in your configuration file)
1 problems detected, please check your install!
[1]