Mercurial > hg
annotate tests/test-rollback.t @ 20742:3681de20b0a7
parsers: fail fast if Python has wrong minor version (issue4110)
This change causes an informative ImportError to be raised when importing
the parsers extension module if the minor version of the currently-running
Python interpreter doesn't match that of the Python used when compiling
the extension module.
This change also exposes a parsers.versionerrortext constant in the
C implementation of the module. Its presence can be used to determine
whether this behavior is present in a version of the module. The value
of the constant is the leading text of the ImportError raised and is set
to "Python minor version mismatch".
Here is an example of what the new error looks like:
Traceback (most recent call last):
File "test.py", line 1, in <module>
import mercurial.parsers
ImportError: Python minor version mismatch: The Mercurial extension
modules were compiled with Python 2.7.6, but Mercurial is currently using
Python with sys.hexversion=33883888: Python 2.5.6
(r256:88840, Nov 18 2012, 05:37:10)
[GCC 4.2.1 Compatible Apple Clang 4.1 ((tags/Apple/clang-421.11.66))]
at: /opt/local/Library/Frameworks/Python.framework/Versions/2.5/Resources/
Python.app/Contents/MacOS/Python
The reason for raising an error in this scenario is that Python's C API
is known not to be compatible from minor version to minor version, even
if sys.api_version is the same. See for example this Python bug report
about incompatibilities between 2.5 and 2.6+:
http://bugs.python.org/issue8118
These incompatibilities can cause Mercurial to break in mysterious,
unforeseen ways. For example, when Mercurial compiled with Python 2.7 was
run with 2.5, the following crash occurred when running "hg status":
http://bz.selenic.com/show_bug.cgi?id=4110
After this crash was fixed, running with Python 2.5 no longer crashes, but
the following puzzling behavior still occurs:
$ hg status
...
File ".../mercurial/changelog.py", line 123, in __init__
revlog.revlog.__init__(self, opener, "00changelog.i")
File ".../mercurial/revlog.py", line 251, in __init__
d = self._io.parseindex(i, self._inline)
File ".../mercurial/revlog.py", line 158, in parseindex
index, cache = parsers.parse_index2(data, inline)
TypeError: data is not a string
which can be reproduced more simply with:
import mercurial.parsers as parsers
parsers.parse_index2("", True)
Both the crash and the TypeError occurred because the Python C API's
PyString_Check() returns the wrong value when the C header files from
Python 2.7 are run with Python 2.5. This is an example of an
incompatibility of the sort mentioned in the Python bug report above.
Failing fast with an informative error message results in a better user
experience in cases like the above. The information in the ImportError
also simplifies troubleshooting for those on Mercurial mailing lists, the
bug tracker, etc.
This patch only adds the version check to parsers.c, which is sufficient
to affect command-line commands like "hg status" and "hg summary".
An idea for a future improvement is to move the version-checking C code
to a more central location, and have it run when importing all
Mercurial extension modules and not just parsers.c.
author | Chris Jerdonek <chris.jerdonek@gmail.com> |
---|---|
date | Wed, 04 Dec 2013 20:38:27 -0800 |
parents | 28b8ff84db3f |
children | ca275f7ec576 |
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 |
15108
4c1ec0fe59d6
test-rollback: tinker a bit to make it easier to add more tests.
Greg Ward <greg@gerg.ca>
parents:
13959
diff
changeset
|
5 $ hg commit -Am'add a' |
4c1ec0fe59d6
test-rollback: tinker a bit to make it easier to add more tests.
Greg Ward <greg@gerg.ca>
parents:
13959
diff
changeset
|
6 adding a |
12485
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
7 $ hg verify |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
8 checking changesets |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
9 checking manifests |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
10 crosschecking files in changesets and manifests |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
11 checking files |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
12 1 files, 1 changesets, 1 total revisions |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
13 $ 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
|
14 changeset: 0:1f0dee641bb7 |
12485
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
15 tag: tip |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
16 user: test |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
17 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
|
18 summary: add a |
12485
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
19 |
15108
4c1ec0fe59d6
test-rollback: tinker a bit to make it easier to add more tests.
Greg Ward <greg@gerg.ca>
parents:
13959
diff
changeset
|
20 |
4c1ec0fe59d6
test-rollback: tinker a bit to make it easier to add more tests.
Greg Ward <greg@gerg.ca>
parents:
13959
diff
changeset
|
21 rollback to null revision |
12485
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
22 $ hg status |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
23 $ hg rollback |
13446
1e497df514e2
rollback: clarifies the message about the reverted state (issue2628)
Gilles Moris <gilles.moris@free.fr>
parents:
13185
diff
changeset
|
24 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
|
25 working directory now based on revision -1 |
12485
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
26 $ hg verify |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
27 checking changesets |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
28 checking manifests |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
29 crosschecking files in changesets and manifests |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
30 checking files |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
31 0 files, 0 changesets, 0 total revisions |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
32 $ hg parents |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
33 $ hg status |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
34 A a |
5814
dd5a501cb97f
restore branch after rollback (issue 902)
Alexandre Vassalotti <mercurial-bugs@selenic.com>
parents:
2227
diff
changeset
|
35 |
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 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
|
37 $ 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
|
38 $ 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
|
39 $ hg commit -m'modify a' |
12485
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
40 |
15108
4c1ec0fe59d6
test-rollback: tinker a bit to make it easier to add more tests.
Greg Ward <greg@gerg.ca>
parents:
13959
diff
changeset
|
41 Test issue 902 (current branch is preserved) |
12485
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
42 $ hg branch test |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
43 marked working directory as branch test |
15615 | 44 (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
|
45 $ 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
|
46 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
|
47 working directory now based on revision 0 |
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 default |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
50 |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
51 Test issue 1635 (commit message saved) |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
52 $ 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
|
53 modify a |
12485
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
54 |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
55 Test rollback of hg before issue 902 was fixed |
9934
720f70b720d3
commit: save commit message so it's not destroyed by rollback.
Greg Ward <greg-hg@gerg.ca>
parents:
6058
diff
changeset
|
56 |
12485
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
57 $ hg commit -m "test3" |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
58 $ hg branch test |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
59 marked working directory as branch test |
15615 | 60 (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
|
61 $ rm .hg/undo.branch |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
62 $ 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
|
63 repository tip rolled back to revision 0 (undo commit) |
15130
3d44e68360a6
rollback: refactor for readability; cosmetics.
Greg Ward <greg@gerg.ca>
parents:
15108
diff
changeset
|
64 named branch could not be reset: current branch is still 'test' |
15108
4c1ec0fe59d6
test-rollback: tinker a bit to make it easier to add more tests.
Greg Ward <greg@gerg.ca>
parents:
13959
diff
changeset
|
65 working directory now based on revision 0 |
12485
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
66 $ hg branch |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
67 test |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
68 |
15131
7c26ce9edbd2
rollback: only restore dirstate and branch when appropriate.
Greg Ward <greg@gerg.ca>
parents:
15130
diff
changeset
|
69 working dir unaffected by rollback: do not restore dirstate et. al. |
7c26ce9edbd2
rollback: only restore dirstate and branch when appropriate.
Greg Ward <greg@gerg.ca>
parents:
15130
diff
changeset
|
70 $ 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
|
71 0 default add a again |
7c26ce9edbd2
rollback: only restore dirstate and branch when appropriate.
Greg Ward <greg@gerg.ca>
parents:
15130
diff
changeset
|
72 $ hg status |
7c26ce9edbd2
rollback: only restore dirstate and branch when appropriate.
Greg Ward <greg@gerg.ca>
parents:
15130
diff
changeset
|
73 M a |
7c26ce9edbd2
rollback: only restore dirstate and branch when appropriate.
Greg Ward <greg@gerg.ca>
parents:
15130
diff
changeset
|
74 $ hg bookmark foo |
7c26ce9edbd2
rollback: only restore dirstate and branch when appropriate.
Greg Ward <greg@gerg.ca>
parents:
15130
diff
changeset
|
75 $ hg commit -m'modify a again' |
7c26ce9edbd2
rollback: only restore dirstate and branch when appropriate.
Greg Ward <greg@gerg.ca>
parents:
15130
diff
changeset
|
76 $ echo b > b |
7c26ce9edbd2
rollback: only restore dirstate and branch when appropriate.
Greg Ward <greg@gerg.ca>
parents:
15130
diff
changeset
|
77 $ hg commit -Am'add b' |
7c26ce9edbd2
rollback: only restore dirstate and branch when appropriate.
Greg Ward <greg@gerg.ca>
parents:
15130
diff
changeset
|
78 adding b |
7c26ce9edbd2
rollback: only restore dirstate and branch when appropriate.
Greg Ward <greg@gerg.ca>
parents:
15130
diff
changeset
|
79 $ 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
|
80 2 test add b |
7c26ce9edbd2
rollback: only restore dirstate and branch when appropriate.
Greg Ward <greg@gerg.ca>
parents:
15130
diff
changeset
|
81 1 test modify a again |
7c26ce9edbd2
rollback: only restore dirstate and branch when appropriate.
Greg Ward <greg@gerg.ca>
parents:
15130
diff
changeset
|
82 0 default add a again |
7c26ce9edbd2
rollback: only restore dirstate and branch when appropriate.
Greg Ward <greg@gerg.ca>
parents:
15130
diff
changeset
|
83 $ hg update default |
7c26ce9edbd2
rollback: only restore dirstate and branch when appropriate.
Greg Ward <greg@gerg.ca>
parents:
15130
diff
changeset
|
84 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
7c26ce9edbd2
rollback: only restore dirstate and branch when appropriate.
Greg Ward <greg@gerg.ca>
parents:
15130
diff
changeset
|
85 $ hg bookmark bar |
7c26ce9edbd2
rollback: only restore dirstate and branch when appropriate.
Greg Ward <greg@gerg.ca>
parents:
15130
diff
changeset
|
86 $ cat .hg/undo.branch ; echo |
7c26ce9edbd2
rollback: only restore dirstate and branch when appropriate.
Greg Ward <greg@gerg.ca>
parents:
15130
diff
changeset
|
87 test |
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 |
7c26ce9edbd2
rollback: only restore dirstate and branch when appropriate.
Greg Ward <greg@gerg.ca>
parents:
15130
diff
changeset
|
92 $ hg branch |
7c26ce9edbd2
rollback: only restore dirstate and branch when appropriate.
Greg Ward <greg@gerg.ca>
parents:
15130
diff
changeset
|
93 default |
7c26ce9edbd2
rollback: only restore dirstate and branch when appropriate.
Greg Ward <greg@gerg.ca>
parents:
15130
diff
changeset
|
94 $ cat .hg/bookmarks.current ; echo |
7c26ce9edbd2
rollback: only restore dirstate and branch when appropriate.
Greg Ward <greg@gerg.ca>
parents:
15130
diff
changeset
|
95 bar |
7c26ce9edbd2
rollback: only restore dirstate and branch when appropriate.
Greg Ward <greg@gerg.ca>
parents:
15130
diff
changeset
|
96 $ hg bookmark --delete foo |
7c26ce9edbd2
rollback: only restore dirstate and branch when appropriate.
Greg Ward <greg@gerg.ca>
parents:
15130
diff
changeset
|
97 |
12485
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
98 rollback by pretxncommit saves commit message (issue 1635) |
9934
720f70b720d3
commit: save commit message so it's not destroyed by rollback.
Greg Ward <greg-hg@gerg.ca>
parents:
6058
diff
changeset
|
99 |
12485
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
100 $ echo a >> a |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
101 $ hg --config hooks.pretxncommit=false commit -m"precious commit message" |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
102 transaction abort! |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
103 rollback completed |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
104 abort: pretxncommit hook exited with status * (glob) |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
105 [255] |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
106 $ cat .hg/last-message.txt ; echo |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
107 precious commit message |
13185
c6e00dfcdcb8
tests: clean up test-rollback.t
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
12642
diff
changeset
|
108 |
c6e00dfcdcb8
tests: clean up test-rollback.t
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
12642
diff
changeset
|
109 same thing, but run $EDITOR |
c6e00dfcdcb8
tests: clean up test-rollback.t
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
12642
diff
changeset
|
110 |
16901
5b89700cce30
tests: consistently use a HGEDITOR pattern that works with msys on windows
Mads Kiilerich <mads@kiilerich.com>
parents:
15623
diff
changeset
|
111 $ cat > editor.sh << '__EOF__' |
12485
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
112 > echo "another precious commit message" > "$1" |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
113 > __EOF__ |
16901
5b89700cce30
tests: consistently use a HGEDITOR pattern that works with msys on windows
Mads Kiilerich <mads@kiilerich.com>
parents:
15623
diff
changeset
|
114 $ 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
|
115 transaction abort! |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
116 rollback completed |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
117 note: commit message saved in .hg/last-message.txt |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
118 abort: pretxncommit hook exited with status * (glob) |
12642
bb35840e965c
tests: remove the last traces of $HGTMP
Mads Kiilerich <mads@kiilerich.com>
parents:
12485
diff
changeset
|
119 [255] |
bb35840e965c
tests: remove the last traces of $HGTMP
Mads Kiilerich <mads@kiilerich.com>
parents:
12485
diff
changeset
|
120 $ cat .hg/last-message.txt |
12485
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
121 another precious commit message |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
122 |
13958
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
123 test rollback on served repository |
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
124 |
16916
c76175cd1415
test-rollback: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents:
16913
diff
changeset
|
125 #if serve |
13958
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
126 $ hg commit -m "precious commit message" |
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
127 $ 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
|
128 $ cat hg.pid >> $DAEMON_PIDS |
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
129 $ cd .. |
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
130 $ hg clone http://localhost:$HGPORT u |
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
131 requesting all changes |
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
132 adding changesets |
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
133 adding manifests |
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
134 adding file changes |
15131
7c26ce9edbd2
rollback: only restore dirstate and branch when appropriate.
Greg Ward <greg@gerg.ca>
parents:
15130
diff
changeset
|
135 added 3 changesets with 2 changes to 1 files (+1 heads) |
15108
4c1ec0fe59d6
test-rollback: tinker a bit to make it easier to add more tests.
Greg Ward <greg@gerg.ca>
parents:
13959
diff
changeset
|
136 updating to branch default |
13958
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
137 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
|
138 $ cd u |
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
139 $ hg id default |
15131
7c26ce9edbd2
rollback: only restore dirstate and branch when appropriate.
Greg Ward <greg@gerg.ca>
parents:
15130
diff
changeset
|
140 068774709090 |
13958
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
141 |
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
142 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
|
143 presents the correct tip changeset: |
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
144 |
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
145 $ hg -R ../t rollback |
15131
7c26ce9edbd2
rollback: only restore dirstate and branch when appropriate.
Greg Ward <greg@gerg.ca>
parents:
15130
diff
changeset
|
146 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
|
147 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
|
148 $ hg id default |
15131
7c26ce9edbd2
rollback: only restore dirstate and branch when appropriate.
Greg Ward <greg@gerg.ca>
parents:
15130
diff
changeset
|
149 791dd2169706 |
16916
c76175cd1415
test-rollback: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents:
16913
diff
changeset
|
150 #endif |
15183
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
151 |
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
152 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
|
153 that would lose data (issue2998) |
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
154 $ cd ../t |
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
155 $ hg -q update |
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
156 $ rm `hg status -un` |
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
157 $ 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
|
158 $ echo 'valuable new file' > b |
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
159 $ echo 'valuable modification' >> a |
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
160 $ 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
|
161 adding b |
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
162 $ hg update 0 |
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
163 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
|
164 $ hg rollback |
15187
0292f88d3b86
rollback: use a hint for force
Matt Mackall <mpm@selenic.com>
parents:
15183
diff
changeset
|
165 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
|
166 (use -f to force) |
15183
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
167 [255] |
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
168 $ hg tip -q |
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
169 2:4d9cd3795eea |
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
170 $ hg rollback -f |
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
171 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
|
172 $ hg status |
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
173 $ 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
|
174 |
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
175 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
|
176 $ hg -q update |
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
177 $ echo 'valuable modification redux' >> a |
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
178 $ 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
|
179 $ rm .hg/undo.desc |
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
180 $ hg update 0 |
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
181 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
|
182 $ hg rollback |
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
183 rolling back unknown transaction |
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
184 $ cat a |
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15131
diff
changeset
|
185 a |
16913
f2719b387380
tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents:
16901
diff
changeset
|
186 |
20524
28b8ff84db3f
journal: report parsing errors on recover/rollback (issue4172)
Matt Mackall <mpm@selenic.com>
parents:
16916
diff
changeset
|
187 corrupt journal test |
28b8ff84db3f
journal: report parsing errors on recover/rollback (issue4172)
Matt Mackall <mpm@selenic.com>
parents:
16916
diff
changeset
|
188 $ echo "foo" > .hg/store/journal |
28b8ff84db3f
journal: report parsing errors on recover/rollback (issue4172)
Matt Mackall <mpm@selenic.com>
parents:
16916
diff
changeset
|
189 $ hg recover |
28b8ff84db3f
journal: report parsing errors on recover/rollback (issue4172)
Matt Mackall <mpm@selenic.com>
parents:
16916
diff
changeset
|
190 rolling back interrupted transaction |
28b8ff84db3f
journal: report parsing errors on recover/rollback (issue4172)
Matt Mackall <mpm@selenic.com>
parents:
16916
diff
changeset
|
191 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
|
192 checking changesets |
28b8ff84db3f
journal: report parsing errors on recover/rollback (issue4172)
Matt Mackall <mpm@selenic.com>
parents:
16916
diff
changeset
|
193 checking manifests |
28b8ff84db3f
journal: report parsing errors on recover/rollback (issue4172)
Matt Mackall <mpm@selenic.com>
parents:
16916
diff
changeset
|
194 crosschecking files in changesets and manifests |
28b8ff84db3f
journal: report parsing errors on recover/rollback (issue4172)
Matt Mackall <mpm@selenic.com>
parents:
16916
diff
changeset
|
195 checking files |
28b8ff84db3f
journal: report parsing errors on recover/rollback (issue4172)
Matt Mackall <mpm@selenic.com>
parents:
16916
diff
changeset
|
196 1 files, 2 changesets, 2 total revisions |
28b8ff84db3f
journal: report parsing errors on recover/rollback (issue4172)
Matt Mackall <mpm@selenic.com>
parents:
16916
diff
changeset
|
197 |