2011-12-24 21 views
16

我忘了使用發佈標籤來標記和更舊版本的我的文件。舊版本是r13,最新版本是r65。我將最新版本庫克隆到一個新目錄中,做了一個「hg update -r13」來獲取我想要標記的舊代碼,然後執行了標記命令,但得到了以下消息:Mercurial,如何標記舊版本的文件

abort:not at a branch head (使用-f強制)

在這種情況下使用-f選項安全嗎?

回答

19

我想你仍然可以在repo中做標記,而不必將自己更新爲特定的修訂版本。

汞柱標籤-r 13標記名

看到Mercurial wiki細節。

我試圖測試它:

temp $ hg init . 
temp $ touch a.txt 
temp $ hg add a.txt 
temp $ hg commit -m "added a" 
temp $ hg status 
temp $ echo "sdwwdd" >> a.txt 
temp $ hg commit -m "modified a" 
temp $ echo "\neddwedd" >> a.txt 
temp $ hg commit -m "modified a again" 
temp $ hg log 
changeset: 2:ef40a402fdab 
tag:   tip 
user:  "xxxx" 
date:  Fri Dec 23 16:51:48 2011 -0800 
summary:  modified a again 

changeset: 1:d630dc3e2e3a 
user:  "xxxx" 
date:  Fri Dec 23 16:51:31 2011 -0800 
summary:  modified a 

changeset: 0:7c9917f24515 
user:  "xxxx" 
date:  Fri Dec 23 16:51:04 2011 -0800 
summary:  added a 

輸出:

temp $ hg tag -r 1 a.txt a_1 
temp $ hg tags 
tip        3:e3157256098f 
a_1        1:d630dc3e2e3a 
a.txt        1:d630dc3e2e3a 
temp $ hg tag -r 1 all_1 
temp $ hg tags 
tip        4:a643971911d8 
all_1        1:d630dc3e2e3a 
a_1        1:d630dc3e2e3a 
a.txt        1:d630dc3e2e3a 
相關問題