tests/dummyssh
author Durham Goode <durham@fb.com>
Thu, 07 Apr 2016 14:10:49 -0700
changeset 28830 a5009789960c
parent 19320 f266cb3f1c2b
child 29159 26d4ce8ca2bd
permissions -rwxr-xr-x
transaction: allow running file generators after finalizers Previously, transaction.close would run the file generators before running the finalizers (see the list below for what is in each). Since file generators contain the bookmarks and the dirstate, this meant we made the dirstate and bookmarks visible to external readers before we actually wrote the commits into the changelog, which could result in missing bookmarks and missing working copy parents (especially on servers with high commit throughput, since pulls might fail to see certain bookmarks in this situation). By moving the changelog writing to be before the bookmark/dirstate writing, we ensure the commits are present before they are referenced. This implementation allows certain file generators to be after the finalizers. We didn't want to move all of the generators, since it's important that things like phases actually run before the finalizers (otherwise you could expose commits as public when they really shouldn't be). For reference, file generators currently consist of: bookmarks, dirstate, and phases. Finalizers currently consist of: changelog, revbranchcache, and fncache.

#!/usr/bin/env python

import sys
import os

os.chdir(os.getenv('TESTTMP'))

if sys.argv[1] != "user@dummy":
    sys.exit(-1)

os.environ["SSH_CLIENT"] = "127.0.0.1 1 2"

log = open("dummylog", "ab")
log.write("Got arguments")
for i, arg in enumerate(sys.argv[1:]):
    log.write(" %d:%s" % (i + 1, arg))
log.write("\n")
log.close()
hgcmd = sys.argv[2]
if os.name == 'nt':
    # hack to make simple unix single quote quoting work on windows
    hgcmd = hgcmd.replace("'", '"')
r = os.system(hgcmd)
sys.exit(bool(r))