Mercurial > evolve
view contrib/hammerclient.py @ 6699:ddebaa161306 stable
evolve: use functions from topic extension to set current topic and tns
In some cases in evolve we need to relocate commits on disk instead of purely
in-memory. Previously we were writing .hg/topic file by hand here, but it
wasn't the right thing to do, and also we could sometimes write an empty string
to the file. Let's use the functions in topic that are specifically made to
change current topic and tns.
I don't think we can simply manipulate commit extras to copy topic and
topic_namespace, because sometimes we can have unresolved merge conflicts
(since we're dealing with relocating on disk), and in this case users might
need to continue evolve later after resolving the situation, so I think we
definitely want to write current topic and tns to the files for persistence.
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Thu, 22 Feb 2024 14:10:01 -0300 |
parents | f97379faefa3 |
children |
line wrap: on
line source
#!/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'])