I have to run a dozen of different build tests on a code base maintained in a mercurial repository. I don't want to run serially these tests on same repository because they modify a set of common files and I want to run them in parallel on different machines. Also, after all tests are run I want to have access to latest test results from those test work areas. Currently I'm cloning the master repository a dozen of times and run in each clone one different test. Before each test execution I do a pull/update/purge preparation sequence in order to start the test on latest clean state. That's good for me.
I'm also preparing new changes using mq extension that I would test on all clones as above before committing them. For testing some ready candidate mq patches I want somehow to deploy/synchronize them to be ava开发者_Go百科ilable in test clones and apply those ready for testing using some guard before running the test.
Did anybody do this synchronization before? What's the most simple way to do it? Do I need to have versioned mq patches for that?
patches can be maintained in their own repository provided you passed the "-c" switch to qinit like so
hg qinit -c
You may still be able to create a patch repo after the fact via
cd .hg/patches
hg init
hg addremove
hg commit -m "my patches"
But I haven't ever tried that personally.
then .hg/patches can be treated like any other mercurial repository. so I think you could probably roll some shell scripting. to get into the .hg dir of your cloned repos and do a
hg clone http://centralrepo.com/patch_repo ./patches
Here is the solution that I've implemented. Few notes:
- all patches guarded with ready_for_testing AND those unguarded are applied for testing.
- using versioned repos is better because we can make abstraction of queue repository implementation
- I use mercurial 1.5.1
- master repo is in
master
dir - clone repos are in
clone-x
dirs
Here are the steps (some could be optional):
once: put patches in master repository under versioning using mercurial:
a.hg -R master init --mq
#no commit happen here, can be done later
b.hg -R master commit --mq --addremove --message 'initial patch queue'
#make them visible to clone reposfor each clone, once after clone creation finishes: assuming no patches created yet on clones, initialize mq sub-repository:
a.hg clone master\.hg\patches clone-x\.hg\patches
b.hg -R clone-x qselect ready_for_testing
for each change ready in master (patch created/imported in mq repo): do this before launching tests for it:
a. review/update guards of mq patches: those included for testing should be unguarded or with +ready_for_testing
b.hg -R master commit --mq -A
#make them visible to clone reposfor each clone, for each [test] iteration for each clone: do this preparation sequence before running the actual test:
a.hg -R clone-x qpop --all --force
b.hg -R clone-x pull
c.hg -R clone-x update --clean
d.hg -R clone-x purge --all
e.hg -R clone-x pull --mq
f.hg -R clone-x update --mq
g.hg -R clone-x qpush --all
As of Mercurial version 1.5, you can create a patch queue repository in an already existing Mercurial repo using the following command:
hg init --mq
It is OK to have queued patches when you issue that command.
精彩评论