Mercurial > hg-stable
annotate tests/test-rollback.t @ 50499:63dc24be635d
transaction: use a ".bck" extension for all backup file
There are too much code in Mercurial that assume file function from extension.
Keeping the original extension when doing backup is just creating confusion
(for exemple, backup of revlog's confused with new version revlogs).
So we change the backup name from now on to be explicilty backup file and
prevent this kind of problem.
(note that repository using fncache is less affected (but still affected) by
this kind of problem as the backup are not listed in the fncache).
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 15 May 2023 08:54:47 +0200 |
parents | 11e6eee4b063 |
children |
rev | line source |
---|---|
15108
4c1ec0fe59d6
test-rollback: tinker a bit to make it easier to add more tests.
Greg Ward <greg@gerg.ca>
parents:
13959
diff
changeset
|
1 setup repo |
13956
ffb5c09ba822
tests: remove redundant mkdir
Martin Geisler <mg@lazybytes.net>
parents:
13446
diff
changeset
|
2 $ hg init t |
12485
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
3 $ cd t |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
4 $ echo a > a |
50042
dbcc45221c1f
test: explicitly "add" file before some commit in test-rollback.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49920
diff
changeset
|
5 $ hg add a |
dbcc45221c1f
test: explicitly "add" file before some commit in test-rollback.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
49920
diff
changeset
|
6 $ hg commit -m 'add a' |
49920
2f2682f40ea0
tests: use the `--quiet` flag for verify when applicable
Raphaël Gomès <rgomes@octobus.net>
parents:
46485
diff
changeset
|
7 $ hg verify -q |
12485
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
8 $ hg parents |
15108
4c1ec0fe59d6
test-rollback: tinker a bit to make it easier to add more tests.
Greg Ward <greg@gerg.ca>
parents:
13959
diff
changeset
|
9 changeset: 0:1f0dee641bb7 |
12485
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
10 tag: tip |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
11 user: test |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
12 date: Thu Jan 01 00:00:00 1970 +0000 |
15108
4c1ec0fe59d6
test-rollback: tinker a bit to make it easier to add more tests.
Greg Ward <greg@gerg.ca>
parents:
13959
diff
changeset
|
13 summary: add a |
12485
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
14 |
15108
4c1ec0fe59d6
test-rollback: tinker a bit to make it easier to add more tests.
Greg Ward <greg@gerg.ca>
parents:
13959
diff
changeset
|
15 |
4c1ec0fe59d6
test-rollback: tinker a bit to make it easier to add more tests.
Greg Ward <greg@gerg.ca>
parents:
13959
diff
changeset
|
16 rollback to null revision |
12485
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
17 $ hg status |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
18 $ hg rollback |
13446
1e497df514e2
rollback: clarifies the message about the reverted state (issue2628)
Gilles Moris <gilles.moris@free.fr>
parents:
13185
diff
changeset
|
19 repository tip rolled back to revision -1 (undo commit) |
1e497df514e2
rollback: clarifies the message about the reverted state (issue2628)
Gilles Moris <gilles.moris@free.fr>
parents:
13185
diff
changeset
|
20 working directory now based on revision -1 |
49920
2f2682f40ea0
tests: use the `--quiet` flag for verify when applicable
Raphaël Gomès <rgomes@octobus.net>
parents:
46485
diff
changeset
|
21 $ hg verify -q |
12485
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
22 $ hg parents |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
23 $ hg status |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
24 A a |
5814
dd5a501cb97f
restore branch after rollback (issue 902)
Alexandre Vassalotti <mercurial-bugs@selenic.com>
parents:
2227
diff
changeset
|
25 |
15108
4c1ec0fe59d6
test-rollback: tinker a bit to make it easier to add more tests.
Greg Ward <greg@gerg.ca>
parents:
13959
diff
changeset
|
26 Two changesets this time so we rollback to a real changeset |
4c1ec0fe59d6
test-rollback: tinker a bit to make it easier to add more tests.
Greg Ward <greg@gerg.ca>
parents:
13959
diff
changeset
|
27 $ hg commit -m'add a again' |
4c1ec0fe59d6
test-rollback: tinker a bit to make it easier to add more tests.
Greg Ward <greg@gerg.ca>
parents:
13959
diff
changeset
|
28 $ echo a >> a |
4c1ec0fe59d6
test-rollback: tinker a bit to make it easier to add more tests.
Greg Ward <greg@gerg.ca>
parents:
13959
diff
changeset
|
29 $ hg commit -m'modify a' |
12485
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
30 |
15108
4c1ec0fe59d6
test-rollback: tinker a bit to make it easier to add more tests.
Greg Ward <greg@gerg.ca>
parents:
13959
diff
changeset
|
31 Test issue 902 (current branch is preserved) |
12485
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
32 $ hg branch test |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
33 marked working directory as branch test |
15615 | 34 (branches are permanent and global, did you want a bookmark?) |
12485
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
35 $ hg rollback |
15108
4c1ec0fe59d6
test-rollback: tinker a bit to make it easier to add more tests.
Greg Ward <greg@gerg.ca>
parents:
13959
diff
changeset
|
36 repository tip rolled back to revision 0 (undo commit) |
4c1ec0fe59d6
test-rollback: tinker a bit to make it easier to add more tests.
Greg Ward <greg@gerg.ca>
parents:
13959
diff
changeset
|
37 working directory now based on revision 0 |
12485
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
38 $ hg branch |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
39 default |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
40 |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
41 Test issue 1635 (commit message saved) |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
42 $ cat .hg/last-message.txt ; echo |
15108
4c1ec0fe59d6
test-rollback: tinker a bit to make it easier to add more tests.
Greg Ward <greg@gerg.ca>
parents:
13959
diff
changeset
|
43 modify a |
12485
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
44 |
9934
720f70b720d3
commit: save commit message so it's not destroyed by rollback.
Greg Ward <greg-hg@gerg.ca>
parents:
6058
diff
changeset
|
45 |
50234
11e6eee4b063
transaction: use the standard transaction mechanism to backup branch
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50125
diff
changeset
|
46 working dir unaffected by rollback: do not restore dirstate et. al. |
11e6eee4b063
transaction: use the standard transaction mechanism to backup branch
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50125
diff
changeset
|
47 $ hg branch test --quiet |
12485
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
48 $ hg branch |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
49 test |
15131
7c26ce9edbd2
rollback: only restore dirstate and branch when appropriate.
Greg Ward <greg@gerg.ca>
parents:
15130
diff
changeset
|
50 $ hg log --template '{rev} {branch} {desc|firstline}\n' |
7c26ce9edbd2
rollback: only restore dirstate and branch when appropriate.
Greg Ward <greg@gerg.ca>
parents:
15130
diff
changeset
|
51 0 default add a again |
7c26ce9edbd2
rollback: only restore dirstate and branch when appropriate.
Greg Ward <greg@gerg.ca>
parents:
15130
diff
changeset
|
52 $ hg status |
7c26ce9edbd2
rollback: only restore dirstate and branch when appropriate.
Greg Ward <greg@gerg.ca>
parents:
15130
diff
changeset
|
53 M a |
7c26ce9edbd2
rollback: only restore dirstate and branch when appropriate.
Greg Ward <greg@gerg.ca>
parents:
15130
diff
changeset
|
54 $ hg bookmark foo |
7c26ce9edbd2
rollback: only restore dirstate and branch when appropriate.
Greg Ward <greg@gerg.ca>
parents:
15130
diff
changeset
|
55 $ hg commit -m'modify a again' |
7c26ce9edbd2
rollback: only restore dirstate and branch when appropriate.
Greg Ward <greg@gerg.ca>
parents:
15130
diff
changeset
|
56 $ echo b > b |
25744
e78a80f8f51e
bookmarks: change bookmark within a transaction
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22183
diff
changeset
|
57 $ hg bookmark bar -r default #making bar active, before the transaction |
50123
059910ac7b76
rollback: display some graphlog before/after a test piece
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50122
diff
changeset
|
58 $ hg log -G --template '{rev} [{branch}] ({bookmarks}) {desc|firstline}\n' |
059910ac7b76
rollback: display some graphlog before/after a test piece
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50122
diff
changeset
|
59 @ 1 [test] (foo) modify a again |
059910ac7b76
rollback: display some graphlog before/after a test piece
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50122
diff
changeset
|
60 | |
059910ac7b76
rollback: display some graphlog before/after a test piece
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50122
diff
changeset
|
61 o 0 [default] (bar) add a again |
059910ac7b76
rollback: display some graphlog before/after a test piece
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50122
diff
changeset
|
62 |
50124
b35fb0e5b8d6
rollback: avoid a `hg commit --addremove` at a critical point
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50123
diff
changeset
|
63 $ hg add b |
b35fb0e5b8d6
rollback: avoid a `hg commit --addremove` at a critical point
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50123
diff
changeset
|
64 $ hg commit -m'add b' |
50123
059910ac7b76
rollback: display some graphlog before/after a test piece
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50122
diff
changeset
|
65 $ hg log -G --template '{rev} [{branch}] ({bookmarks}) {desc|firstline}\n' |
059910ac7b76
rollback: display some graphlog before/after a test piece
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50122
diff
changeset
|
66 @ 2 [test] (foo) add b |
059910ac7b76
rollback: display some graphlog before/after a test piece
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50122
diff
changeset
|
67 | |
059910ac7b76
rollback: display some graphlog before/after a test piece
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50122
diff
changeset
|
68 o 1 [test] () modify a again |
059910ac7b76
rollback: display some graphlog before/after a test piece
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50122
diff
changeset
|
69 | |
059910ac7b76
rollback: display some graphlog before/after a test piece
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50122
diff
changeset
|
70 o 0 [default] (bar) add a again |
059910ac7b76
rollback: display some graphlog before/after a test piece
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50122
diff
changeset
|
71 |
25744
e78a80f8f51e
bookmarks: change bookmark within a transaction
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22183
diff
changeset
|
72 $ hg update bar |
15131
7c26ce9edbd2
rollback: only restore dirstate and branch when appropriate.
Greg Ward <greg@gerg.ca>
parents:
15130
diff
changeset
|
73 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
25744
e78a80f8f51e
bookmarks: change bookmark within a transaction
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22183
diff
changeset
|
74 (activating bookmark bar) |
50499
63dc24be635d
transaction: use a ".bck" extension for all backup file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50234
diff
changeset
|
75 $ cat .hg/undo.backup.branch.bck |
15131
7c26ce9edbd2
rollback: only restore dirstate and branch when appropriate.
Greg Ward <greg@gerg.ca>
parents:
15130
diff
changeset
|
76 test |
50123
059910ac7b76
rollback: display some graphlog before/after a test piece
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50122
diff
changeset
|
77 $ hg log -G --template '{rev} [{branch}] ({bookmarks}) {desc|firstline}\n' |
059910ac7b76
rollback: display some graphlog before/after a test piece
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50122
diff
changeset
|
78 o 2 [test] (foo) add b |
059910ac7b76
rollback: display some graphlog before/after a test piece
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50122
diff
changeset
|
79 | |
059910ac7b76
rollback: display some graphlog before/after a test piece
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50122
diff
changeset
|
80 o 1 [test] () modify a again |
059910ac7b76
rollback: display some graphlog before/after a test piece
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50122
diff
changeset
|
81 | |
059910ac7b76
rollback: display some graphlog before/after a test piece
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50122
diff
changeset
|
82 @ 0 [default] (bar) add a again |
059910ac7b76
rollback: display some graphlog before/after a test piece
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50122
diff
changeset
|
83 |
50122
ebb8648483db
rollback: show that the safety works in a associated test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50042
diff
changeset
|
84 $ hg rollback |
ebb8648483db
rollback: show that the safety works in a associated test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50042
diff
changeset
|
85 abort: rollback of last commit while not checked out may lose data |
ebb8648483db
rollback: show that the safety works in a associated test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50042
diff
changeset
|
86 (use -f to force) |
ebb8648483db
rollback: show that the safety works in a associated test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50042
diff
changeset
|
87 [255] |
15183
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
88 $ hg rollback -f |
15131
7c26ce9edbd2
rollback: only restore dirstate and branch when appropriate.
Greg Ward <greg@gerg.ca>
parents:
15130
diff
changeset
|
89 repository tip rolled back to revision 1 (undo commit) |
7c26ce9edbd2
rollback: only restore dirstate and branch when appropriate.
Greg Ward <greg@gerg.ca>
parents:
15130
diff
changeset
|
90 $ hg id -n |
7c26ce9edbd2
rollback: only restore dirstate and branch when appropriate.
Greg Ward <greg@gerg.ca>
parents:
15130
diff
changeset
|
91 0 |
50123
059910ac7b76
rollback: display some graphlog before/after a test piece
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50122
diff
changeset
|
92 $ hg log -G --template '{rev} [{branch}] ({bookmarks}) {desc|firstline}\n' |
059910ac7b76
rollback: display some graphlog before/after a test piece
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50122
diff
changeset
|
93 o 1 [test] (foo) modify a again |
059910ac7b76
rollback: display some graphlog before/after a test piece
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50122
diff
changeset
|
94 | |
059910ac7b76
rollback: display some graphlog before/after a test piece
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50122
diff
changeset
|
95 @ 0 [default] (bar) add a again |
059910ac7b76
rollback: display some graphlog before/after a test piece
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50122
diff
changeset
|
96 |
15131
7c26ce9edbd2
rollback: only restore dirstate and branch when appropriate.
Greg Ward <greg@gerg.ca>
parents:
15130
diff
changeset
|
97 $ hg branch |
7c26ce9edbd2
rollback: only restore dirstate and branch when appropriate.
Greg Ward <greg@gerg.ca>
parents:
15130
diff
changeset
|
98 default |
7c26ce9edbd2
rollback: only restore dirstate and branch when appropriate.
Greg Ward <greg@gerg.ca>
parents:
15130
diff
changeset
|
99 $ cat .hg/bookmarks.current ; echo |
7c26ce9edbd2
rollback: only restore dirstate and branch when appropriate.
Greg Ward <greg@gerg.ca>
parents:
15130
diff
changeset
|
100 bar |
25744
e78a80f8f51e
bookmarks: change bookmark within a transaction
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22183
diff
changeset
|
101 $ hg bookmark --delete foo bar |
15131
7c26ce9edbd2
rollback: only restore dirstate and branch when appropriate.
Greg Ward <greg@gerg.ca>
parents:
15130
diff
changeset
|
102 |
22183
4dd9f606d0a6
tests: fixup issue markers to make check-commit happy
Matt Mackall <mpm@selenic.com>
parents:
21404
diff
changeset
|
103 rollback by pretxncommit saves commit message (issue1635) |
9934
720f70b720d3
commit: save commit message so it's not destroyed by rollback.
Greg Ward <greg-hg@gerg.ca>
parents:
6058
diff
changeset
|
104 |
12485
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
105 $ echo a >> a |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
106 $ hg --config hooks.pretxncommit=false commit -m"precious commit message" |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
107 transaction abort! |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
108 rollback completed |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
109 abort: pretxncommit hook exited with status * (glob) |
46485
768056549737
errors: use exit code 40 for when a hook fails
Martin von Zweigbergk <martinvonz@google.com>
parents:
44845
diff
changeset
|
110 [40] |
12485
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
111 $ cat .hg/last-message.txt ; echo |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
112 precious commit message |
13185
c6e00dfcdcb8
tests: clean up test-rollback.t
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
12642
diff
changeset
|
113 |
c6e00dfcdcb8
tests: clean up test-rollback.t
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
12642
diff
changeset
|
114 same thing, but run $EDITOR |
c6e00dfcdcb8
tests: clean up test-rollback.t
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
12642
diff
changeset
|
115 |
16901
5b89700cce30
tests: consistently use a HGEDITOR pattern that works with msys on windows
Mads Kiilerich <mads@kiilerich.com>
parents:
15623
diff
changeset
|
116 $ cat > editor.sh << '__EOF__' |
12485
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
117 > echo "another precious commit message" > "$1" |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
118 > __EOF__ |
16901
5b89700cce30
tests: consistently use a HGEDITOR pattern that works with msys on windows
Mads Kiilerich <mads@kiilerich.com>
parents:
15623
diff
changeset
|
119 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg --config hooks.pretxncommit=false commit 2>&1 |
12485
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
120 transaction abort! |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
121 rollback completed |
41384
57c462db87fd
localrepo: use context manager for transaction in commit()
Martin von Zweigbergk <martinvonz@google.com>
parents:
40591
diff
changeset
|
122 note: commit message saved in .hg/last-message.txt |
44845
c6d31e659a28
commit: tell user what to do with .hg/last-message.txt
Martin von Zweigbergk <martinvonz@google.com>
parents:
44389
diff
changeset
|
123 note: use 'hg commit --logfile .hg/last-message.txt --edit' to reuse it |
12485
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
124 abort: pretxncommit hook exited with status * (glob) |
46485
768056549737
errors: use exit code 40 for when a hook fails
Martin von Zweigbergk <martinvonz@google.com>
parents:
44845
diff
changeset
|
125 [40] |
12642
bb35840e965c
tests: remove the last traces of $HGTMP
Mads Kiilerich <mads@kiilerich.com>
parents:
12485
diff
changeset
|
126 $ cat .hg/last-message.txt |
12485
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
127 another precious commit message |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
128 |
13958
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
129 test rollback on served repository |
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
130 |
16916
c76175cd1415
test-rollback: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents:
16913
diff
changeset
|
131 #if serve |
13958
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
132 $ hg commit -m "precious commit message" |
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
133 $ hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log |
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
134 $ cat hg.pid >> $DAEMON_PIDS |
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
135 $ cd .. |
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
136 $ hg clone http://localhost:$HGPORT u |
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
137 requesting all changes |
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
138 adding changesets |
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
139 adding manifests |
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
140 adding file changes |
15131
7c26ce9edbd2
rollback: only restore dirstate and branch when appropriate.
Greg Ward <greg@gerg.ca>
parents:
15130
diff
changeset
|
141 added 3 changesets with 2 changes to 1 files (+1 heads) |
34661
eb586ed5d8ce
transaction-summary: show the range of new revisions upon pull/unbundle (BC)
Denis Laxalde <denis.laxalde@logilab.fr>
parents:
33668
diff
changeset
|
142 new changesets 23b0221f3370:068774709090 |
15108
4c1ec0fe59d6
test-rollback: tinker a bit to make it easier to add more tests.
Greg Ward <greg@gerg.ca>
parents:
13959
diff
changeset
|
143 updating to branch default |
13958
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
144 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
145 $ cd u |
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
146 $ hg id default |
15131
7c26ce9edbd2
rollback: only restore dirstate and branch when appropriate.
Greg Ward <greg@gerg.ca>
parents:
15130
diff
changeset
|
147 068774709090 |
13958
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
148 |
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
149 now rollback and observe that 'hg serve' reloads the repository and |
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
150 presents the correct tip changeset: |
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
151 |
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
152 $ hg -R ../t rollback |
15131
7c26ce9edbd2
rollback: only restore dirstate and branch when appropriate.
Greg Ward <greg@gerg.ca>
parents:
15130
diff
changeset
|
153 repository tip rolled back to revision 1 (undo commit) |
15108
4c1ec0fe59d6
test-rollback: tinker a bit to make it easier to add more tests.
Greg Ward <greg@gerg.ca>
parents:
13959
diff
changeset
|
154 working directory now based on revision 0 |
13958
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
155 $ hg id default |
15131
7c26ce9edbd2
rollback: only restore dirstate and branch when appropriate.
Greg Ward <greg@gerg.ca>
parents:
15130
diff
changeset
|
156 791dd2169706 |
31773
3ed26ba54685
test-serve: kill daemons before deleting the access and error logs
Matt Harbison <matt_harbison@yahoo.com>
parents:
29086
diff
changeset
|
157 |
3ed26ba54685
test-serve: kill daemons before deleting the access and error logs
Matt Harbison <matt_harbison@yahoo.com>
parents:
29086
diff
changeset
|
158 $ killdaemons.py |
16916
c76175cd1415
test-rollback: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents:
16913
diff
changeset
|
159 #endif |
15183
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
160 |
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
161 update to older changeset and then refuse rollback, because |
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
162 that would lose data (issue2998) |
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
163 $ cd ../t |
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
164 $ hg -q update |
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
165 $ rm `hg status -un` |
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
166 $ template='{rev}:{node|short} [{branch}] {desc|firstline}\n' |
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
167 $ echo 'valuable new file' > b |
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
168 $ echo 'valuable modification' >> a |
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
169 $ hg commit -A -m'a valuable change' |
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
170 adding b |
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
171 $ hg update 0 |
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
172 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
173 $ hg rollback |
15187
0292f88d3b86
rollback: use a hint for force
Matt Mackall <mpm@selenic.com>
parents:
15183
diff
changeset
|
174 abort: rollback of last commit while not checked out may lose data |
0292f88d3b86
rollback: use a hint for force
Matt Mackall <mpm@selenic.com>
parents:
15183
diff
changeset
|
175 (use -f to force) |
15183
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
176 [255] |
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
177 $ hg tip -q |
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
178 2:4d9cd3795eea |
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
179 $ hg rollback -f |
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
180 repository tip rolled back to revision 1 (undo commit) |
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
181 $ hg status |
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
182 $ hg log --removed b # yep, it's gone |
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
183 |
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
184 same again, but emulate an old client that doesn't write undo.desc |
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
185 $ hg -q update |
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
186 $ echo 'valuable modification redux' >> a |
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
187 $ hg commit -m'a valuable change redux' |
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
188 $ rm .hg/undo.desc |
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
189 $ hg update 0 |
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
190 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
191 $ hg rollback |
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
192 rolling back unknown transaction |
50125
81870c92c293
rollback: detect "parentgone" case earlier
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
50124
diff
changeset
|
193 working directory now based on revision 0 |
15183
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
194 $ cat a |
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
195 a |
16913
f2719b387380
tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents:
16901
diff
changeset
|
196 |
20524
28b8ff84db3f
journal: report parsing errors on recover/rollback (issue4172)
Matt Mackall <mpm@selenic.com>
parents:
16916
diff
changeset
|
197 corrupt journal test |
28b8ff84db3f
journal: report parsing errors on recover/rollback (issue4172)
Matt Mackall <mpm@selenic.com>
parents:
16916
diff
changeset
|
198 $ echo "foo" > .hg/store/journal |
49920
2f2682f40ea0
tests: use the `--quiet` flag for verify when applicable
Raphaël Gomès <rgomes@octobus.net>
parents:
46485
diff
changeset
|
199 $ hg recover --verify -q |
20524
28b8ff84db3f
journal: report parsing errors on recover/rollback (issue4172)
Matt Mackall <mpm@selenic.com>
parents:
16916
diff
changeset
|
200 couldn't read journal entry 'foo\n'! |
28b8ff84db3f
journal: report parsing errors on recover/rollback (issue4172)
Matt Mackall <mpm@selenic.com>
parents:
16916
diff
changeset
|
201 |
29086
fe50341de1ff
rollback: add a config knob for entirely disabling the command
Augie Fackler <augie@google.com>
parents:
26998
diff
changeset
|
202 rollback disabled by config |
fe50341de1ff
rollback: add a config knob for entirely disabling the command
Augie Fackler <augie@google.com>
parents:
26998
diff
changeset
|
203 $ cat >> $HGRCPATH <<EOF |
fe50341de1ff
rollback: add a config knob for entirely disabling the command
Augie Fackler <augie@google.com>
parents:
26998
diff
changeset
|
204 > [ui] |
fe50341de1ff
rollback: add a config knob for entirely disabling the command
Augie Fackler <augie@google.com>
parents:
26998
diff
changeset
|
205 > rollback = false |
fe50341de1ff
rollback: add a config knob for entirely disabling the command
Augie Fackler <augie@google.com>
parents:
26998
diff
changeset
|
206 > EOF |
fe50341de1ff
rollback: add a config knob for entirely disabling the command
Augie Fackler <augie@google.com>
parents:
26998
diff
changeset
|
207 $ echo narf >> pinky-sayings.txt |
fe50341de1ff
rollback: add a config knob for entirely disabling the command
Augie Fackler <augie@google.com>
parents:
26998
diff
changeset
|
208 $ hg add pinky-sayings.txt |
fe50341de1ff
rollback: add a config knob for entirely disabling the command
Augie Fackler <augie@google.com>
parents:
26998
diff
changeset
|
209 $ hg ci -m 'First one.' |
fe50341de1ff
rollback: add a config knob for entirely disabling the command
Augie Fackler <augie@google.com>
parents:
26998
diff
changeset
|
210 $ hg rollback |
fe50341de1ff
rollback: add a config knob for entirely disabling the command
Augie Fackler <augie@google.com>
parents:
26998
diff
changeset
|
211 abort: rollback is disabled because it is unsafe |
fe50341de1ff
rollback: add a config knob for entirely disabling the command
Augie Fackler <augie@google.com>
parents:
26998
diff
changeset
|
212 (see `hg help -v rollback` for information) |
fe50341de1ff
rollback: add a config knob for entirely disabling the command
Augie Fackler <augie@google.com>
parents:
26998
diff
changeset
|
213 [255] |
33667
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
214 |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
215 $ cd .. |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
216 |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
217 I/O errors on stdio are handled properly (issue5658) |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
218 |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
219 $ cat > badui.py << EOF |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
220 > import errno |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
221 > from mercurial.i18n import _ |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
222 > from mercurial import ( |
36674
7bc33d677c0c
tests: fix various test-check-module-imports.t violations
Augie Fackler <augie@google.com>
parents:
36516
diff
changeset
|
223 > error, |
34766
d957d4475a64
configitems: register the test 'ui.ioerrors' config
Boris Feld <boris.feld@octobus.net>
parents:
34661
diff
changeset
|
224 > registrar, |
33667
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
225 > ui as uimod, |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
226 > ) |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
227 > |
34766
d957d4475a64
configitems: register the test 'ui.ioerrors' config
Boris Feld <boris.feld@octobus.net>
parents:
34661
diff
changeset
|
228 > configtable = {} |
d957d4475a64
configitems: register the test 'ui.ioerrors' config
Boris Feld <boris.feld@octobus.net>
parents:
34661
diff
changeset
|
229 > configitem = registrar.configitem(configtable) |
d957d4475a64
configitems: register the test 'ui.ioerrors' config
Boris Feld <boris.feld@octobus.net>
parents:
34661
diff
changeset
|
230 > |
36516
fb9b8004e1b0
py3: add b'' prefixes in tests/test-rollback.t
Pulkit Goyal <7895pulkit@gmail.com>
parents:
34766
diff
changeset
|
231 > configitem(b'ui', b'ioerrors', |
34766
d957d4475a64
configitems: register the test 'ui.ioerrors' config
Boris Feld <boris.feld@octobus.net>
parents:
34661
diff
changeset
|
232 > default=list, |
d957d4475a64
configitems: register the test 'ui.ioerrors' config
Boris Feld <boris.feld@octobus.net>
parents:
34661
diff
changeset
|
233 > ) |
d957d4475a64
configitems: register the test 'ui.ioerrors' config
Boris Feld <boris.feld@octobus.net>
parents:
34661
diff
changeset
|
234 > |
33667
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
235 > def pretxncommit(ui, repo, **kwargs): |
36516
fb9b8004e1b0
py3: add b'' prefixes in tests/test-rollback.t
Pulkit Goyal <7895pulkit@gmail.com>
parents:
34766
diff
changeset
|
236 > ui.warn(b'warn during pretxncommit\n') |
33667
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
237 > |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
238 > def pretxnclose(ui, repo, **kwargs): |
36516
fb9b8004e1b0
py3: add b'' prefixes in tests/test-rollback.t
Pulkit Goyal <7895pulkit@gmail.com>
parents:
34766
diff
changeset
|
239 > ui.warn(b'warn during pretxnclose\n') |
33667
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
240 > |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
241 > def txnclose(ui, repo, **kwargs): |
36516
fb9b8004e1b0
py3: add b'' prefixes in tests/test-rollback.t
Pulkit Goyal <7895pulkit@gmail.com>
parents:
34766
diff
changeset
|
242 > ui.warn(b'warn during txnclose\n') |
33667
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
243 > |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
244 > def txnabort(ui, repo, **kwargs): |
36516
fb9b8004e1b0
py3: add b'' prefixes in tests/test-rollback.t
Pulkit Goyal <7895pulkit@gmail.com>
parents:
34766
diff
changeset
|
245 > ui.warn(b'warn during abort\n') |
33667
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
246 > |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
247 > class fdproxy(object): |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
248 > def __init__(self, ui, o): |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
249 > self._ui = ui |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
250 > self._o = o |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
251 > |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
252 > def __getattr__(self, attr): |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
253 > return getattr(self._o, attr) |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
254 > |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
255 > def write(self, msg): |
36516
fb9b8004e1b0
py3: add b'' prefixes in tests/test-rollback.t
Pulkit Goyal <7895pulkit@gmail.com>
parents:
34766
diff
changeset
|
256 > errors = set(self._ui.configlist(b'ui', b'ioerrors')) |
fb9b8004e1b0
py3: add b'' prefixes in tests/test-rollback.t
Pulkit Goyal <7895pulkit@gmail.com>
parents:
34766
diff
changeset
|
257 > pretxncommit = msg == b'warn during pretxncommit\n' |
fb9b8004e1b0
py3: add b'' prefixes in tests/test-rollback.t
Pulkit Goyal <7895pulkit@gmail.com>
parents:
34766
diff
changeset
|
258 > pretxnclose = msg == b'warn during pretxnclose\n' |
fb9b8004e1b0
py3: add b'' prefixes in tests/test-rollback.t
Pulkit Goyal <7895pulkit@gmail.com>
parents:
34766
diff
changeset
|
259 > txnclose = msg == b'warn during txnclose\n' |
fb9b8004e1b0
py3: add b'' prefixes in tests/test-rollback.t
Pulkit Goyal <7895pulkit@gmail.com>
parents:
34766
diff
changeset
|
260 > txnabort = msg == b'warn during abort\n' |
fb9b8004e1b0
py3: add b'' prefixes in tests/test-rollback.t
Pulkit Goyal <7895pulkit@gmail.com>
parents:
34766
diff
changeset
|
261 > msgabort = msg == _(b'transaction abort!\n') |
fb9b8004e1b0
py3: add b'' prefixes in tests/test-rollback.t
Pulkit Goyal <7895pulkit@gmail.com>
parents:
34766
diff
changeset
|
262 > msgrollback = msg == _(b'rollback completed\n') |
33667
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
263 > |
36516
fb9b8004e1b0
py3: add b'' prefixes in tests/test-rollback.t
Pulkit Goyal <7895pulkit@gmail.com>
parents:
34766
diff
changeset
|
264 > if pretxncommit and b'pretxncommit' in errors: |
33667
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
265 > raise IOError(errno.EPIPE, 'simulated epipe') |
36516
fb9b8004e1b0
py3: add b'' prefixes in tests/test-rollback.t
Pulkit Goyal <7895pulkit@gmail.com>
parents:
34766
diff
changeset
|
266 > if pretxnclose and b'pretxnclose' in errors: |
33667
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
267 > raise IOError(errno.EIO, 'simulated eio') |
36516
fb9b8004e1b0
py3: add b'' prefixes in tests/test-rollback.t
Pulkit Goyal <7895pulkit@gmail.com>
parents:
34766
diff
changeset
|
268 > if txnclose and b'txnclose' in errors: |
33667
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
269 > raise IOError(errno.EBADF, 'simulated badf') |
36516
fb9b8004e1b0
py3: add b'' prefixes in tests/test-rollback.t
Pulkit Goyal <7895pulkit@gmail.com>
parents:
34766
diff
changeset
|
270 > if txnabort and b'txnabort' in errors: |
33667
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
271 > raise IOError(errno.EPIPE, 'simulated epipe') |
36516
fb9b8004e1b0
py3: add b'' prefixes in tests/test-rollback.t
Pulkit Goyal <7895pulkit@gmail.com>
parents:
34766
diff
changeset
|
272 > if msgabort and b'msgabort' in errors: |
33667
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
273 > raise IOError(errno.EBADF, 'simulated ebadf') |
36516
fb9b8004e1b0
py3: add b'' prefixes in tests/test-rollback.t
Pulkit Goyal <7895pulkit@gmail.com>
parents:
34766
diff
changeset
|
274 > if msgrollback and b'msgrollback' in errors: |
33667
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
275 > raise IOError(errno.EIO, 'simulated eio') |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
276 > |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
277 > return self._o.write(msg) |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
278 > |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
279 > def uisetup(ui): |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
280 > class badui(ui.__class__): |
40591
c2aea007130b
ui: add inner function to select write destination
Yuya Nishihara <yuya@tcha.org>
parents:
39506
diff
changeset
|
281 > def _write(self, dest, *args, **kwargs): |
33667
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
282 > olderr = self.ferr |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
283 > try: |
40591
c2aea007130b
ui: add inner function to select write destination
Yuya Nishihara <yuya@tcha.org>
parents:
39506
diff
changeset
|
284 > if dest is self.ferr: |
c2aea007130b
ui: add inner function to select write destination
Yuya Nishihara <yuya@tcha.org>
parents:
39506
diff
changeset
|
285 > self.ferr = dest = fdproxy(self, olderr) |
c2aea007130b
ui: add inner function to select write destination
Yuya Nishihara <yuya@tcha.org>
parents:
39506
diff
changeset
|
286 > return super(badui, self)._write(dest, *args, **kwargs) |
33667
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
287 > finally: |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
288 > self.ferr = olderr |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
289 > |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
290 > ui.__class__ = badui |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
291 > |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
292 > def reposetup(ui, repo): |
36516
fb9b8004e1b0
py3: add b'' prefixes in tests/test-rollback.t
Pulkit Goyal <7895pulkit@gmail.com>
parents:
34766
diff
changeset
|
293 > ui.setconfig(b'hooks', b'pretxnclose.badui', pretxnclose, b'badui') |
fb9b8004e1b0
py3: add b'' prefixes in tests/test-rollback.t
Pulkit Goyal <7895pulkit@gmail.com>
parents:
34766
diff
changeset
|
294 > ui.setconfig(b'hooks', b'txnclose.badui', txnclose, b'badui') |
fb9b8004e1b0
py3: add b'' prefixes in tests/test-rollback.t
Pulkit Goyal <7895pulkit@gmail.com>
parents:
34766
diff
changeset
|
295 > ui.setconfig(b'hooks', b'pretxncommit.badui', pretxncommit, b'badui') |
fb9b8004e1b0
py3: add b'' prefixes in tests/test-rollback.t
Pulkit Goyal <7895pulkit@gmail.com>
parents:
34766
diff
changeset
|
296 > ui.setconfig(b'hooks', b'txnabort.badui', txnabort, b'badui') |
33667
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
297 > EOF |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
298 |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
299 $ cat >> $HGRCPATH << EOF |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
300 > [extensions] |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
301 > badui = $TESTTMP/badui.py |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
302 > EOF |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
303 |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
304 An I/O error during pretxncommit is handled |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
305 |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
306 $ hg init ioerror-pretxncommit |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
307 $ cd ioerror-pretxncommit |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
308 $ echo 0 > foo |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
309 $ hg -q commit -A -m initial |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
310 warn during pretxncommit |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
311 warn during pretxnclose |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
312 warn during txnclose |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
313 $ echo 1 > foo |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
314 $ hg --config ui.ioerrors=pretxncommit commit -m 'error during pretxncommit' |
33668
cde4cfeb6e3e
ui: restore behavior to ignore some I/O errors (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33667
diff
changeset
|
315 warn during pretxnclose |
cde4cfeb6e3e
ui: restore behavior to ignore some I/O errors (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33667
diff
changeset
|
316 warn during txnclose |
33667
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
317 |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
318 $ hg commit -m 'commit 1' |
33668
cde4cfeb6e3e
ui: restore behavior to ignore some I/O errors (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33667
diff
changeset
|
319 nothing changed |
cde4cfeb6e3e
ui: restore behavior to ignore some I/O errors (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33667
diff
changeset
|
320 [1] |
33667
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
321 |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
322 $ cd .. |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
323 |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
324 An I/O error during pretxnclose is handled |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
325 |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
326 $ hg init ioerror-pretxnclose |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
327 $ cd ioerror-pretxnclose |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
328 $ echo 0 > foo |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
329 $ hg -q commit -A -m initial |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
330 warn during pretxncommit |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
331 warn during pretxnclose |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
332 warn during txnclose |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
333 |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
334 $ echo 1 > foo |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
335 $ hg --config ui.ioerrors=pretxnclose commit -m 'error during pretxnclose' |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
336 warn during pretxncommit |
33668
cde4cfeb6e3e
ui: restore behavior to ignore some I/O errors (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33667
diff
changeset
|
337 warn during txnclose |
33667
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
338 |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
339 $ hg commit -m 'commit 1' |
33668
cde4cfeb6e3e
ui: restore behavior to ignore some I/O errors (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33667
diff
changeset
|
340 nothing changed |
cde4cfeb6e3e
ui: restore behavior to ignore some I/O errors (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33667
diff
changeset
|
341 [1] |
33667
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
342 |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
343 $ cd .. |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
344 |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
345 An I/O error during txnclose is handled |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
346 |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
347 $ hg init ioerror-txnclose |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
348 $ cd ioerror-txnclose |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
349 $ echo 0 > foo |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
350 $ hg -q commit -A -m initial |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
351 warn during pretxncommit |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
352 warn during pretxnclose |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
353 warn during txnclose |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
354 |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
355 $ echo 1 > foo |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
356 $ hg --config ui.ioerrors=txnclose commit -m 'error during txnclose' |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
357 warn during pretxncommit |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
358 warn during pretxnclose |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
359 |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
360 $ hg commit -m 'commit 1' |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
361 nothing changed |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
362 [1] |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
363 |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
364 $ cd .. |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
365 |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
366 An I/O error writing "transaction abort" is handled |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
367 |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
368 $ hg init ioerror-msgabort |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
369 $ cd ioerror-msgabort |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
370 |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
371 $ echo 0 > foo |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
372 $ hg -q commit -A -m initial |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
373 warn during pretxncommit |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
374 warn during pretxnclose |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
375 warn during txnclose |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
376 |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
377 $ echo 1 > foo |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
378 $ hg --config ui.ioerrors=msgabort --config hooks.pretxncommit=false commit -m 'error during abort message' |
33668
cde4cfeb6e3e
ui: restore behavior to ignore some I/O errors (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33667
diff
changeset
|
379 warn during abort |
cde4cfeb6e3e
ui: restore behavior to ignore some I/O errors (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33667
diff
changeset
|
380 rollback completed |
cde4cfeb6e3e
ui: restore behavior to ignore some I/O errors (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33667
diff
changeset
|
381 abort: pretxncommit hook exited with status 1 |
46485
768056549737
errors: use exit code 40 for when a hook fails
Martin von Zweigbergk <martinvonz@google.com>
parents:
44845
diff
changeset
|
382 [40] |
33667
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
383 |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
384 $ hg commit -m 'commit 1' |
33668
cde4cfeb6e3e
ui: restore behavior to ignore some I/O errors (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33667
diff
changeset
|
385 warn during pretxncommit |
cde4cfeb6e3e
ui: restore behavior to ignore some I/O errors (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33667
diff
changeset
|
386 warn during pretxnclose |
cde4cfeb6e3e
ui: restore behavior to ignore some I/O errors (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33667
diff
changeset
|
387 warn during txnclose |
33667
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
388 |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
389 $ cd .. |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
390 |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
391 An I/O error during txnabort should still result in rollback |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
392 |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
393 $ hg init ioerror-txnabort |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
394 $ cd ioerror-txnabort |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
395 |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
396 $ echo 0 > foo |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
397 $ hg -q commit -A -m initial |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
398 warn during pretxncommit |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
399 warn during pretxnclose |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
400 warn during txnclose |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
401 |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
402 $ echo 1 > foo |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
403 $ hg --config ui.ioerrors=txnabort --config hooks.pretxncommit=false commit -m 'error during abort' |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
404 transaction abort! |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
405 rollback completed |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
406 abort: pretxncommit hook exited with status 1 |
46485
768056549737
errors: use exit code 40 for when a hook fails
Martin von Zweigbergk <martinvonz@google.com>
parents:
44845
diff
changeset
|
407 [40] |
33667
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
408 |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
409 $ hg commit -m 'commit 1' |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
410 warn during pretxncommit |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
411 warn during pretxnclose |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
412 warn during txnclose |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
413 |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
414 $ cd .. |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
415 |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
416 An I/O error writing "rollback completed" is handled |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
417 |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
418 $ hg init ioerror-msgrollback |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
419 $ cd ioerror-msgrollback |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
420 |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
421 $ echo 0 > foo |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
422 $ hg -q commit -A -m initial |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
423 warn during pretxncommit |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
424 warn during pretxnclose |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
425 warn during txnclose |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
426 |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
427 $ echo 1 > foo |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
428 |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
429 $ hg --config ui.ioerrors=msgrollback --config hooks.pretxncommit=false commit -m 'error during rollback message' |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
430 transaction abort! |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
431 warn during abort |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
432 abort: pretxncommit hook exited with status 1 |
46485
768056549737
errors: use exit code 40 for when a hook fails
Martin von Zweigbergk <martinvonz@google.com>
parents:
44845
diff
changeset
|
433 [40] |
33667
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
434 |
49920
2f2682f40ea0
tests: use the `--quiet` flag for verify when applicable
Raphaël Gomès <rgomes@octobus.net>
parents:
46485
diff
changeset
|
435 $ hg verify -q |
33667
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
436 |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
437 $ cd .. |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
438 |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
439 Multiple I/O errors after transaction open are handled. |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
440 This is effectively what happens if a peer disconnects in the middle |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
441 of a transaction. |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
442 |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
443 $ hg init ioerror-multiple |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
444 $ cd ioerror-multiple |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
445 $ echo 0 > foo |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
446 $ hg -q commit -A -m initial |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
447 warn during pretxncommit |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
448 warn during pretxnclose |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
449 warn during txnclose |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
450 |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
451 $ echo 1 > foo |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
452 |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
453 $ hg --config ui.ioerrors=pretxncommit,pretxnclose,txnclose,txnabort,msgabort,msgrollback commit -m 'multiple errors' |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
454 |
49920
2f2682f40ea0
tests: use the `--quiet` flag for verify when applicable
Raphaël Gomès <rgomes@octobus.net>
parents:
46485
diff
changeset
|
455 $ hg verify -q |
33667
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
456 |
2debf1e3cfa4
tests: test behavior of IOError during transactions (issue5658)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31773
diff
changeset
|
457 $ cd .. |