comparison tests/test-tag.t @ 21237:0054a77f49df

localrepo: add "editor" argument to "tag()" Before this patch, "localrepository.tag()" doesn't take "editor" argument, and this prevents callers from passing "editor" argument to "localrepository.commit()" invoked internally. This patch adds "editor" argument to "localrepository.tag()" (and "_tag()", too), and makes "commands.tag()" invoke it with "editor" argument. This patch also omits explicit "localrepository.savecommitmesssage()" invocation, because "localrepository.commit()" will invoke specified "editor" and save edited commit message into ".hg/last-message.txt" automatically.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Mon, 05 May 2014 21:26:40 +0900
parents bcfc4f625e57
children d4b8fc753455
comparison
equal deleted inserted replaced
21236:49148d7868df 21237:0054a77f49df
223 > echo "second line" >> "$1" 223 > echo "second line" >> "$1"
224 > __EOF__ 224 > __EOF__
225 225
226 at first, test saving last-message.txt 226 at first, test saving last-message.txt
227 227
228 (test that editor is not invoked before transaction starting)
229
228 $ cat > .hg/hgrc << '__EOF__' 230 $ cat > .hg/hgrc << '__EOF__'
229 > [hooks] 231 > [hooks]
232 > # this failure occurs before editor invocation
230 > pretag.test-saving-lastmessage = false 233 > pretag.test-saving-lastmessage = false
231 > __EOF__ 234 > __EOF__
232 $ rm -f .hg/last-message.txt 235 $ rm -f .hg/last-message.txt
233 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg tag custom-tag -e 236 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg tag custom-tag -e
234 abort: pretag.test-saving-lastmessage hook exited with status 1 237 abort: pretag.test-saving-lastmessage hook exited with status 1
235 [255] 238 [255]
236 $ cat .hg/last-message.txt 239 $ cat .hg/last-message.txt
240 cat: .hg/last-message.txt: No such file or directory
241 [1]
242
243 (test that editor is invoked and commit message is saved into
244 "last-message.txt")
245
246 $ cat >> .hg/hgrc << '__EOF__'
247 > [hooks]
248 > pretag.test-saving-lastmessage =
249 > # this failure occurs after editor invocation
250 > pretxncommit.unexpectedabort = false
251 > __EOF__
252
253 $ rm -f .hg/last-message.txt
254 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg tag custom-tag -e
255 transaction abort!
256 rollback completed
257 note: commit message saved in .hg/last-message.txt
258 abort: pretxncommit.unexpectedabort hook exited with status 1
259 [255]
260 $ cat .hg/last-message.txt
237 custom tag message 261 custom tag message
238 second line 262 second line
239 $ cat > .hg/hgrc << '__EOF__' 263
264 $ cat >> .hg/hgrc << '__EOF__'
240 > [hooks] 265 > [hooks]
241 > pretag.test-saving-lastmessage = 266 > pretxncommit.unexpectedabort =
242 > __EOF__ 267 > __EOF__
268 $ hg status .hgtags
269 M .hgtags
270 $ hg revert --no-backup -q .hgtags
243 271
244 then, test custom commit message itself 272 then, test custom commit message itself
245 273
246 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg tag custom-tag -e 274 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg tag custom-tag -e
247 $ hg log -l1 --template "{desc}\n" 275 $ hg log -l1 --template "{desc}\n"