view contrib/debugcmdserver.py @ 21099:12c7cea6235c

contrib: remove mergetools.hgrc premerge=False for Beyond Compare and Araxis There can be good reasons to disable premerge no matter which merge tool is used. Most tools will do just fine without premerge and handle the simple merges more or less automatic and silent. We _could_ thus disable premerge for most tools. But without premerge, the merge tool will be launched for each file - that makes it a slow and expensive process to perform big simple merges. It is thus better to consistently stick to the default premerge=True. The mergetools.hgrc configuration for most tools implicitly use the default premerge=True but Araxis and the Linux entry for Beyond Compare had premerge=False. These lines has been removed. These settings were introduced by 6b354a763617 without further explanation of why they should be good. (We have seen some crashes on Windows with Araxis where a merge failed after a lot of Araxis flashing. I haven't been able to reproduce it and do not know exactly what happened. Enabling premerge avoids the problems.)
author Mads Kiilerich <madski@unity3d.com>
date Thu, 17 Apr 2014 14:54:46 +0200
parents e34106fa0dc3
children cd03fbd5ab57
line wrap: on
line source

#!/usr/bin/env python
#
# Dumps output generated by Mercurial's command server in a formatted style to a
# given file or stderr if '-' is specified. Output is also written in its raw
# format to stdout.
#
# $ ./hg serve --cmds pipe | ./contrib/debugcmdserver.py -
# o, 52   -> 'capabilities: getencoding runcommand\nencoding: UTF-8'

import sys, struct

if len(sys.argv) != 2:
    print 'usage: debugcmdserver.py FILE'
    sys.exit(1)

outputfmt = '>cI'
outputfmtsize = struct.calcsize(outputfmt)

if sys.argv[1] == '-':
    log = sys.stderr
else:
    log = open(sys.argv[1], 'a')

def read(size):
    data = sys.stdin.read(size)
    if not data:
        raise EOFError
    sys.stdout.write(data)
    sys.stdout.flush()
    return data

try:
    while True:
        header = read(outputfmtsize)
        channel, length = struct.unpack(outputfmt, header)
        log.write('%s, %-4d' % (channel, length))
        if channel in 'IL':
            log.write(' -> waiting for input\n')
        else:
            data = read(length)
            log.write(' -> %r\n' % data)
        log.flush()
except EOFError:
    pass
finally:
    if log != sys.stderr:
        log.close()