##// END OF EJS Templates
amend: save commit message into ".hg/last-message.txt"...
FUJIWARA Katsunori -
r20771:434619da stable
parent child Browse files
Show More
@@ -1782,6 +1782,7 b' def amend(ui, repo, commitfunc, old, ext'
1782 1782 extra=extra)
1783 1783 if editmsg:
1784 1784 new._text = commitforceeditor(repo, new, [])
1785 repo.savecommitmessage(new.description())
1785 1786
1786 1787 newdesc = changelog.stripdesc(new.description())
1787 1788 if ((not node)
@@ -165,6 +165,57 b' Open editor with old commit message if a'
165 165 > cat $1
166 166 > echo "another precious commit message" > "$1"
167 167 > __EOF__
168
169 at first, test saving last-message.txt
170
171 $ cat > .hg/hgrc << '__EOF__'
172 > [hooks]
173 > pretxncommit.test-saving-last-message = false
174 > __EOF__
175
176 $ rm -f .hg/last-message.txt
177 $ hg commit --amend -v -m "message given from command line"
178 amending changeset 5f357c7560ab
179 copying changeset 5f357c7560ab to ad120869acf0
180 a
181 running hook pretxncommit.test-saving-last-message: false
182 transaction abort!
183 rollback completed
184 abort: pretxncommit.test-saving-last-message hook exited with status 1
185 [255]
186 $ cat .hg/last-message.txt
187 message given from command line (no-eol)
188
189 $ rm -f .hg/last-message.txt
190 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v
191 amending changeset 5f357c7560ab
192 copying changeset 5f357c7560ab to ad120869acf0
193 no changes, new message
194
195
196 HG: Enter commit message. Lines beginning with 'HG:' are removed.
197 HG: Leave message empty to abort commit.
198 HG: --
199 HG: user: foo
200 HG: branch 'default'
201 HG: changed a
202 a
203 running hook pretxncommit.test-saving-last-message: false
204 transaction abort!
205 rollback completed
206 abort: pretxncommit.test-saving-last-message hook exited with status 1
207 [255]
208
209 $ cat .hg/last-message.txt
210 another precious commit message
211
212 $ cat > .hg/hgrc << '__EOF__'
213 > [hooks]
214 > pretxncommit.test-saving-last-message =
215 > __EOF__
216
217 then, test editing custom commit message
218
168 219 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v
169 220 amending changeset 5f357c7560ab
170 221 copying changeset 5f357c7560ab to ad120869acf0
General Comments 0
You need to be logged in to leave comments. Login now