ConvertExtensionのようなものがおそらく必要です。--splicemap
オプションを確認してください。
最初のリビジョンとして.hgignoreファイルを追加して新しい履歴を作成するには:
- 唯一のリビジョンが.hgignorecommitである新しいリポジトリを作成します。
- 現在のデータベースのrev0と新しいデータベースのrev0の2つの40文字のハッシュを含むスプライスマップファイルを作成します。
- 走る
hg convert <current_db_dir> <new_db_dir> --splicemap splice_filename
これにより、現在のデータベースの各リビジョンが新しいデータベースに追加されます。スプライスマップは親の編集を指定するため、現在のデータベースのリビジョン0がその親を新しいデータベースのリビジョン0に設定する場合。
以下は、.hgignoreファイルを含む3リビジョンデータベースと1リビジョンデータベースを作成するWindowsバッチファイルであり、それらをつなぎ合わせます。結果はあなたが探しているものになるはずです。元のデータベースが大きい場合は、ソースデータベースの履歴全体が宛先データベースに再書き込みされるため、時間がかかる場合があります。
@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