Tagging a revision with a file-specified commit message in mercurial?
Is it possible to tag a revision in Mercurial using a file for the message rather than just the -m
argument开发者_开发问答 for specifying a message?
On *nix or Cygwin, you can use the backtick trick:
bash-4.1$ hg init test
bash-4.1$ cd test
bash-4.1$ echo something > a
bash-4.1$ hg ci -A -m "First commit."
adding a
bash-4.1$ echo "Custom tag message" > msg.txt
bash-4.1$ hg tag mytag -m "`cat msg.txt`" # tag message from file
bash-4.1$ hg tags
tip 1:1b6138117d00
mytag 0:679f354e7ec1
bash-4.1$ hg log
changeset: 1:1b6138117d00
tag: tip
user: gavin
date: Tue Mar 29 21:43:55 2011 -0500
summary: Custom tag message
changeset: 0:679f354e7ec1
tag: mytag
user: gavin
date: Tue Mar 29 21:43:22 2011 -0500
summary: First commit.
That somewhat depends on if you are just trying to have a large message as the argument. If that is your goal, then you can just use backticks. Ie:
hg commit -m "`cat myfiletxt`"
You would have to be careful to make sure there are no doublequotes in that file though! There are quite a few gotchas sitting there, but that should get you started at least... Though it's worth mentioning, that requires you to be in a *nix shell of some sort.
Now if you meant to specify a file as a pointer, I do not believe there is currently a method to say 'see (file) for details' presently. Though you could just use that as your commit message. :)
精彩评论