contrib/hammerclient.py
author Rodrigo Damazio Bovendorp <rdamazio@google.com>
Fri, 27 Dec 2019 20:40:13 -0800
changeset 5252 1fda186ae6b7
parent 4809 f97379faefa3
permissions -rwxr-xr-x
obslog: add display of precursor information to the default template This will still only be output when the user passes --precursors to the command (otherwise the data just won't be there). This addresses a common user request, where they actually would find more intuitive to use --precursors --no-successors.

#!/usr/bin/env python
import os
import sys
import subprocess

if len(sys.argv) < 2:
    execname = os.path.basename(sys.argv[0])
    sys.stderr.write("usage: %s CLIENT_ID\n" % execname)

client_id = sys.argv[1]

subprocess.check_call(['hg', 'branch', "--force", "hammer-branch-%s" % client_id])

while True:
    subprocess.check_call([
        'hg', 'commit',
        "--config", "ui.allowemptycommit=yes",
        "--message", "hammer-%s" % client_id,
    ])
    nodeid = subprocess.check_output([
        'hg', 'log', '--rev', '.', '--template', '{node}'
    ])
    subprocess.check_call([
        'hg', 'debugobsolete', ''.join(reversed(nodeid)), nodeid
    ])
    subprocess.check_call(['hg', 'pull'])
    subprocess.check_call(['hg', 'push', '--force'])