Mercurial > evolve
annotate contrib/hammerclient.py @ 4016:e058b3288770 stable
contrib: introduce a small script to stress tests obsolescence exchange
Tester have been reporting some error that seems to originate from concurrent
access/update to the cache. This script will be useful to reproduce these
situations locally.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sun, 26 Aug 2018 20:55:26 +0200 |
parents | |
children | f97379faefa3 |
rev | line source |
---|---|
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']) |