您可能需要類似ConvertExtension之類的東西。查看--splicemap
選項。
要創建一個新的歷史添加了作爲第一個版本A .hgignore文件:
- 創建一個新的存儲庫,其唯一的修訂是.hgignore提交。
- 創建一個包含兩個40字符散列的splicemap文件:當前數據庫的rev 0和新數據庫的rev 0。
- 運行
hg convert <current_db_dir> <new_db_dir> --splicemap splice_filename
這增加了每個版本在當前數據庫到新的數據庫。 splicemap指定父項的編輯,所以如果當前數據庫的版本0將其父集設置爲新數據庫的版本0。
下面是一個Windows批處理文件,它創建一個3修訂版數據庫和1修訂版數據庫,其中包含.hgignore文件,將它們拼接在一起。結果應該是你在找什麼。如果您的原始數據庫較大,則可能需要一段時間,因爲源數據庫的整個歷史記錄都會重新寫入目標數據庫。
@echo off
@REM Create a 3-revision database
hg init current
cd current
echo >file1
hg add
hg ci -m file1
echo >file2
hg add
hg ci -m file2
echo >file3
hg add
hg ci -m file3
@REM Add the first revision to the splice map
hg log -r 0 --template "{node} " > ..\map
@REM Display the result
hg log
cd ..
@REM Create a 1-revision database
hg init ignore
cd ignore
echo glob:*.txt>.hgignore
hg add
hg ci -m ignore
@REM Specify this node as the parent of the other
@REM database's first revision in the splice map
hg log -r 0 --template "{node}\n" >> ..\map
hg log
cd ..
@REM Here's the resulting splice map
type map
@REM Make a copy to store the result
hg clone ignore result
@REM Add revisions from "current" to "result" honoring
@REM the splice map
hg convert current result --splicemap map
@REM Display the result
cd result
hg log
hg history被設計爲不可變的。但是,最好的辦法是(1)重新導入整個文件,但在導入之前添加文件或(2)做一些hg隊列跳舞。 – 2010-08-27 23:13:28