Mercurial > evolve
comparison tests/test-metaedit.t @ 2501:67be11064077
test: extract metaedit tests into test-metaedit.t test file
The metaedit command deserver it own test file and this shave of 15% of the
runtime of test-evolve.t one of our longest tests.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Mon, 29 May 2017 17:54:14 +0200 |
parents | tests/test-evolve.t@db565cc05987 |
children | b78c2794e13f |
comparison
equal
deleted
inserted
replaced
2500:2092007af205 | 2501:67be11064077 |
---|---|
1 $ cat >> $HGRCPATH <<EOF | |
2 > [web] | |
3 > push_ssl = false | |
4 > allow_push = * | |
5 > [phases] | |
6 > publish = False | |
7 > [alias] | |
8 > qlog = log --template='{rev} - {node|short} {desc} ({phase})\n' | |
9 > [diff] | |
10 > git = 1 | |
11 > unified = 0 | |
12 > [extensions] | |
13 > hgext.graphlog= | |
14 > EOF | |
15 $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH | |
16 $ mkcommit() { | |
17 > echo "$1" > "$1" | |
18 > hg add "$1" | |
19 > hg ci -m "$1" | |
20 > } | |
21 | |
22 $ mkstack() { | |
23 > # Creates a stack of commit based on $1 with messages from $2, $3 .. | |
24 > hg update $1 -C | |
25 > shift | |
26 > mkcommits $* | |
27 > } | |
28 | |
29 $ glog() { | |
30 > hg glog --template '{rev}:{node|short}@{branch}({phase}) {desc|firstline}\n' "$@" | |
31 > } | |
32 | |
33 $ shaof() { | |
34 > hg log -T {node} -r "first(desc($1))" | |
35 > } | |
36 | |
37 $ mkcommits() { | |
38 > for i in $@; do mkcommit $i ; done | |
39 > } | |
40 | |
41 ########################## | |
42 importing Parren test | |
43 ########################## | |
44 | |
45 $ cat << EOF >> $HGRCPATH | |
46 > [ui] | |
47 > logtemplate = "{rev}\t{bookmarks}: {desc|firstline} - {author|user}\n" | |
48 > EOF | |
49 | |
50 HG METAEDIT | |
51 =============================== | |
52 | |
53 Setup the Base Repo | |
54 ------------------- | |
55 | |
56 We start with a plain base repo:: | |
57 | |
58 $ hg init $TESTTMP/metaedit; cd $TESTTMP/metaedit | |
59 $ mkcommit "ROOT" | |
60 $ hg phase --public "desc(ROOT)" | |
61 $ mkcommit "A" | |
62 $ mkcommit "B" | |
63 $ hg up "desc(A)" | |
64 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
65 $ mkcommit "C" | |
66 created new head | |
67 $ mkcommit "D" | |
68 $ echo "D'" > D | |
69 $ hg amend -m "D2" | |
70 $ hg up "desc(C)" | |
71 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
72 $ mkcommit "E" | |
73 created new head | |
74 $ mkcommit "F" | |
75 | |
76 Test | |
77 ---- | |
78 | |
79 $ hg log -G | |
80 @ 8 : F - test | |
81 | | |
82 o 7 : E - test | |
83 | | |
84 | o 6 : D2 - test | |
85 |/ | |
86 o 3 : C - test | |
87 | | |
88 | o 2 : B - test | |
89 |/ | |
90 o 1 : A - test | |
91 | | |
92 o 0 : ROOT - test | |
93 | |
94 $ hg update --clean . | |
95 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
96 $ hg metaedit -r 0 | |
97 abort: cannot edit commit information for public revisions | |
98 [255] | |
99 $ hg metaedit --fold | |
100 abort: revisions must be specified with --fold | |
101 [255] | |
102 $ hg metaedit -r 0 --fold | |
103 abort: cannot fold public revisions | |
104 [255] | |
105 $ hg metaedit 'desc(C) + desc(F)' --fold | |
106 abort: cannot fold non-linear revisions (multiple roots given) | |
107 [255] | |
108 $ hg metaedit "desc(C)::desc(D2) + desc(E)" --fold | |
109 abort: cannot fold non-linear revisions (multiple heads given) | |
110 [255] | |
111 check that metaedit respects allowunstable | |
112 $ hg metaedit '.^' --config 'experimental.evolution=createmarkers, allnewcommands' | |
113 abort: cannot edit commit information in the middle of a stack | |
114 (587528abfffe will become unstable and new unstable changes are not allowed) | |
115 [255] | |
116 $ hg metaedit 'desc(A)::desc(B)' --fold --config 'experimental.evolution=createmarkers, allnewcommands' | |
117 abort: cannot fold chain not ending with a head or with branching | |
118 (new unstable changesets are not allowed) | |
119 [255] | |
120 $ hg metaedit --user foobar | |
121 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
122 $ hg log --template '{rev}: {author}\n' -r 'desc(F):' --hidden | |
123 5: test | |
124 6: test | |
125 7: test | |
126 8: test | |
127 9: foobar | |
128 $ hg log --template '{rev}: {author}\n' -r . | |
129 9: foobar | |
130 | |
131 TODO: support this | |
132 $ hg metaedit '.^::.' | |
133 abort: editing multiple revisions without --fold is not currently supported | |
134 [255] | |
135 | |
136 $ HGEDITOR=cat hg metaedit '.^::.' --fold | |
137 HG: This is a fold of 2 changesets. | |
138 HG: Commit message of changeset 7. | |
139 | |
140 E | |
141 | |
142 HG: Commit message of changeset 9. | |
143 | |
144 F | |
145 | |
146 | |
147 | |
148 HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
149 HG: Leave message empty to abort commit. | |
150 HG: -- | |
151 HG: user: test | |
152 HG: branch 'default' | |
153 HG: added E | |
154 HG: added F | |
155 2 changesets folded | |
156 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
157 | |
158 $ glog -r . | |
159 @ 10:a08d35fd7d9d@default(draft) E | |
160 | | |
161 ~ | |
162 | |
163 no new commit is created here because the date is the same | |
164 $ HGEDITOR=cat hg metaedit | |
165 E | |
166 | |
167 | |
168 F | |
169 | |
170 | |
171 HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
172 HG: Leave message empty to abort commit. | |
173 HG: -- | |
174 HG: user: test | |
175 HG: branch 'default' | |
176 HG: added E | |
177 HG: added F | |
178 nothing changed | |
179 | |
180 $ glog -r '.^::.' | |
181 @ 10:a08d35fd7d9d@default(draft) E | |
182 | | |
183 o 3:3260958f1169@default(draft) C | |
184 | | |
185 ~ | |
186 | |
187 TODO: don't create a new commit in this case, we should take the date of the | |
188 old commit (we add a default date with a value to show that metaedit is taking | |
189 the current date to generate the hash, this way we still have a stable hash | |
190 but highlight the bug) | |
191 $ hg metaedit --config defaults.metaedit= --config devel.default-date="42 0" | |
192 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
193 $ hg log -r '.^::.' --template '{rev}: {desc|firstline}\n' | |
194 3: C | |
195 11: E | |
196 | |
197 $ hg up .^ | |
198 0 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
199 $ hg metaedit --user foobar2 tip | |
200 $ hg log --template '{rev}: {author}\n' -r "user(foobar):" --hidden | |
201 9: foobar | |
202 10: test | |
203 11: test | |
204 12: foobar2 | |
205 $ hg diff -r "10" -r "11" --hidden | |
206 | |
207 'fold' one commit | |
208 $ hg metaedit "desc(D2)" --fold --user foobar3 | |
209 1 changesets folded | |
210 $ hg log -r "tip" --template '{rev}: {author}\n' | |
211 13: foobar3 |