contrib/hammerclient.py
author Pierre-Yves David <pierre-yves.david@octobus.net>
Tue, 28 Aug 2018 11:25:32 +0200
branchmercurial-4.3
changeset 4033 b609412b42b0
parent 4016 e058b3288770
child 4809 f97379faefa3
permissions -rwxr-xr-x
test-compat: merge mercurial-4.4 into mercurial-4.3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4016
e058b3288770 contrib: introduce a small script to stress tests obsolescence exchange
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
     1
#!/usr/bin/env python
e058b3288770 contrib: introduce a small script to stress tests obsolescence exchange
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
     2
import os
e058b3288770 contrib: introduce a small script to stress tests obsolescence exchange
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
     3
import sys
e058b3288770 contrib: introduce a small script to stress tests obsolescence exchange
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
     4
import subprocess
e058b3288770 contrib: introduce a small script to stress tests obsolescence exchange
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
     5
e058b3288770 contrib: introduce a small script to stress tests obsolescence exchange
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
     6
if len(sys.argv) < 2:
e058b3288770 contrib: introduce a small script to stress tests obsolescence exchange
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
     7
    execname = os.path.basename(sys.argv[0])
e058b3288770 contrib: introduce a small script to stress tests obsolescence exchange
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
     8
    print >> sys.stderr, "usage: %s CLIENT_ID" % execname
e058b3288770 contrib: introduce a small script to stress tests obsolescence exchange
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
     9
e058b3288770 contrib: introduce a small script to stress tests obsolescence exchange
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    10
client_id = sys.argv[1]
e058b3288770 contrib: introduce a small script to stress tests obsolescence exchange
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    11
e058b3288770 contrib: introduce a small script to stress tests obsolescence exchange
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    12
subprocess.check_call(['hg', 'branch', "--force", "hammer-branch-%s" % client_id])
e058b3288770 contrib: introduce a small script to stress tests obsolescence exchange
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    13
e058b3288770 contrib: introduce a small script to stress tests obsolescence exchange
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    14
while True:
e058b3288770 contrib: introduce a small script to stress tests obsolescence exchange
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    15
    subprocess.check_call([
e058b3288770 contrib: introduce a small script to stress tests obsolescence exchange
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    16
        'hg', 'commit',
e058b3288770 contrib: introduce a small script to stress tests obsolescence exchange
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    17
        "--config", "ui.allowemptycommit=yes",
e058b3288770 contrib: introduce a small script to stress tests obsolescence exchange
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    18
        "--message", "hammer-%s" % client_id,
e058b3288770 contrib: introduce a small script to stress tests obsolescence exchange
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    19
    ])
e058b3288770 contrib: introduce a small script to stress tests obsolescence exchange
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    20
    nodeid = subprocess.check_output([
e058b3288770 contrib: introduce a small script to stress tests obsolescence exchange
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    21
        'hg', 'log', '--rev', '.', '--template', '{node}'
e058b3288770 contrib: introduce a small script to stress tests obsolescence exchange
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    22
    ])
e058b3288770 contrib: introduce a small script to stress tests obsolescence exchange
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    23
    subprocess.check_call([
e058b3288770 contrib: introduce a small script to stress tests obsolescence exchange
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    24
        'hg', 'debugobsolete', ''.join(reversed(nodeid)), nodeid
e058b3288770 contrib: introduce a small script to stress tests obsolescence exchange
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    25
    ])
e058b3288770 contrib: introduce a small script to stress tests obsolescence exchange
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    26
    subprocess.check_call(['hg', 'pull'])
e058b3288770 contrib: introduce a small script to stress tests obsolescence exchange
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    27
    subprocess.check_call(['hg', 'push', '--force'])