comparison tests/test-backout.t @ 26751:520defbc0335

hook: centralize passing HG_PENDING to external hook process This patch centralizes passing HG_PENDING to external hook process into '_exthook()'. To make in-memory changes visible to external hook process, this patch does: - write (or schedule to write) in-memory dirstate changes, and - set HG_PENDING environment variable, if: - a transaction is running, and - there are in-memory changes to be visible This patch tests some commands with some hooks, because transaction activity of a same hook differs from each other ("---": "not tested"). ======== ========= ========= ============ command preupdate precommit pretxncommit ======== ========= ========= ============ unshelve o --- --- backout x --- --- import --- o o qrefresh --- x o ======== ========= ========= ============ Each hooks are examined separately to prevent in-memory changes from being visible to external process accidentally by side effect of hooks previously invoked.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Sat, 17 Oct 2015 01:15:34 +0900
parents d8463a743d7d
children 949e8c626d19
comparison
equal deleted inserted replaced
26750:9f9ec4abe700 26751:520defbc0335
256 256
257 $ cat a 257 $ cat a
258 line 1 258 line 1
259 line 2 259 line 2
260 line 3 260 line 3
261
262 Test visibility of in-memory dirstate changes outside transaction to
263 external hook process
264
265 $ cat > $TESTTMP/checkvisibility.sh <<EOF
266 > echo "==== \$1:"
267 > hg parents --template "{rev}:{node|short}\n"
268 > echo "===="
269 > EOF
270
271 "hg backout --merge REV1" at REV2 below implies steps below:
272
273 (1) update to REV1 (REV2 => REV1)
274 (2) revert by REV1^1
275 (3) commit backnig out revision (REV3)
276 (4) update to REV2 (REV3 => REV2)
277 (5) merge with REV3 (REV2 => REV2, REV3)
278
279 == test visibility to external preupdate hook
280
281 $ hg update -q -C 2
282 $ hg --config extensions.strip= strip 3
283 saved backup bundle to * (glob)
284
285 $ cat >> .hg/hgrc <<EOF
286 > [hooks]
287 > preupdate.visibility = sh $TESTTMP/checkvisibility.sh preupdate
288 > EOF
289
290 ("-m" is needed to avoid writing dirstte changes out at other than
291 invocation of the hook to be examined)
292
293 $ hg backout --merge -d '3 0' 1 --tool=true -m 'fixed comment'
294 ==== preupdate:
295 2:6ea3f2a197a2
296 ====
297 reverting a
298 created new head
299 changeset 3:d92a3f57f067 backs out changeset 1:5a50a024c182
300 ==== preupdate:
301 3:d92a3f57f067
302 ====
303 merging with changeset 3:d92a3f57f067
304 ==== preupdate:
305 2:6ea3f2a197a2
306 ====
307 merging a
308 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
309 (branch merge, don't forget to commit)
310
311 $ cat >> .hg/hgrc <<EOF
312 > [hooks]
313 > preupdate.visibility =
314 > EOF
261 315
262 $ cd .. 316 $ cd ..
263 317
264 backout should not back out subsequent changesets 318 backout should not back out subsequent changesets
265 319