comparison tests/test-hook.t @ 14102:7f45b1911893

pushkey: add hooks for pushkey/listkeys
author Brodie Rao <brodie@bitheap.org>
date Sun, 01 May 2011 11:12:36 +0200
parents 0fb2ff949790
children cb98fed52495
comparison
equal deleted inserted replaced
14101:0c5228836fcd 14102:7f45b1911893
166 $ hg update 166 $ hg update
167 preupdate hook: HG_PARENT1=539e4b31b6dc 167 preupdate hook: HG_PARENT1=539e4b31b6dc
168 update hook: HG_ERROR=0 HG_PARENT1=539e4b31b6dc 168 update hook: HG_ERROR=0 HG_PARENT1=539e4b31b6dc
169 2 files updated, 0 files merged, 0 files removed, 0 files unresolved 169 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
170 170
171 pushkey hook
172
173 $ echo 'pushkey = python "$TESTDIR"/printenv.py pushkey' >> .hg/hgrc
174 $ cd ../b
175 $ hg bookmark -r null foo
176 $ hg push -B foo ../a
177 pushing to ../a
178 searching for changes
179 no changes found
180 exporting bookmark foo
181 pushkey hook: HG_KEY=foo HG_NAMESPACE=bookmarks HG_NEW=0000000000000000000000000000000000000000 HG_RET=1
182 $ cd ../a
183
184 listkeys hook
185
186 $ echo 'listkeys = python "$TESTDIR"/printenv.py listkeys' >> .hg/hgrc
187 $ hg bookmark -r null bar
188 $ cd ../b
189 $ hg pull -B bar ../a
190 pulling from ../a
191 listkeys hook: HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'}
192 searching for changes
193 listkeys hook: HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'}
194 importing bookmark bar
195 $ cd ../a
196
197 test that prepushkey can prevent incoming keys
198
199 $ echo 'prepushkey = python "$TESTDIR"/printenv.py prepushkey.forbid 1' >> .hg/hgrc
200 $ cd ../b
201 $ hg bookmark -r null baz
202 $ hg push -B baz ../a
203 pushing to ../a
204 searching for changes
205 no changes found
206 listkeys hook: HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'}
207 listkeys hook: HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'}
208 exporting bookmark baz
209 prepushkey.forbid hook: HG_KEY=baz HG_NAMESPACE=bookmarks HG_NEW=0000000000000000000000000000000000000000
210 abort: prepushkey hook exited with status 1
211 [255]
212 $ cd ../a
213
214 test that prelistkeys can prevent listing keys
215
216 $ echo 'prelistkeys = python "$TESTDIR"/printenv.py prelistkeys.forbid 1' >> .hg/hgrc
217 $ hg bookmark -r null quux
218 $ cd ../b
219 $ hg pull -B quux ../a
220 pulling from ../a
221 prelistkeys.forbid hook: HG_NAMESPACE=bookmarks
222 abort: prelistkeys hook exited with status 1
223 [255]
224 $ cd ../a
225
171 prechangegroup hook can prevent incoming changes 226 prechangegroup hook can prevent incoming changes
172 227
173 $ cd ../b 228 $ cd ../b
174 $ hg -q tip 229 $ hg -q tip
175 3:07f3376c1e65 230 3:07f3376c1e65