##// END OF EJS Templates
localrepo: check HG_PENDING strictly...
FUJIWARA Katsunori -
r31054:59e69ed8 default
parent child Browse files
Show More
@@ -56,6 +56,7 b' from . import ('
56 56 subrepo,
57 57 tags as tagsmod,
58 58 transaction,
59 txnutil,
59 60 util,
60 61 )
61 62
@@ -513,10 +514,8 b' class localrepository(object):'
513 514 @storecache('00changelog.i')
514 515 def changelog(self):
515 516 c = changelog.changelog(self.svfs)
516 if 'HG_PENDING' in encoding.environ:
517 p = encoding.environ['HG_PENDING']
518 if p.startswith(self.root):
519 c.readpending('00changelog.i.a')
517 if txnutil.mayhavepending(self.root):
518 c.readpending('00changelog.i.a')
520 519 return c
521 520
522 521 def _constructmanifest(self):
@@ -832,6 +832,50 b' pretxnclose hook failure should abort th'
832 832 [1]
833 833 $ cd ..
834 834
835 check whether HG_PENDING makes pending changes only in related
836 repositories visible to an external hook.
837
838 (emulate a transaction running concurrently by copied
839 .hg/store/00changelog.i.a in subsequent test)
840
841 $ cat > $TESTTMP/savepending.sh <<EOF
842 > cp .hg/store/00changelog.i.a .hg/store/00changelog.i.a.saved
843 > exit 1 # to avoid adding new revision for subsequent tests
844 > EOF
845 $ cd a
846 $ hg tip -q
847 4:539e4b31b6dc
848 $ hg --config hooks.pretxnclose="sh $TESTTMP/savepending.sh" commit -m "invisible"
849 transaction abort!
850 rollback completed
851 abort: pretxnclose hook exited with status 1
852 [255]
853 $ cp .hg/store/00changelog.i.a.saved .hg/store/00changelog.i.a
854
855 (check (in)visibility of new changeset while transaction running in
856 repo)
857
858 $ cat > $TESTTMP/checkpending.sh <<EOF
859 > echo '@a'
860 > hg -R $TESTTMP/a tip -q
861 > echo '@a/nested'
862 > hg -R $TESTTMP/a/nested tip -q
863 > exit 1 # to avoid adding new revision for subsequent tests
864 > EOF
865 $ hg init nested
866 $ cd nested
867 $ echo a > a
868 $ hg add a
869 $ hg --config hooks.pretxnclose="sh $TESTTMP/checkpending.sh" commit -m '#0'
870 @a
871 4:539e4b31b6dc
872 @a/nested
873 0:bf5e395ced2c
874 transaction abort!
875 rollback completed
876 abort: pretxnclose hook exited with status 1
877 [255]
878
835 879 Hook from untrusted hgrc are reported as failure
836 880 ================================================
837 881
General Comments 0
You need to be logged in to leave comments. Login now