Show More
@@ -1,466 +1,466 b'' | |||||
1 | setup repo |
|
1 | setup repo | |
2 | $ hg init t |
|
2 | $ hg init t | |
3 | $ cd t |
|
3 | $ cd t | |
4 | $ echo a > a |
|
4 | $ echo a > a | |
5 | $ hg commit -Am'add a' |
|
5 | $ hg commit -Am'add a' | |
6 | adding a |
|
6 | adding a | |
7 | $ hg verify |
|
7 | $ hg verify | |
8 | checking changesets |
|
8 | checking changesets | |
9 | checking manifests |
|
9 | checking manifests | |
10 | crosschecking files in changesets and manifests |
|
10 | crosschecking files in changesets and manifests | |
11 | checking files |
|
11 | checking files | |
12 | 1 files, 1 changesets, 1 total revisions |
|
12 | 1 files, 1 changesets, 1 total revisions | |
13 | $ hg parents |
|
13 | $ hg parents | |
14 | changeset: 0:1f0dee641bb7 |
|
14 | changeset: 0:1f0dee641bb7 | |
15 | tag: tip |
|
15 | tag: tip | |
16 | user: test |
|
16 | user: test | |
17 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
17 | date: Thu Jan 01 00:00:00 1970 +0000 | |
18 | summary: add a |
|
18 | summary: add a | |
19 |
|
19 | |||
20 |
|
20 | |||
21 | rollback to null revision |
|
21 | rollback to null revision | |
22 | $ hg status |
|
22 | $ hg status | |
23 | $ hg rollback |
|
23 | $ hg rollback | |
24 | repository tip rolled back to revision -1 (undo commit) |
|
24 | repository tip rolled back to revision -1 (undo commit) | |
25 | working directory now based on revision -1 |
|
25 | working directory now based on revision -1 | |
26 | $ hg verify |
|
26 | $ hg verify | |
27 | checking changesets |
|
27 | checking changesets | |
28 | checking manifests |
|
28 | checking manifests | |
29 | crosschecking files in changesets and manifests |
|
29 | crosschecking files in changesets and manifests | |
30 | checking files |
|
30 | checking files | |
31 | 0 files, 0 changesets, 0 total revisions |
|
31 | 0 files, 0 changesets, 0 total revisions | |
32 | $ hg parents |
|
32 | $ hg parents | |
33 | $ hg status |
|
33 | $ hg status | |
34 | A a |
|
34 | A a | |
35 |
|
35 | |||
36 | Two changesets this time so we rollback to a real changeset |
|
36 | Two changesets this time so we rollback to a real changeset | |
37 | $ hg commit -m'add a again' |
|
37 | $ hg commit -m'add a again' | |
38 | $ echo a >> a |
|
38 | $ echo a >> a | |
39 | $ hg commit -m'modify a' |
|
39 | $ hg commit -m'modify a' | |
40 |
|
40 | |||
41 | Test issue 902 (current branch is preserved) |
|
41 | Test issue 902 (current branch is preserved) | |
42 | $ hg branch test |
|
42 | $ hg branch test | |
43 | marked working directory as branch test |
|
43 | marked working directory as branch test | |
44 | (branches are permanent and global, did you want a bookmark?) |
|
44 | (branches are permanent and global, did you want a bookmark?) | |
45 | $ hg rollback |
|
45 | $ hg rollback | |
46 | repository tip rolled back to revision 0 (undo commit) |
|
46 | repository tip rolled back to revision 0 (undo commit) | |
47 | working directory now based on revision 0 |
|
47 | working directory now based on revision 0 | |
48 | $ hg branch |
|
48 | $ hg branch | |
49 | default |
|
49 | default | |
50 |
|
50 | |||
51 | Test issue 1635 (commit message saved) |
|
51 | Test issue 1635 (commit message saved) | |
52 | $ cat .hg/last-message.txt ; echo |
|
52 | $ cat .hg/last-message.txt ; echo | |
53 | modify a |
|
53 | modify a | |
54 |
|
54 | |||
55 | Test rollback of hg before issue 902 was fixed |
|
55 | Test rollback of hg before issue 902 was fixed | |
56 |
|
56 | |||
57 | $ hg commit -m "test3" |
|
57 | $ hg commit -m "test3" | |
58 | $ hg branch test |
|
58 | $ hg branch test | |
59 | marked working directory as branch test |
|
59 | marked working directory as branch test | |
60 | (branches are permanent and global, did you want a bookmark?) |
|
60 | (branches are permanent and global, did you want a bookmark?) | |
61 | $ rm .hg/undo.branch |
|
61 | $ rm .hg/undo.branch | |
62 | $ hg rollback |
|
62 | $ hg rollback | |
63 | repository tip rolled back to revision 0 (undo commit) |
|
63 | repository tip rolled back to revision 0 (undo commit) | |
64 | named branch could not be reset: current branch is still 'test' |
|
64 | named branch could not be reset: current branch is still 'test' | |
65 | working directory now based on revision 0 |
|
65 | working directory now based on revision 0 | |
66 | $ hg branch |
|
66 | $ hg branch | |
67 | test |
|
67 | test | |
68 |
|
68 | |||
69 | working dir unaffected by rollback: do not restore dirstate et. al. |
|
69 | working dir unaffected by rollback: do not restore dirstate et. al. | |
70 | $ hg log --template '{rev} {branch} {desc|firstline}\n' |
|
70 | $ hg log --template '{rev} {branch} {desc|firstline}\n' | |
71 | 0 default add a again |
|
71 | 0 default add a again | |
72 | $ hg status |
|
72 | $ hg status | |
73 | M a |
|
73 | M a | |
74 | $ hg bookmark foo |
|
74 | $ hg bookmark foo | |
75 | $ hg commit -m'modify a again' |
|
75 | $ hg commit -m'modify a again' | |
76 | $ echo b > b |
|
76 | $ echo b > b | |
77 | $ hg bookmark bar -r default #making bar active, before the transaction |
|
77 | $ hg bookmark bar -r default #making bar active, before the transaction | |
78 | $ hg commit -Am'add b' |
|
78 | $ hg commit -Am'add b' | |
79 | adding b |
|
79 | adding b | |
80 | $ hg log --template '{rev} {branch} {desc|firstline}\n' |
|
80 | $ hg log --template '{rev} {branch} {desc|firstline}\n' | |
81 | 2 test add b |
|
81 | 2 test add b | |
82 | 1 test modify a again |
|
82 | 1 test modify a again | |
83 | 0 default add a again |
|
83 | 0 default add a again | |
84 | $ hg update bar |
|
84 | $ hg update bar | |
85 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
85 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
86 | (activating bookmark bar) |
|
86 | (activating bookmark bar) | |
87 | $ cat .hg/undo.branch ; echo |
|
87 | $ cat .hg/undo.branch ; echo | |
88 | test |
|
88 | test | |
89 | $ hg rollback -f |
|
89 | $ hg rollback -f | |
90 | repository tip rolled back to revision 1 (undo commit) |
|
90 | repository tip rolled back to revision 1 (undo commit) | |
91 | $ hg id -n |
|
91 | $ hg id -n | |
92 | 0 |
|
92 | 0 | |
93 | $ hg branch |
|
93 | $ hg branch | |
94 | default |
|
94 | default | |
95 | $ cat .hg/bookmarks.current ; echo |
|
95 | $ cat .hg/bookmarks.current ; echo | |
96 | bar |
|
96 | bar | |
97 | $ hg bookmark --delete foo bar |
|
97 | $ hg bookmark --delete foo bar | |
98 |
|
98 | |||
99 | rollback by pretxncommit saves commit message (issue1635) |
|
99 | rollback by pretxncommit saves commit message (issue1635) | |
100 |
|
100 | |||
101 | $ echo a >> a |
|
101 | $ echo a >> a | |
102 | $ hg --config hooks.pretxncommit=false commit -m"precious commit message" |
|
102 | $ hg --config hooks.pretxncommit=false commit -m"precious commit message" | |
103 | transaction abort! |
|
103 | transaction abort! | |
104 | rollback completed |
|
104 | rollback completed | |
105 | abort: pretxncommit hook exited with status * (glob) |
|
105 | abort: pretxncommit hook exited with status * (glob) | |
106 | [255] |
|
106 | [255] | |
107 | $ cat .hg/last-message.txt ; echo |
|
107 | $ cat .hg/last-message.txt ; echo | |
108 | precious commit message |
|
108 | precious commit message | |
109 |
|
109 | |||
110 | same thing, but run $EDITOR |
|
110 | same thing, but run $EDITOR | |
111 |
|
111 | |||
112 | $ cat > editor.sh << '__EOF__' |
|
112 | $ cat > editor.sh << '__EOF__' | |
113 | > echo "another precious commit message" > "$1" |
|
113 | > echo "another precious commit message" > "$1" | |
114 | > __EOF__ |
|
114 | > __EOF__ | |
115 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg --config hooks.pretxncommit=false commit 2>&1 |
|
115 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg --config hooks.pretxncommit=false commit 2>&1 | |
116 | note: commit message saved in .hg/last-message.txt |
|
116 | note: commit message saved in .hg/last-message.txt | |
117 | transaction abort! |
|
117 | transaction abort! | |
118 | rollback completed |
|
118 | rollback completed | |
119 | abort: pretxncommit hook exited with status * (glob) |
|
119 | abort: pretxncommit hook exited with status * (glob) | |
120 | [255] |
|
120 | [255] | |
121 | $ cat .hg/last-message.txt |
|
121 | $ cat .hg/last-message.txt | |
122 | another precious commit message |
|
122 | another precious commit message | |
123 |
|
123 | |||
124 | test rollback on served repository |
|
124 | test rollback on served repository | |
125 |
|
125 | |||
126 | #if serve |
|
126 | #if serve | |
127 | $ hg commit -m "precious commit message" |
|
127 | $ hg commit -m "precious commit message" | |
128 | $ hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log |
|
128 | $ hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log | |
129 | $ cat hg.pid >> $DAEMON_PIDS |
|
129 | $ cat hg.pid >> $DAEMON_PIDS | |
130 | $ cd .. |
|
130 | $ cd .. | |
131 | $ hg clone http://localhost:$HGPORT u |
|
131 | $ hg clone http://localhost:$HGPORT u | |
132 | requesting all changes |
|
132 | requesting all changes | |
133 | adding changesets |
|
133 | adding changesets | |
134 | adding manifests |
|
134 | adding manifests | |
135 | adding file changes |
|
135 | adding file changes | |
136 | added 3 changesets with 2 changes to 1 files (+1 heads) |
|
136 | added 3 changesets with 2 changes to 1 files (+1 heads) | |
137 | new changesets 23b0221f3370:068774709090 |
|
137 | new changesets 23b0221f3370:068774709090 | |
138 | updating to branch default |
|
138 | updating to branch default | |
139 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
139 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
140 | $ cd u |
|
140 | $ cd u | |
141 | $ hg id default |
|
141 | $ hg id default | |
142 | 068774709090 |
|
142 | 068774709090 | |
143 |
|
143 | |||
144 | now rollback and observe that 'hg serve' reloads the repository and |
|
144 | now rollback and observe that 'hg serve' reloads the repository and | |
145 | presents the correct tip changeset: |
|
145 | presents the correct tip changeset: | |
146 |
|
146 | |||
147 | $ hg -R ../t rollback |
|
147 | $ hg -R ../t rollback | |
148 | repository tip rolled back to revision 1 (undo commit) |
|
148 | repository tip rolled back to revision 1 (undo commit) | |
149 | working directory now based on revision 0 |
|
149 | working directory now based on revision 0 | |
150 | $ hg id default |
|
150 | $ hg id default | |
151 | 791dd2169706 |
|
151 | 791dd2169706 | |
152 |
|
152 | |||
153 | $ killdaemons.py |
|
153 | $ killdaemons.py | |
154 | #endif |
|
154 | #endif | |
155 |
|
155 | |||
156 | update to older changeset and then refuse rollback, because |
|
156 | update to older changeset and then refuse rollback, because | |
157 | that would lose data (issue2998) |
|
157 | that would lose data (issue2998) | |
158 | $ cd ../t |
|
158 | $ cd ../t | |
159 | $ hg -q update |
|
159 | $ hg -q update | |
160 | $ rm `hg status -un` |
|
160 | $ rm `hg status -un` | |
161 | $ template='{rev}:{node|short} [{branch}] {desc|firstline}\n' |
|
161 | $ template='{rev}:{node|short} [{branch}] {desc|firstline}\n' | |
162 | $ echo 'valuable new file' > b |
|
162 | $ echo 'valuable new file' > b | |
163 | $ echo 'valuable modification' >> a |
|
163 | $ echo 'valuable modification' >> a | |
164 | $ hg commit -A -m'a valuable change' |
|
164 | $ hg commit -A -m'a valuable change' | |
165 | adding b |
|
165 | adding b | |
166 | $ hg update 0 |
|
166 | $ hg update 0 | |
167 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
167 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
168 | $ hg rollback |
|
168 | $ hg rollback | |
169 | abort: rollback of last commit while not checked out may lose data |
|
169 | abort: rollback of last commit while not checked out may lose data | |
170 | (use -f to force) |
|
170 | (use -f to force) | |
171 | [255] |
|
171 | [255] | |
172 | $ hg tip -q |
|
172 | $ hg tip -q | |
173 | 2:4d9cd3795eea |
|
173 | 2:4d9cd3795eea | |
174 | $ hg rollback -f |
|
174 | $ hg rollback -f | |
175 | repository tip rolled back to revision 1 (undo commit) |
|
175 | repository tip rolled back to revision 1 (undo commit) | |
176 | $ hg status |
|
176 | $ hg status | |
177 | $ hg log --removed b # yep, it's gone |
|
177 | $ hg log --removed b # yep, it's gone | |
178 |
|
178 | |||
179 | same again, but emulate an old client that doesn't write undo.desc |
|
179 | same again, but emulate an old client that doesn't write undo.desc | |
180 | $ hg -q update |
|
180 | $ hg -q update | |
181 | $ echo 'valuable modification redux' >> a |
|
181 | $ echo 'valuable modification redux' >> a | |
182 | $ hg commit -m'a valuable change redux' |
|
182 | $ hg commit -m'a valuable change redux' | |
183 | $ rm .hg/undo.desc |
|
183 | $ rm .hg/undo.desc | |
184 | $ hg update 0 |
|
184 | $ hg update 0 | |
185 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
185 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
186 | $ hg rollback |
|
186 | $ hg rollback | |
187 | rolling back unknown transaction |
|
187 | rolling back unknown transaction | |
188 | $ cat a |
|
188 | $ cat a | |
189 | a |
|
189 | a | |
190 |
|
190 | |||
191 | corrupt journal test |
|
191 | corrupt journal test | |
192 | $ echo "foo" > .hg/store/journal |
|
192 | $ echo "foo" > .hg/store/journal | |
193 | $ hg recover |
|
193 | $ hg recover | |
194 | rolling back interrupted transaction |
|
194 | rolling back interrupted transaction | |
195 | couldn't read journal entry 'foo\n'! |
|
195 | couldn't read journal entry 'foo\n'! | |
196 | checking changesets |
|
196 | checking changesets | |
197 | checking manifests |
|
197 | checking manifests | |
198 | crosschecking files in changesets and manifests |
|
198 | crosschecking files in changesets and manifests | |
199 | checking files |
|
199 | checking files | |
200 | 1 files, 2 changesets, 2 total revisions |
|
200 | 1 files, 2 changesets, 2 total revisions | |
201 |
|
201 | |||
202 | rollback disabled by config |
|
202 | rollback disabled by config | |
203 | $ cat >> $HGRCPATH <<EOF |
|
203 | $ cat >> $HGRCPATH <<EOF | |
204 | > [ui] |
|
204 | > [ui] | |
205 | > rollback = false |
|
205 | > rollback = false | |
206 | > EOF |
|
206 | > EOF | |
207 | $ echo narf >> pinky-sayings.txt |
|
207 | $ echo narf >> pinky-sayings.txt | |
208 | $ hg add pinky-sayings.txt |
|
208 | $ hg add pinky-sayings.txt | |
209 | $ hg ci -m 'First one.' |
|
209 | $ hg ci -m 'First one.' | |
210 | $ hg rollback |
|
210 | $ hg rollback | |
211 | abort: rollback is disabled because it is unsafe |
|
211 | abort: rollback is disabled because it is unsafe | |
212 | (see `hg help -v rollback` for information) |
|
212 | (see `hg help -v rollback` for information) | |
213 | [255] |
|
213 | [255] | |
214 |
|
214 | |||
215 | $ cd .. |
|
215 | $ cd .. | |
216 |
|
216 | |||
217 | I/O errors on stdio are handled properly (issue5658) |
|
217 | I/O errors on stdio are handled properly (issue5658) | |
218 |
|
218 | |||
219 | $ cat > badui.py << EOF |
|
219 | $ cat > badui.py << EOF | |
220 | > import errno |
|
220 | > import errno | |
221 | > from mercurial.i18n import _ |
|
221 | > from mercurial.i18n import _ | |
222 | > from mercurial import ( |
|
222 | > from mercurial import ( | |
223 | > registrar, |
|
223 | > registrar, | |
224 | > error, |
|
224 | > error, | |
225 | > ui as uimod, |
|
225 | > ui as uimod, | |
226 | > ) |
|
226 | > ) | |
227 | > |
|
227 | > | |
228 | > configtable = {} |
|
228 | > configtable = {} | |
229 | > configitem = registrar.configitem(configtable) |
|
229 | > configitem = registrar.configitem(configtable) | |
230 | > |
|
230 | > | |
231 | > configitem('ui', 'ioerrors', |
|
231 | > configitem(b'ui', b'ioerrors', | |
232 | > default=list, |
|
232 | > default=list, | |
233 | > ) |
|
233 | > ) | |
234 | > |
|
234 | > | |
235 | > def pretxncommit(ui, repo, **kwargs): |
|
235 | > def pretxncommit(ui, repo, **kwargs): | |
236 | > ui.warn('warn during pretxncommit\n') |
|
236 | > ui.warn(b'warn during pretxncommit\n') | |
237 | > |
|
237 | > | |
238 | > def pretxnclose(ui, repo, **kwargs): |
|
238 | > def pretxnclose(ui, repo, **kwargs): | |
239 | > ui.warn('warn during pretxnclose\n') |
|
239 | > ui.warn(b'warn during pretxnclose\n') | |
240 | > |
|
240 | > | |
241 | > def txnclose(ui, repo, **kwargs): |
|
241 | > def txnclose(ui, repo, **kwargs): | |
242 | > ui.warn('warn during txnclose\n') |
|
242 | > ui.warn(b'warn during txnclose\n') | |
243 | > |
|
243 | > | |
244 | > def txnabort(ui, repo, **kwargs): |
|
244 | > def txnabort(ui, repo, **kwargs): | |
245 | > ui.warn('warn during abort\n') |
|
245 | > ui.warn(b'warn during abort\n') | |
246 | > |
|
246 | > | |
247 | > class fdproxy(object): |
|
247 | > class fdproxy(object): | |
248 | > def __init__(self, ui, o): |
|
248 | > def __init__(self, ui, o): | |
249 | > self._ui = ui |
|
249 | > self._ui = ui | |
250 | > self._o = o |
|
250 | > self._o = o | |
251 | > |
|
251 | > | |
252 | > def __getattr__(self, attr): |
|
252 | > def __getattr__(self, attr): | |
253 | > return getattr(self._o, attr) |
|
253 | > return getattr(self._o, attr) | |
254 | > |
|
254 | > | |
255 | > def write(self, msg): |
|
255 | > def write(self, msg): | |
256 | > errors = set(self._ui.configlist('ui', 'ioerrors')) |
|
256 | > errors = set(self._ui.configlist(b'ui', b'ioerrors')) | |
257 | > pretxncommit = msg == 'warn during pretxncommit\n' |
|
257 | > pretxncommit = msg == b'warn during pretxncommit\n' | |
258 | > pretxnclose = msg == 'warn during pretxnclose\n' |
|
258 | > pretxnclose = msg == b'warn during pretxnclose\n' | |
259 | > txnclose = msg == 'warn during txnclose\n' |
|
259 | > txnclose = msg == b'warn during txnclose\n' | |
260 | > txnabort = msg == 'warn during abort\n' |
|
260 | > txnabort = msg == b'warn during abort\n' | |
261 | > msgabort = msg == _('transaction abort!\n') |
|
261 | > msgabort = msg == _(b'transaction abort!\n') | |
262 | > msgrollback = msg == _('rollback completed\n') |
|
262 | > msgrollback = msg == _(b'rollback completed\n') | |
263 | > |
|
263 | > | |
264 | > if pretxncommit and 'pretxncommit' in errors: |
|
264 | > if pretxncommit and b'pretxncommit' in errors: | |
265 | > raise IOError(errno.EPIPE, 'simulated epipe') |
|
265 | > raise IOError(errno.EPIPE, 'simulated epipe') | |
266 | > if pretxnclose and 'pretxnclose' in errors: |
|
266 | > if pretxnclose and b'pretxnclose' in errors: | |
267 | > raise IOError(errno.EIO, 'simulated eio') |
|
267 | > raise IOError(errno.EIO, 'simulated eio') | |
268 | > if txnclose and 'txnclose' in errors: |
|
268 | > if txnclose and b'txnclose' in errors: | |
269 | > raise IOError(errno.EBADF, 'simulated badf') |
|
269 | > raise IOError(errno.EBADF, 'simulated badf') | |
270 | > if txnabort and 'txnabort' in errors: |
|
270 | > if txnabort and b'txnabort' in errors: | |
271 | > raise IOError(errno.EPIPE, 'simulated epipe') |
|
271 | > raise IOError(errno.EPIPE, 'simulated epipe') | |
272 | > if msgabort and 'msgabort' in errors: |
|
272 | > if msgabort and b'msgabort' in errors: | |
273 | > raise IOError(errno.EBADF, 'simulated ebadf') |
|
273 | > raise IOError(errno.EBADF, 'simulated ebadf') | |
274 | > if msgrollback and 'msgrollback' in errors: |
|
274 | > if msgrollback and b'msgrollback' in errors: | |
275 | > raise IOError(errno.EIO, 'simulated eio') |
|
275 | > raise IOError(errno.EIO, 'simulated eio') | |
276 | > |
|
276 | > | |
277 | > return self._o.write(msg) |
|
277 | > return self._o.write(msg) | |
278 | > |
|
278 | > | |
279 | > def uisetup(ui): |
|
279 | > def uisetup(ui): | |
280 | > class badui(ui.__class__): |
|
280 | > class badui(ui.__class__): | |
281 | > def write_err(self, *args, **kwargs): |
|
281 | > def write_err(self, *args, **kwargs): | |
282 | > olderr = self.ferr |
|
282 | > olderr = self.ferr | |
283 | > try: |
|
283 | > try: | |
284 | > self.ferr = fdproxy(self, olderr) |
|
284 | > self.ferr = fdproxy(self, olderr) | |
285 | > return super(badui, self).write_err(*args, **kwargs) |
|
285 | > return super(badui, self).write_err(*args, **kwargs) | |
286 | > finally: |
|
286 | > finally: | |
287 | > self.ferr = olderr |
|
287 | > self.ferr = olderr | |
288 | > |
|
288 | > | |
289 | > ui.__class__ = badui |
|
289 | > ui.__class__ = badui | |
290 | > |
|
290 | > | |
291 | > def reposetup(ui, repo): |
|
291 | > def reposetup(ui, repo): | |
292 | > ui.setconfig('hooks', 'pretxnclose.badui', pretxnclose, 'badui') |
|
292 | > ui.setconfig(b'hooks', b'pretxnclose.badui', pretxnclose, b'badui') | |
293 | > ui.setconfig('hooks', 'txnclose.badui', txnclose, 'badui') |
|
293 | > ui.setconfig(b'hooks', b'txnclose.badui', txnclose, b'badui') | |
294 | > ui.setconfig('hooks', 'pretxncommit.badui', pretxncommit, 'badui') |
|
294 | > ui.setconfig(b'hooks', b'pretxncommit.badui', pretxncommit, b'badui') | |
295 | > ui.setconfig('hooks', 'txnabort.badui', txnabort, 'badui') |
|
295 | > ui.setconfig(b'hooks', b'txnabort.badui', txnabort, b'badui') | |
296 | > EOF |
|
296 | > EOF | |
297 |
|
297 | |||
298 | $ cat >> $HGRCPATH << EOF |
|
298 | $ cat >> $HGRCPATH << EOF | |
299 | > [extensions] |
|
299 | > [extensions] | |
300 | > badui = $TESTTMP/badui.py |
|
300 | > badui = $TESTTMP/badui.py | |
301 | > EOF |
|
301 | > EOF | |
302 |
|
302 | |||
303 | An I/O error during pretxncommit is handled |
|
303 | An I/O error during pretxncommit is handled | |
304 |
|
304 | |||
305 | $ hg init ioerror-pretxncommit |
|
305 | $ hg init ioerror-pretxncommit | |
306 | $ cd ioerror-pretxncommit |
|
306 | $ cd ioerror-pretxncommit | |
307 | $ echo 0 > foo |
|
307 | $ echo 0 > foo | |
308 | $ hg -q commit -A -m initial |
|
308 | $ hg -q commit -A -m initial | |
309 | warn during pretxncommit |
|
309 | warn during pretxncommit | |
310 | warn during pretxnclose |
|
310 | warn during pretxnclose | |
311 | warn during txnclose |
|
311 | warn during txnclose | |
312 | $ echo 1 > foo |
|
312 | $ echo 1 > foo | |
313 | $ hg --config ui.ioerrors=pretxncommit commit -m 'error during pretxncommit' |
|
313 | $ hg --config ui.ioerrors=pretxncommit commit -m 'error during pretxncommit' | |
314 | warn during pretxnclose |
|
314 | warn during pretxnclose | |
315 | warn during txnclose |
|
315 | warn during txnclose | |
316 |
|
316 | |||
317 | $ hg commit -m 'commit 1' |
|
317 | $ hg commit -m 'commit 1' | |
318 | nothing changed |
|
318 | nothing changed | |
319 | [1] |
|
319 | [1] | |
320 |
|
320 | |||
321 | $ cd .. |
|
321 | $ cd .. | |
322 |
|
322 | |||
323 | An I/O error during pretxnclose is handled |
|
323 | An I/O error during pretxnclose is handled | |
324 |
|
324 | |||
325 | $ hg init ioerror-pretxnclose |
|
325 | $ hg init ioerror-pretxnclose | |
326 | $ cd ioerror-pretxnclose |
|
326 | $ cd ioerror-pretxnclose | |
327 | $ echo 0 > foo |
|
327 | $ echo 0 > foo | |
328 | $ hg -q commit -A -m initial |
|
328 | $ hg -q commit -A -m initial | |
329 | warn during pretxncommit |
|
329 | warn during pretxncommit | |
330 | warn during pretxnclose |
|
330 | warn during pretxnclose | |
331 | warn during txnclose |
|
331 | warn during txnclose | |
332 |
|
332 | |||
333 | $ echo 1 > foo |
|
333 | $ echo 1 > foo | |
334 | $ hg --config ui.ioerrors=pretxnclose commit -m 'error during pretxnclose' |
|
334 | $ hg --config ui.ioerrors=pretxnclose commit -m 'error during pretxnclose' | |
335 | warn during pretxncommit |
|
335 | warn during pretxncommit | |
336 | warn during txnclose |
|
336 | warn during txnclose | |
337 |
|
337 | |||
338 | $ hg commit -m 'commit 1' |
|
338 | $ hg commit -m 'commit 1' | |
339 | nothing changed |
|
339 | nothing changed | |
340 | [1] |
|
340 | [1] | |
341 |
|
341 | |||
342 | $ cd .. |
|
342 | $ cd .. | |
343 |
|
343 | |||
344 | An I/O error during txnclose is handled |
|
344 | An I/O error during txnclose is handled | |
345 |
|
345 | |||
346 | $ hg init ioerror-txnclose |
|
346 | $ hg init ioerror-txnclose | |
347 | $ cd ioerror-txnclose |
|
347 | $ cd ioerror-txnclose | |
348 | $ echo 0 > foo |
|
348 | $ echo 0 > foo | |
349 | $ hg -q commit -A -m initial |
|
349 | $ hg -q commit -A -m initial | |
350 | warn during pretxncommit |
|
350 | warn during pretxncommit | |
351 | warn during pretxnclose |
|
351 | warn during pretxnclose | |
352 | warn during txnclose |
|
352 | warn during txnclose | |
353 |
|
353 | |||
354 | $ echo 1 > foo |
|
354 | $ echo 1 > foo | |
355 | $ hg --config ui.ioerrors=txnclose commit -m 'error during txnclose' |
|
355 | $ hg --config ui.ioerrors=txnclose commit -m 'error during txnclose' | |
356 | warn during pretxncommit |
|
356 | warn during pretxncommit | |
357 | warn during pretxnclose |
|
357 | warn during pretxnclose | |
358 |
|
358 | |||
359 | $ hg commit -m 'commit 1' |
|
359 | $ hg commit -m 'commit 1' | |
360 | nothing changed |
|
360 | nothing changed | |
361 | [1] |
|
361 | [1] | |
362 |
|
362 | |||
363 | $ cd .. |
|
363 | $ cd .. | |
364 |
|
364 | |||
365 | An I/O error writing "transaction abort" is handled |
|
365 | An I/O error writing "transaction abort" is handled | |
366 |
|
366 | |||
367 | $ hg init ioerror-msgabort |
|
367 | $ hg init ioerror-msgabort | |
368 | $ cd ioerror-msgabort |
|
368 | $ cd ioerror-msgabort | |
369 |
|
369 | |||
370 | $ echo 0 > foo |
|
370 | $ echo 0 > foo | |
371 | $ hg -q commit -A -m initial |
|
371 | $ hg -q commit -A -m initial | |
372 | warn during pretxncommit |
|
372 | warn during pretxncommit | |
373 | warn during pretxnclose |
|
373 | warn during pretxnclose | |
374 | warn during txnclose |
|
374 | warn during txnclose | |
375 |
|
375 | |||
376 | $ echo 1 > foo |
|
376 | $ echo 1 > foo | |
377 | $ hg --config ui.ioerrors=msgabort --config hooks.pretxncommit=false commit -m 'error during abort message' |
|
377 | $ hg --config ui.ioerrors=msgabort --config hooks.pretxncommit=false commit -m 'error during abort message' | |
378 | warn during abort |
|
378 | warn during abort | |
379 | rollback completed |
|
379 | rollback completed | |
380 | abort: pretxncommit hook exited with status 1 |
|
380 | abort: pretxncommit hook exited with status 1 | |
381 | [255] |
|
381 | [255] | |
382 |
|
382 | |||
383 | $ hg commit -m 'commit 1' |
|
383 | $ hg commit -m 'commit 1' | |
384 | warn during pretxncommit |
|
384 | warn during pretxncommit | |
385 | warn during pretxnclose |
|
385 | warn during pretxnclose | |
386 | warn during txnclose |
|
386 | warn during txnclose | |
387 |
|
387 | |||
388 | $ cd .. |
|
388 | $ cd .. | |
389 |
|
389 | |||
390 | An I/O error during txnabort should still result in rollback |
|
390 | An I/O error during txnabort should still result in rollback | |
391 |
|
391 | |||
392 | $ hg init ioerror-txnabort |
|
392 | $ hg init ioerror-txnabort | |
393 | $ cd ioerror-txnabort |
|
393 | $ cd ioerror-txnabort | |
394 |
|
394 | |||
395 | $ echo 0 > foo |
|
395 | $ echo 0 > foo | |
396 | $ hg -q commit -A -m initial |
|
396 | $ hg -q commit -A -m initial | |
397 | warn during pretxncommit |
|
397 | warn during pretxncommit | |
398 | warn during pretxnclose |
|
398 | warn during pretxnclose | |
399 | warn during txnclose |
|
399 | warn during txnclose | |
400 |
|
400 | |||
401 | $ echo 1 > foo |
|
401 | $ echo 1 > foo | |
402 | $ hg --config ui.ioerrors=txnabort --config hooks.pretxncommit=false commit -m 'error during abort' |
|
402 | $ hg --config ui.ioerrors=txnabort --config hooks.pretxncommit=false commit -m 'error during abort' | |
403 | transaction abort! |
|
403 | transaction abort! | |
404 | rollback completed |
|
404 | rollback completed | |
405 | abort: pretxncommit hook exited with status 1 |
|
405 | abort: pretxncommit hook exited with status 1 | |
406 | [255] |
|
406 | [255] | |
407 |
|
407 | |||
408 | $ hg commit -m 'commit 1' |
|
408 | $ hg commit -m 'commit 1' | |
409 | warn during pretxncommit |
|
409 | warn during pretxncommit | |
410 | warn during pretxnclose |
|
410 | warn during pretxnclose | |
411 | warn during txnclose |
|
411 | warn during txnclose | |
412 |
|
412 | |||
413 | $ cd .. |
|
413 | $ cd .. | |
414 |
|
414 | |||
415 | An I/O error writing "rollback completed" is handled |
|
415 | An I/O error writing "rollback completed" is handled | |
416 |
|
416 | |||
417 | $ hg init ioerror-msgrollback |
|
417 | $ hg init ioerror-msgrollback | |
418 | $ cd ioerror-msgrollback |
|
418 | $ cd ioerror-msgrollback | |
419 |
|
419 | |||
420 | $ echo 0 > foo |
|
420 | $ echo 0 > foo | |
421 | $ hg -q commit -A -m initial |
|
421 | $ hg -q commit -A -m initial | |
422 | warn during pretxncommit |
|
422 | warn during pretxncommit | |
423 | warn during pretxnclose |
|
423 | warn during pretxnclose | |
424 | warn during txnclose |
|
424 | warn during txnclose | |
425 |
|
425 | |||
426 | $ echo 1 > foo |
|
426 | $ echo 1 > foo | |
427 |
|
427 | |||
428 | $ hg --config ui.ioerrors=msgrollback --config hooks.pretxncommit=false commit -m 'error during rollback message' |
|
428 | $ hg --config ui.ioerrors=msgrollback --config hooks.pretxncommit=false commit -m 'error during rollback message' | |
429 | transaction abort! |
|
429 | transaction abort! | |
430 | warn during abort |
|
430 | warn during abort | |
431 | abort: pretxncommit hook exited with status 1 |
|
431 | abort: pretxncommit hook exited with status 1 | |
432 | [255] |
|
432 | [255] | |
433 |
|
433 | |||
434 | $ hg verify |
|
434 | $ hg verify | |
435 | checking changesets |
|
435 | checking changesets | |
436 | checking manifests |
|
436 | checking manifests | |
437 | crosschecking files in changesets and manifests |
|
437 | crosschecking files in changesets and manifests | |
438 | checking files |
|
438 | checking files | |
439 | 1 files, 1 changesets, 1 total revisions |
|
439 | 1 files, 1 changesets, 1 total revisions | |
440 |
|
440 | |||
441 | $ cd .. |
|
441 | $ cd .. | |
442 |
|
442 | |||
443 | Multiple I/O errors after transaction open are handled. |
|
443 | Multiple I/O errors after transaction open are handled. | |
444 | This is effectively what happens if a peer disconnects in the middle |
|
444 | This is effectively what happens if a peer disconnects in the middle | |
445 | of a transaction. |
|
445 | of a transaction. | |
446 |
|
446 | |||
447 | $ hg init ioerror-multiple |
|
447 | $ hg init ioerror-multiple | |
448 | $ cd ioerror-multiple |
|
448 | $ cd ioerror-multiple | |
449 | $ echo 0 > foo |
|
449 | $ echo 0 > foo | |
450 | $ hg -q commit -A -m initial |
|
450 | $ hg -q commit -A -m initial | |
451 | warn during pretxncommit |
|
451 | warn during pretxncommit | |
452 | warn during pretxnclose |
|
452 | warn during pretxnclose | |
453 | warn during txnclose |
|
453 | warn during txnclose | |
454 |
|
454 | |||
455 | $ echo 1 > foo |
|
455 | $ echo 1 > foo | |
456 |
|
456 | |||
457 | $ hg --config ui.ioerrors=pretxncommit,pretxnclose,txnclose,txnabort,msgabort,msgrollback commit -m 'multiple errors' |
|
457 | $ hg --config ui.ioerrors=pretxncommit,pretxnclose,txnclose,txnabort,msgabort,msgrollback commit -m 'multiple errors' | |
458 |
|
458 | |||
459 | $ hg verify |
|
459 | $ hg verify | |
460 | checking changesets |
|
460 | checking changesets | |
461 | checking manifests |
|
461 | checking manifests | |
462 | crosschecking files in changesets and manifests |
|
462 | crosschecking files in changesets and manifests | |
463 | checking files |
|
463 | checking files | |
464 | 1 files, 2 changesets, 2 total revisions |
|
464 | 1 files, 2 changesets, 2 total revisions | |
465 |
|
465 | |||
466 | $ cd .. |
|
466 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now