##// END OF EJS Templates
transaction: quietly rollback if no other changes than temporary files...
marmoute -
r50890:27fd12ec default
parent child Browse files
Show More
@@ -691,13 +691,22 b' class transaction(util.transactional):'
691 True if nothing, except temporary files has been writen on disk."""
691 True if nothing, except temporary files has been writen on disk."""
692 if entries:
692 if entries:
693 return False
693 return False
694 if self._backupentries:
694 for e in self._backupentries:
695 return False
695 if e[1]:
696 return False
696 return True
697 return True
697
698
698 def _do_quick_abort(self, entries):
699 def _do_quick_abort(self, entries):
699 """(Silently) do a quick cleanup (see _can_quick_abort)"""
700 """(Silently) do a quick cleanup (see _can_quick_abort)"""
700 assert self._can_quick_abort(entries)
701 assert self._can_quick_abort(entries)
702 tmp_files = [e for e in self._backupentries if not e[1]]
703 for vfs_id, old_path, tmp_path, xxx in tmp_files:
704 assert not old_path
705 vfs = self._vfsmap[vfs_id]
706 try:
707 vfs.unlink(tmp_path)
708 except FileNotFoundError:
709 pass
701 if self._backupjournal:
710 if self._backupjournal:
702 self._opener.unlink(self._backupjournal)
711 self._opener.unlink(self._backupjournal)
703 if self._journal:
712 if self._journal:
@@ -1126,8 +1126,6 b' repositories visible to an external hook'
1126 $ hg add a
1126 $ hg add a
1127 $ hg commit -m '#0'
1127 $ hg commit -m '#0'
1128 $ hg --config hooks.pretxnclose="sh $TESTTMP/savepending.sh" bookmarks INVISIBLE
1128 $ hg --config hooks.pretxnclose="sh $TESTTMP/savepending.sh" bookmarks INVISIBLE
1129 transaction abort!
1130 rollback completed
1131 abort: pretxnclose hook exited with status 1
1129 abort: pretxnclose hook exited with status 1
1132 [40]
1130 [40]
1133 $ cp .hg/bookmarks.pending.saved .hg/bookmarks.pending
1131 $ cp .hg/bookmarks.pending.saved .hg/bookmarks.pending
@@ -1159,8 +1157,6 b' repositories visible to an external hook'
1159 x y 2:db815d6d32e6
1157 x y 2:db815d6d32e6
1160 @unrelated
1158 @unrelated
1161 no bookmarks set
1159 no bookmarks set
1162 transaction abort!
1163 rollback completed
1164 abort: pretxnclose hook exited with status 1
1160 abort: pretxnclose hook exited with status 1
1165 [40]
1161 [40]
1166
1162
@@ -1243,8 +1239,6 b' add hooks:'
1243 attempt to create on a default changeset
1239 attempt to create on a default changeset
1244
1240
1245 $ hg bookmark -r 81dcce76aa0b NEW
1241 $ hg bookmark -r 81dcce76aa0b NEW
1246 transaction abort!
1247 rollback completed
1248 abort: pretxnclose-bookmark.force-public hook exited with status 1
1242 abort: pretxnclose-bookmark.force-public hook exited with status 1
1249 [40]
1243 [40]
1250
1244
@@ -1255,7 +1249,5 b' create on a public changeset'
1255 move to the other branch
1249 move to the other branch
1256
1250
1257 $ hg bookmark -f -r 125c9a1d6df6 NEW
1251 $ hg bookmark -f -r 125c9a1d6df6 NEW
1258 transaction abort!
1259 rollback completed
1260 abort: pretxnclose-bookmark.force-forward hook exited with status 1
1252 abort: pretxnclose-bookmark.force-forward hook exited with status 1
1261 [40]
1253 [40]
@@ -818,8 +818,6 b' repositories visible to an external hook'
818 $ hg phase 6
818 $ hg phase 6
819 6: draft
819 6: draft
820 $ hg --config hooks.pretxnclose="sh $TESTTMP/savepending.sh" phase -f -s 6
820 $ hg --config hooks.pretxnclose="sh $TESTTMP/savepending.sh" phase -f -s 6
821 transaction abort!
822 rollback completed
823 abort: pretxnclose hook exited with status 1
821 abort: pretxnclose hook exited with status 1
824 [40]
822 [40]
825 $ cp .hg/store/phaseroots.pending.saved .hg/store/phaseroots.pending
823 $ cp .hg/store/phaseroots.pending.saved .hg/store/phaseroots.pending
@@ -841,8 +839,6 b' repositories visible to an external hook'
841 7: secret
839 7: secret
842 @push-dest
840 @push-dest
843 6: draft
841 6: draft
844 transaction abort!
845 rollback completed
846 abort: pretxnclose hook exited with status 1
842 abort: pretxnclose hook exited with status 1
847 [40]
843 [40]
848
844
@@ -915,13 +911,9 b' Install a hook that prevent b3325c91a4d9'
915 Try various actions. only the draft move should succeed
911 Try various actions. only the draft move should succeed
916
912
917 $ hg phase --public b3325c91a4d9
913 $ hg phase --public b3325c91a4d9
918 transaction abort!
919 rollback completed
920 abort: pretxnclose-phase.nopublish_D hook exited with status 1
914 abort: pretxnclose-phase.nopublish_D hook exited with status 1
921 [40]
915 [40]
922 $ hg phase --public a603bfb5a83e
916 $ hg phase --public a603bfb5a83e
923 transaction abort!
924 rollback completed
925 abort: pretxnclose-phase.nopublish_D hook exited with status 1
917 abort: pretxnclose-phase.nopublish_D hook exited with status 1
926 [40]
918 [40]
927 $ hg phase --draft 17a481b3bccb
919 $ hg phase --draft 17a481b3bccb
@@ -932,8 +924,6 b' Try various actions. only the draft move'
932 test-hook-close-phase: a603bfb5a83e312131cebcd05353c217d4d21dde: secret -> draft
924 test-hook-close-phase: a603bfb5a83e312131cebcd05353c217d4d21dde: secret -> draft
933 test-hook-close-phase: 17a481b3bccb796c0521ae97903d81c52bfee4af: secret -> draft
925 test-hook-close-phase: 17a481b3bccb796c0521ae97903d81c52bfee4af: secret -> draft
934 $ hg phase --public 17a481b3bccb
926 $ hg phase --public 17a481b3bccb
935 transaction abort!
936 rollback completed
937 abort: pretxnclose-phase.nopublish_D hook exited with status 1
927 abort: pretxnclose-phase.nopublish_D hook exited with status 1
938 [40]
928 [40]
939
929
@@ -168,8 +168,6 b' rebase can then be continued'
168 rebasing 1:112478962961 B "B"
168 rebasing 1:112478962961 B "B"
169 rebasing 3:26805aba1e60 C "C"
169 rebasing 3:26805aba1e60 C "C"
170 rebasing 5:f585351a92f8 D tip "D"
170 rebasing 5:f585351a92f8 D tip "D"
171 transaction abort!
172 rollback completed
173 abort: edit failed: false exited with status 1
171 abort: edit failed: false exited with status 1
174 [250]
172 [250]
175 $ hg tglog
173 $ hg tglog
@@ -99,8 +99,6 b' Therefore, this test scenario ignores ch'
99 bm2 2:c2e0ac586386 (svfs !)
99 bm2 2:c2e0ac586386 (svfs !)
100 * bm3 2:c2e0ac586386
100 * bm3 2:c2e0ac586386
101 bmX 2:c2e0ac586386 (vfs !)
101 bmX 2:c2e0ac586386 (vfs !)
102 transaction abort!
103 rollback completed
104 abort: pretxnclose hook exited with status 1
102 abort: pretxnclose hook exited with status 1
105 [40]
103 [40]
106 $ hg book bm1
104 $ hg book bm1
@@ -124,8 +122,6 b' src), because (1) HG_PENDING refers only'
124 bm2 2:c2e0ac586386 (svfs !)
122 bm2 2:c2e0ac586386 (svfs !)
125 bm3 2:c2e0ac586386
123 bm3 2:c2e0ac586386
126 * bmX 2:c2e0ac586386
124 * bmX 2:c2e0ac586386
127 transaction abort!
128 rollback completed
129 abort: pretxnclose hook exited with status 1
125 abort: pretxnclose hook exited with status 1
130 [40]
126 [40]
131 $ hg book bm3
127 $ hg book bm3
@@ -156,8 +156,6 b' was always recording three commits, one '
156 record change 3/3 to 'a'?
156 record change 3/3 to 'a'?
157 (enter ? for help) [Ynesfdaq?] y
157 (enter ? for help) [Ynesfdaq?] y
158
158
159 transaction abort!
160 rollback completed
161 abort: edit failed: false exited with status 1
159 abort: edit failed: false exited with status 1
162 [250]
160 [250]
163 $ hg status
161 $ hg status
General Comments 0
You need to be logged in to leave comments. Login now