ได้ลองใช้พวก tag (จริงๆในคู่มือเค้าเรียกว่า keyword) ต่างๆ ของ Subversion ดูแล้วเลยมาเมโม่เก็บไว้
ref: http://svnbook.red-bean.com/en/1.4/svn.advanced.props.special.keywords.html
คีย์เวิร์ด
คีย์เวิร์ดที่ใช้มี 5 อันคือ
Date(alias = LastChangedDate)Revision(alias = LastChangedRevision, Rev)Author(alias = LastChangedBy)- Id (no alias)
- HeadURL (alias = URL)
วิธีการใช้
1. เพิ่มคีย์เวิร์ดเหล่านี้ไว้ในไฟล์ อย่างเช่นในคอมเม้นท์ตรงหัวไฟล์
/* foo.txt initiated 2007/05/052. เซต property
* $Revision$ last committed rev
* $Author$ last committed author
* $Date$ last committed date
* $Id$ last committed Id
* $URL$ head URL
*/
svn:keywords ของไฟล์ foo.txt เพื่อเซตให้คีย์เวิร์ดเหล่านั้นถูกแทนค่าตอนคอมมิต, Subversion จะไม่แทนค่าคีย์เวิร์ดเหล่านี้ถ้าหากเราไม่เซต การเซตให้ LastChangedDate กับ Author ถูกแทนค่าทำได้โดย3. คอมมิตซะ! คีย์เวิร์ดเหล่านี้ก็จะถูกแทนค่าโดยอัตโนมัติตอนคอมมิต$ svn propset svn:keywords "Date Author" foo.txt
property 'svn:keywords' set on 'foo.txt'
นอกจากนี้แล้วการแสดงผลแบบกำหนดความกว้างตายตัวเพื่อความสวยงามสามารถทำได้โดยเพิ่มโคล่อนสองอันไว้หลังคีย์เวิร์ดซะ ใช้รูปแบบ อย่างนี้
$Rev:: $: Revision of last commit
$Author:: $: Author of last commit
$Date:: $: Date of last commit
--
Date
This keyword describes the last time the file was known to have been changed in the repository, and is of the form
$Date: 2006-07-22 21:42:37 -0700 (Sat, 22 Jul 2006) $. It may also be specified asLastChangedDate.RevisionThis keyword describes the last known revision in which this file changed in the repository, and looks something like
$Revision: 144 $. It may also be specified asLastChangedRevisionorRev.AuthorThis keyword describes the last known user to change this file in the repository, and looks something like
$Author: harry $. It may also be specified asLastChangedBy.HeadURLThis keyword describes the full URL to the latest version of the file in the repository, and looks something like
$HeadURL: http://svn.collab.net/repos/trunk/README $. It may be abbreviated asURL.IdThis keyword is a compressed combination of the other keywords. Its substitution looks something like
$Id: calc.c 148 2006-07-28 21:30:43Z sally $, and is interpreted to mean that the filecalc.cwas last changed in revision 148 on the evening of July 28, 2006 by the usersally.
ไม่มีความคิดเห็น:
แสดงความคิดเห็น