comparison tests/test-metaedit.t @ 2530:606722a686ef stable

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