filemerge regression in 1.9

David Wilhelm dave at jumbledpile.com
Wed Jul 6 12:34:27 CDT 2011


On Wed, 2011-07-06 11:52 +0300, Idan Kamara wrote:
> On Wed, Jul 6, 2011 at 6:43 AM, Steve Borho <steve at borho.org> wrote:
> >
> > Since Mercurial 1.9, TortoiseHg is no longer able launch external
> > merge tools from the resolve tool when our app is launched from the
> > shell extension.  All we get is a meaningless error:
> >
> > % hg resolve --traceback -a
> > merging foo.c
> > abort: The handle is invalid
> 
> I'm guessing you are now hitting the else here:
> 
> http://selenic.com/repo/hg/file/11b5a5d2ca8b/mercurial/util.py#l357
> 
> So if I'm getting this right, in your case sys.stdout != sys.__stdout__
> (which seems a bit strange),
> and sys.stdout is an invalid handle, which write() fails on.

Yep, that's correct.

> Can you print sys.stdout/__stdout__ so we can see if they are indeed
> different,
> and also get that traceback to show just to be sure?

I was testing with pythonw, so wrote to a log file instead:

C:\Users\dave\src\hg-dev>hg diff
diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -354,6 +354,12 @@ def system(cmd, environ={}, cwd=None, on
     env = dict(os.environ)
     env.update((k, py2shell(v)) for k, v in environ.iteritems())
     env['HG'] = hgexecutable()
+    fh = open('pythonw.log', 'w')
+    print >>fh, 'sys.__stdout__: %s' % sys.__stdout__
+    print >>fh, 'sys.stdout    : %s' % sys.stdout
+    print >>fh, 'sys.__stderr__: %s' % sys.__stderr__
+    print >>fh, 'sys.stderr    : %s' % sys.stderr
+    fh.close()
     if out is None or out == sys.__stdout__:
         rc = subprocess.call(cmd, shell=True, close_fds=closefds,
                              env=env, cwd=cwd)

After `pythonw C:\Users\dave\src\hg-dev\hg resolve -a` pythonw.log has:

sys.__stdout__: <open file '<stdout>', mode 'w' at 0x0000000001D97150>
sys.stdout    : <mercurial.windows.winstdout object at 0x0000000001F5FBE0>
sys.__stderr__: <open file '<stderr>', mode 'w' at 0x0000000001D971E0>
sys.stderr    : <open file '<stderr>', mode 'w' at 0x0000000001D971E0>

-- 
David Wilhelm


More information about the Mercurial-devel mailing list