##// END OF EJS Templates
testlib: move the prune alias into a shell script for Windows...
Matt Harbison -
r32007:f12b6185 default
parent child Browse files
Show More
@@ -1,133 +1,139 b''
1 #!/bin/sh
1 #!/bin/sh
2 # setup config and various utility to test obsolescence marker exchanges tests
2 # setup config and various utility to test obsolescence marker exchanges tests
3
3
4 cat >> $TESTTMP/prune.sh << EOF
5 rev=\`hg log --hidden --template '{node}\n' --rev "\$3"\`
6
7 hg debugobsolete --record-parents \$1 "\$2" \$rev \
8 && hg up --quiet 'max((::.) - obsolete())'
9 EOF
10
4 cat >> $HGRCPATH <<EOF
11 cat >> $HGRCPATH <<EOF
5 [web]
12 [web]
6 # We test http pull and push, drop authentication requirement
13 # We test http pull and push, drop authentication requirement
7 push_ssl = false
14 push_ssl = false
8 allow_push = *
15 allow_push = *
9
16
10 [ui]
17 [ui]
11 # simpler log output
18 # simpler log output
12 logtemplate ="{node|short} ({phase}): {desc}\n"
19 logtemplate ="{node|short} ({phase}): {desc}\n"
13
20
14 [phases]
21 [phases]
15 # non publishing server
22 # non publishing server
16 publish=False
23 publish=False
17
24
18 [experimental]
25 [experimental]
19 # reduce output changes
26 # reduce output changes
20 bundle2-output-capture=True
27 bundle2-output-capture=True
21 # enable evolution
28 # enable evolution
22 evolution=all
29 evolution=all
23
30
24 [extensions]
31 [extensions]
25 # we need to strip some changeset for some test cases
32 # we need to strip some changeset for some test cases
26 hgext.strip=
33 hgext.strip=
27
34
28 [alias]
35 [alias]
29 # fix date used to create obsolete markers.
36 # fix date used to create obsolete markers.
30 debugobsolete=debugobsolete -d '0 0'
37 debugobsolete=debugobsolete -d '0 0'
31 # poor man substiture to the evolve 'hg prune'. using prune makes the test clearer and
38 # poor man substiture to the evolve 'hg prune'. using prune makes the test clearer and
32 prune =!hg debugobsolete --record-parents \$1 "\$2" \`hg log --hidden --template '{node}\n' --rev "\$3"\`;\
39 prune = !sh $TESTTMP/prune.sh \$1 "\$2" "\$3"
33 hg up --quiet 'max((::.) - obsolete())'
34 EOF
40 EOF
35
41
36 mkcommit() {
42 mkcommit() {
37 echo "$1" > "$1"
43 echo "$1" > "$1"
38 hg add "$1"
44 hg add "$1"
39 hg ci -m "$1"
45 hg ci -m "$1"
40 }
46 }
41 getid() {
47 getid() {
42 hg log --hidden --template '{node}\n' --rev "$1"
48 hg log --hidden --template '{node}\n' --rev "$1"
43 }
49 }
44
50
45 setuprepos() {
51 setuprepos() {
46 echo creating test repo for test case $1
52 echo creating test repo for test case $1
47 mkdir $1
53 mkdir $1
48 cd $1
54 cd $1
49 echo - pulldest
55 echo - pulldest
50 hg init pushdest
56 hg init pushdest
51 cd pushdest
57 cd pushdest
52 mkcommit O
58 mkcommit O
53 hg phase --public .
59 hg phase --public .
54 cd ..
60 cd ..
55 echo - main
61 echo - main
56 hg clone -q pushdest main
62 hg clone -q pushdest main
57 echo - pushdest
63 echo - pushdest
58 hg clone -q main pulldest
64 hg clone -q main pulldest
59 echo 'cd into `main` and proceed with env setup'
65 echo 'cd into `main` and proceed with env setup'
60 }
66 }
61
67
62 inspect_obsmarkers (){
68 inspect_obsmarkers (){
63 # This exist as its own function to help the evolve extension reuse the tests as is.
69 # This exist as its own function to help the evolve extension reuse the tests as is.
64 # The evolve extensions version will includes more advances query (eg:
70 # The evolve extensions version will includes more advances query (eg:
65 # related to obsmarkers discovery) to this.
71 # related to obsmarkers discovery) to this.
66 echo 'obsstore content'
72 echo 'obsstore content'
67 echo '================'
73 echo '================'
68 hg debugobsolete
74 hg debugobsolete
69 }
75 }
70
76
71 dotest() {
77 dotest() {
72 # dotest TESTNAME [TARGETNODE] [PUSHFLAGS+]
78 # dotest TESTNAME [TARGETNODE] [PUSHFLAGS+]
73 #
79 #
74 # test exchange for the given test case.
80 # test exchange for the given test case.
75 #
81 #
76 # This function performs push and pull in all directions through all
82 # This function performs push and pull in all directions through all
77 # protocols and display the resulting obsolescence markers on all sides.
83 # protocols and display the resulting obsolescence markers on all sides.
78
84
79 testcase=$1
85 testcase=$1
80 shift
86 shift
81 target="$1"
87 target="$1"
82 if [ $# -gt 0 ]; then
88 if [ $# -gt 0 ]; then
83 shift
89 shift
84 fi
90 fi
85 targetnode=""
91 targetnode=""
86 desccall=""
92 desccall=""
87 cd $testcase
93 cd $testcase
88 echo "## Running testcase $testcase"
94 echo "## Running testcase $testcase"
89 if [ -n "$target" ]; then
95 if [ -n "$target" ]; then
90 desccall="desc("\'"$target"\'")"
96 desccall="desc("\'"$target"\'")"
91 targetnode="`hg -R main id -qr \"$desccall\"`"
97 targetnode="`hg -R main id -qr \"$desccall\"`"
92 echo "# testing echange of \"$target\" ($targetnode)"
98 echo "# testing echange of \"$target\" ($targetnode)"
93 fi
99 fi
94 echo "## initial state"
100 echo "## initial state"
95 echo "# obstore: main"
101 echo "# obstore: main"
96 hg -R main debugobsolete | sort
102 hg -R main debugobsolete | sort
97 echo "# obstore: pushdest"
103 echo "# obstore: pushdest"
98 hg -R pushdest debugobsolete | sort
104 hg -R pushdest debugobsolete | sort
99 echo "# obstore: pulldest"
105 echo "# obstore: pulldest"
100 hg -R pulldest debugobsolete | sort
106 hg -R pulldest debugobsolete | sort
101
107
102 if [ -n "$target" ]; then
108 if [ -n "$target" ]; then
103 echo "## pushing \"$target\"" from main to pushdest
109 echo "## pushing \"$target\"" from main to pushdest
104 hg -R main push -r "$desccall" $@ pushdest
110 hg -R main push -r "$desccall" $@ pushdest
105 else
111 else
106 echo "## pushing from main to pushdest"
112 echo "## pushing from main to pushdest"
107 hg -R main push pushdest $@
113 hg -R main push pushdest $@
108 fi
114 fi
109 echo "## post push state"
115 echo "## post push state"
110 echo "# obstore: main"
116 echo "# obstore: main"
111 hg -R main debugobsolete | sort
117 hg -R main debugobsolete | sort
112 echo "# obstore: pushdest"
118 echo "# obstore: pushdest"
113 hg -R pushdest debugobsolete | sort
119 hg -R pushdest debugobsolete | sort
114 echo "# obstore: pulldest"
120 echo "# obstore: pulldest"
115 hg -R pulldest debugobsolete | sort
121 hg -R pulldest debugobsolete | sort
116 if [ -n "$target" ]; then
122 if [ -n "$target" ]; then
117 echo "## pulling \"$targetnode\"" from main into pulldest
123 echo "## pulling \"$targetnode\"" from main into pulldest
118 hg -R pulldest pull -r $targetnode $@ main
124 hg -R pulldest pull -r $targetnode $@ main
119 else
125 else
120 echo "## pulling from main into pulldest"
126 echo "## pulling from main into pulldest"
121 hg -R pulldest pull main $@
127 hg -R pulldest pull main $@
122 fi
128 fi
123 echo "## post pull state"
129 echo "## post pull state"
124 echo "# obstore: main"
130 echo "# obstore: main"
125 hg -R main debugobsolete | sort
131 hg -R main debugobsolete | sort
126 echo "# obstore: pushdest"
132 echo "# obstore: pushdest"
127 hg -R pushdest debugobsolete | sort
133 hg -R pushdest debugobsolete | sort
128 echo "# obstore: pulldest"
134 echo "# obstore: pulldest"
129 hg -R pulldest debugobsolete | sort
135 hg -R pulldest debugobsolete | sort
130
136
131 cd ..
137 cd ..
132
138
133 }
139 }
General Comments 0
You need to be logged in to leave comments. Login now