diff -r 044f3d7eb9ae -r 2dd8d4108249 mercurial/cmdutil.py --- a/mercurial/cmdutil.py Mon May 29 21:57:51 2017 +0900 +++ b/mercurial/cmdutil.py Thu May 25 21:25:49 2017 +0900 @@ -641,10 +641,6 @@ else: fp = repo.ui.fin return _unclosablefile(fp) - if util.safehasattr(pat, 'write') and writable: - return pat - if util.safehasattr(pat, 'read') and 'r' in mode: - return pat fn = makefilename(repo, pat, node, desc, total, seqno, revwidth, pathname) if modemap is not None: mode = modemap.get(fn, mode)