Show More
@@ -1782,6 +1782,7 b' def amend(ui, repo, commitfunc, old, ext' | |||||
1782 | extra=extra) |
|
1782 | extra=extra) | |
1783 | if editmsg: |
|
1783 | if editmsg: | |
1784 | new._text = commitforceeditor(repo, new, []) |
|
1784 | new._text = commitforceeditor(repo, new, []) | |
|
1785 | repo.savecommitmessage(new.description()) | |||
1785 |
|
1786 | |||
1786 | newdesc = changelog.stripdesc(new.description()) |
|
1787 | newdesc = changelog.stripdesc(new.description()) | |
1787 | if ((not node) |
|
1788 | if ((not node) |
@@ -165,6 +165,57 b' Open editor with old commit message if a' | |||||
165 | > cat $1 |
|
165 | > cat $1 | |
166 | > echo "another precious commit message" > "$1" |
|
166 | > echo "another precious commit message" > "$1" | |
167 | > __EOF__ |
|
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 | amending changeset 5f357c7560ab |
|
220 | amending changeset 5f357c7560ab | |
170 | copying changeset 5f357c7560ab to ad120869acf0 |
|
221 | copying changeset 5f357c7560ab to ad120869acf0 |
General Comments 0
You need to be logged in to leave comments.
Login now