tests/heredoctest.py
author Martin Geisler <mg@aragost.com>
Mon, 17 Oct 2011 16:45:19 +0200
branchstable
changeset 15286 4be845e3932c
parent 15247 3cd1605e9d8e
child 15398 474279be5add
permissions -rw-r--r--
subrepo: pull revisions on demand when archiving hg subrepos Before, running 'hg archive -S' could result in abort: unknown revision '65903cebad86f1a84bd4f1134f62fa7dcb7a1c98'! if a subrepo was missing completely or had missing changesets. Now, the missing changesets will be pulled or cloned as appropriate. This make Mercurial subrepos match Git subrepos which already took care to fetch any missing commits before starting the archive.

import doctest, tempfile, os, sys

if __name__ == "__main__":
    fd, name = tempfile.mkstemp(suffix='hg-tst')

    try:
        os.write(fd, sys.stdin.read())
        os.close(fd)
        failures, _ = doctest.testfile(name, module_relative=False)
        if failures:
            sys.exit(1)
    finally:
        os.remove(name)