##// END OF EJS Templates
phases: check HG_PENDING strictly...
FUJIWARA Katsunori -
r31053:6afd8a87 default
parent child Browse files
Show More
@@ -113,9 +113,9 from .node import (
113 113 short,
114 114 )
115 115 from . import (
116 encoding,
117 116 error,
118 117 smartset,
118 txnutil,
119 119 )
120 120
121 121 allphases = public, draft, secret = range(3)
@@ -137,15 +137,7 def _readroots(repo, phasedefaults=None)
137 137 dirty = False
138 138 roots = [set() for i in allphases]
139 139 try:
140 f = None
141 if 'HG_PENDING' in encoding.environ:
142 try:
143 f = repo.svfs('phaseroots.pending')
144 except IOError as inst:
145 if inst.errno != errno.ENOENT:
146 raise
147 if f is None:
148 f = repo.svfs('phaseroots')
140 f, pending = txnutil.trypending(repo.root, repo.svfs, 'phaseroots')
149 141 try:
150 142 for line in f:
151 143 phase, nh = line.split()
@@ -590,3 +590,47 because repo.cancopy() is False
590 590 crosschecking files in changesets and manifests
591 591 checking files
592 592 7 files, 8 changesets, 7 total revisions
593
594 $ cd ..
595
596 check whether HG_PENDING makes pending changes only in related
597 repositories visible to an external hook.
598
599 (emulate a transaction running concurrently by copied
600 .hg/phaseroots.pending in subsequent test)
601
602 $ cat > $TESTTMP/savepending.sh <<EOF
603 > cp .hg/store/phaseroots.pending .hg/store/phaseroots.pending.saved
604 > exit 1 # to avoid changing phase for subsequent tests
605 > EOF
606 $ cd push-dest
607 $ hg phase 6
608 6: draft
609 $ hg --config hooks.pretxnclose="sh $TESTTMP/savepending.sh" phase -f -s 6
610 transaction abort!
611 rollback completed
612 abort: pretxnclose hook exited with status 1
613 [255]
614 $ cp .hg/store/phaseroots.pending.saved .hg/store/phaseroots.pending
615
616 (check (in)visibility of phaseroot while transaction running in repo)
617
618 $ cat > $TESTTMP/checkpending.sh <<EOF
619 > echo '@initialrepo'
620 > hg -R $TESTTMP/initialrepo phase 7
621 > echo '@push-dest'
622 > hg -R $TESTTMP/push-dest phase 6
623 > exit 1 # to avoid changing phase for subsequent tests
624 > EOF
625 $ cd ../initialrepo
626 $ hg phase 7
627 7: public
628 $ hg --config hooks.pretxnclose="sh $TESTTMP/checkpending.sh" phase -f -s 7
629 @initialrepo
630 7: secret
631 @push-dest
632 6: draft
633 transaction abort!
634 rollback completed
635 abort: pretxnclose hook exited with status 1
636 [255]
General Comments 0
You need to be logged in to leave comments. Login now