Mercurial > hg
annotate tests/test-rollback.t @ 14732:e9ed3506f066 stable
backout of d04ba50e104d: allow to qpop/push with a dirty working copy
The new behavior was breaking existing tools that relied on a sequence such as
this:
1) start with a dirty working copy
2) qimport some patch
3) try to qpush it
4) old behavior would fail at this point due to outstanding changes.
(new behavior would only fail if the outstanding changes and the patches
changes intersect)
5) innocent user qrefreshes, gets his local changes in the imported patch
It's worth considering if we can move this behavior to -f in the future.
author | Idan Kamara <idankk86@gmail.com> |
---|---|
date | Fri, 24 Jun 2011 23:25:42 +0300 |
parents | 141f88ae5276 |
children | 4c1ec0fe59d6 |
rev | line source |
---|---|
336 | 1 |
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 |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
5 $ hg add a |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
6 $ hg commit -m "test" |
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 |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
14 changeset: 0:acb14030fe0a |
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 |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
18 summary: test |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
19 |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
20 $ hg status |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
21 $ hg rollback |
13446
1e497df514e2
rollback: clarifies the message about the reverted state (issue2628)
Gilles Moris <gilles.moris@free.fr>
parents:
13185
diff
changeset
|
22 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
|
23 working directory now based on revision -1 |
12485
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
24 $ hg verify |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
25 checking changesets |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
26 checking manifests |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
27 crosschecking files in changesets and manifests |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
28 checking files |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
29 0 files, 0 changesets, 0 total revisions |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
30 $ hg parents |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
31 $ hg status |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
32 A a |
5814
dd5a501cb97f
restore branch after rollback (issue 902)
Alexandre Vassalotti <mercurial-bugs@selenic.com>
parents:
2227
diff
changeset
|
33 |
12485
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
34 Test issue 902 |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
35 |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
36 $ hg commit -m "test2" |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
37 $ hg branch test |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
38 marked working directory as branch test |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
39 $ hg rollback |
13446
1e497df514e2
rollback: clarifies the message about the reverted state (issue2628)
Gilles Moris <gilles.moris@free.fr>
parents:
13185
diff
changeset
|
40 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
|
41 working directory now based on revision -1 |
12485
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
42 $ hg branch |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
43 default |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
44 |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
45 Test issue 1635 (commit message saved) |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
46 .hg/last-message.txt: |
6058
88b4d726332a
Do not abort rollback if undo.branch isn't available, but warn.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5814
diff
changeset
|
47 |
12485
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
48 $ cat .hg/last-message.txt ; echo |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
49 test2 |
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 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
|
52 |
12485
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
53 $ hg commit -m "test3" |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
54 $ hg branch test |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
55 marked working directory as branch test |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
56 $ rm .hg/undo.branch |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
57 $ hg rollback |
13446
1e497df514e2
rollback: clarifies the message about the reverted state (issue2628)
Gilles Moris <gilles.moris@free.fr>
parents:
13185
diff
changeset
|
58 repository tip rolled back to revision -1 (undo commit) |
13957
044e1356327d
rollback: lower-case warning issued when branch cannot be reset
Martin Geisler <mg@lazybytes.net>
parents:
13446
diff
changeset
|
59 named branch could not be reset, current branch is still: test |
13446
1e497df514e2
rollback: clarifies the message about the reverted state (issue2628)
Gilles Moris <gilles.moris@free.fr>
parents:
13185
diff
changeset
|
60 working directory now based on revision -1 |
12485
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
61 $ hg branch |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
62 test |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
63 |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
64 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
|
65 |
12485
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
66 $ echo a >> a |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
67 $ hg --config hooks.pretxncommit=false commit -m"precious commit message" |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
68 transaction abort! |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
69 rollback completed |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
70 abort: pretxncommit hook exited with status * (glob) |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
71 [255] |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
72 |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
73 .hg/last-message.txt: |
9935
48b81d9bca8d
commit: if relevant, tell user their commit message was saved.
Greg Ward <greg-hg@gerg.ca>
parents:
9934
diff
changeset
|
74 |
12485
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
75 $ cat .hg/last-message.txt ; echo |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
76 precious commit message |
13185
c6e00dfcdcb8
tests: clean up test-rollback.t
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
12642
diff
changeset
|
77 |
c6e00dfcdcb8
tests: clean up test-rollback.t
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
12642
diff
changeset
|
78 same thing, but run $EDITOR |
c6e00dfcdcb8
tests: clean up test-rollback.t
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
12642
diff
changeset
|
79 |
12642
bb35840e965c
tests: remove the last traces of $HGTMP
Mads Kiilerich <mads@kiilerich.com>
parents:
12485
diff
changeset
|
80 $ cat > editor << '__EOF__' |
12485
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
81 > #!/bin/sh |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
82 > echo "another precious commit message" > "$1" |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
83 > __EOF__ |
12642
bb35840e965c
tests: remove the last traces of $HGTMP
Mads Kiilerich <mads@kiilerich.com>
parents:
12485
diff
changeset
|
84 $ chmod +x editor |
bb35840e965c
tests: remove the last traces of $HGTMP
Mads Kiilerich <mads@kiilerich.com>
parents:
12485
diff
changeset
|
85 $ HGEDITOR="'`pwd`'"/editor hg --config hooks.pretxncommit=false commit 2>&1 |
12485
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
86 transaction abort! |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
87 rollback completed |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
88 note: commit message saved in .hg/last-message.txt |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
89 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
|
90 [255] |
bb35840e965c
tests: remove the last traces of $HGTMP
Mads Kiilerich <mads@kiilerich.com>
parents:
12485
diff
changeset
|
91 $ cat .hg/last-message.txt |
12485
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
92 another precious commit message |
8fdc11fec6ae
tests: unify test-rollback
Matt Mackall <mpm@selenic.com>
parents:
12156
diff
changeset
|
93 |
13958
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
94 test rollback on served repository |
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
95 |
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
96 $ hg commit -m "precious commit message" |
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
97 $ 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
|
98 $ cat hg.pid >> $DAEMON_PIDS |
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
99 $ cd .. |
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
100 $ hg clone http://localhost:$HGPORT u |
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
101 requesting all changes |
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
102 adding changesets |
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
103 adding manifests |
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
104 adding file changes |
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
105 added 1 changesets with 1 changes to 1 files |
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
106 updating to branch test |
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
107 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
|
108 $ cd u |
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
109 $ hg id default |
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
110 1df294f7b1a2 |
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
111 |
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
112 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
|
113 presents the correct tip changeset: |
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
114 |
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
115 $ hg -R ../t rollback |
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
116 repository tip rolled back to revision -1 (undo commit) |
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
117 working directory now based on revision -1 |
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
118 $ hg id default |
71f51cc71652
hgweb: detect change based on changelog size too
Martin Geisler <mg@lazybytes.net>
parents:
13957
diff
changeset
|
119 000000000000 |