hg
author Adrian Buehlmann <adrian@cadifra.com>
Wed, 04 Jul 2012 12:43:13 +0200
changeset 17109 7ba2b9435da9
parent 14233 659f34b833b9
child 21812 73e4a02e6d23
permissions -rwxr-xr-x
test-hgweb-diffs: partially adapt for Windows Since chmod isn't supported on Windows (or vfat), I'm importing a here-doc instead (<<EOF ..). Option --bypass on import of the here-doc is required on Windows (or vfat) to bypass the working directory (see hg help import). Not using --bypass would lose the mode changing bits. I've had to insert a --bypass on the preexisting import call futher down in the test, because importing a patch with --exact and mode changes will fail on Windows (and vfat). As the point of this test is not to test commit, I'm using the import procedure for all platforms unconditionally, that is, I'm intentionally not keeping the original sequence of hg and chmod calls for platforms that support exec either, which saves us having to insert an #if exec ... #else ... #endif.

#!/usr/bin/env python
#
# mercurial - scalable distributed SCM
#
# Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.

import os
import sys

libdir = '@LIBDIR@'

if libdir != '@' 'LIBDIR' '@':
    if not os.path.isabs(libdir):
        libdir = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                              libdir)
        libdir = os.path.abspath(libdir)
    sys.path.insert(0, libdir)

# enable importing on demand to reduce startup time
try:
    from mercurial import demandimport; demandimport.enable()
except ImportError:
    import sys
    sys.stderr.write("abort: couldn't find mercurial libraries in [%s]\n" %
                     ' '.join(sys.path))
    sys.stderr.write("(check your install and PYTHONPATH)\n")
    sys.exit(-1)

import mercurial.util
import mercurial.dispatch

for fp in (sys.stdin, sys.stdout, sys.stderr):
    mercurial.util.setbinary(fp)

mercurial.dispatch.run()