Mercurial > hg
annotate contrib/discovery-helper.sh @ 41609:286eeed14893
fsmonitor: rename new verbose config knob
The config knob was introduced in this release cycle under the old extension
name, rename it before it is part of a release.
Differential Revision: https://phab.mercurial-scm.org/D5880
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Thu, 07 Feb 2019 17:04:15 +0100 |
parents | 01c335afc997 |
children |
rev | line source |
---|---|
40805
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
1 #!/bin/bash |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
2 # |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
3 # produces two repositories with different common and missing subsets |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
4 # |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
5 # $ discovery-helper.sh REPO NBHEADS DEPT |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
6 # |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
7 # The Goal is to produce two repositories with some common part and some |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
8 # exclusive part on each side. Provide a source repository REPO, it will |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
9 # produce two repositories REPO-left and REPO-right. |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
10 # |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
11 # Each repository will be missing some revisions exclusive to NBHEADS of the |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
12 # repo topological heads. These heads and revisions exclusive to them (up to |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
13 # DEPTH depth) are stripped. |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
14 # |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
15 # The "left" repository will use the NBHEADS first heads (sorted by |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
16 # description). The "right" use the last NBHEADS one. |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
17 # |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
18 # To find out how many topological heads a repo has, use: |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
19 # |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
20 # $ hg heads -t -T '{rev}\n' | wc -l |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
21 # |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
22 # Example: |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
23 # |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
24 # The `pypy-2018-09-01` repository has 192 heads. To produce two repositories |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
25 # with 92 common heads and ~50 exclusive heads on each side. |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
26 # |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
27 # $ ./discovery-helper.sh pypy-2018-08-01 50 10 |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
28 |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
29 set -euo pipefail |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
30 |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
31 if [ $# -lt 3 ]; then |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
32 echo "usage: `basename $0` REPO NBHEADS DEPTH" |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
33 exit 64 |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
34 fi |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
35 |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
36 repo="$1" |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
37 shift |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
38 |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
39 nbheads="$1" |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
40 shift |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
41 |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
42 depth="$1" |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
43 shift |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
44 |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
45 leftrepo="${repo}-left" |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
46 rightrepo="${repo}-right" |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
47 |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
48 left="first(sort(heads(all()), 'desc'), $nbheads)" |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
49 right="last(sort(heads(all()), 'desc'), $nbheads)" |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
50 |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
51 leftsubset="ancestors($left, $depth) and only($left, heads(all() - $left))" |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
52 rightsubset="ancestors($right, $depth) and only($right, heads(all() - $right))" |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
53 |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
54 echo '### building left repository:' $left-repo |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
55 echo '# cloning' |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
56 hg clone --noupdate "${repo}" "${leftrepo}" |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
57 echo '# stripping' '"'${leftsubset}'"' |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
58 hg -R "${leftrepo}" --config extensions.strip= strip --rev "$leftsubset" --no-backup |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
59 |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
60 echo '### building right repository:' $right-repo |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
61 echo '# cloning' |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
62 hg clone --noupdate "${repo}" "${rightrepo}" |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
63 echo '# stripping:' '"'${rightsubset}'"' |
01c335afc997
contrib: add a helper script that help to build interesting repositories
Boris Feld <boris.feld@octobus.net>
parents:
diff
changeset
|
64 hg -R "${rightrepo}" --config extensions.strip= strip --rev "$rightsubset" --no-backup |