我正在处理一个存储库,该存储库的根在其历史中已经移动了一些(从trunk/开始,移动到subproject/trunk)。现在,我可以使用hgsubversion处理所有历史,直到它移动到子项目/主干时为止(请参阅https://bitbucket.org/durin42/hgsubversion/issue/135/move-tracking),或我可以使用hgconvert或rebase将历史拼接到一个有凝聚力的存储库中。
在拼接并调用hg-svn-rebuildmeta之后,hgsubversion就完全混乱了。svn存储库中的新修订被拉到一个名为"../".的分支中
基本上,我想知道是否可以告诉hgsubversion使用某个svn修订版作为其参考点,只尝试从那时起同步历史?
下面是一个小测试,说明了这个问题(对不起DOS命令)
C:hgtest>svnadmin create svnrepo
C:hgtest>svn co file:///C:/hgtest/svnrepo svncheckout
Checked out revision 0.
C:hgtest>cd svncheckout
C:hgtestsvncheckout>mkdir trunk/
The syntax of the command is incorrect.
C:hgtestsvncheckout>svn mkdir trunk
A trunk
C:hgtestsvncheckout>cd trunk
C:hgtestsvncheckouttrunk>echo "Test file version 1" > testfile.txt
C:hgtestsvncheckouttrunk>cd ..
C:hgtestsvncheckout>svn add trunktestfile.txt
A trunktestfile.txt
C:hgtestsvncheckout>svn ci -m "Original version in trunk configuration"
Adding trunk
Adding trunktestfile.txt
Transmitting file data .
Committed revision 1.
C:hgtestsvncheckout>svn mkdir subproject
A subproject
C:hgtestsvncheckout>svn mv trunk subproject
A subprojecttrunk
D trunk
D trunktestfile.txt
C:hgtestsvncheckout>svn ci -m "Moved trunk to subproject/trunk"
Adding subproject
Adding subprojecttrunk
Deleting trunk
Committed revision 2.
C:hgtestsvncheckout>echo ". Adding some text to distinguish the subproject/trunk version of this file" >> subprojecttrunktestfile.txt
C:hgtestsvncheckout>svn ci -m "Final version of testfile.txt"
Sending subprojecttrunktestfile.txt
Transmitting file data .
Committed revision 3.
C:hgtestsvncheckout>svn log subprojecttrunktestfile.txt
------------------------------------------------------------------------
r3 | kmahan | 2012-02-17 09:18:23 -0800 (Fri, 17 Feb 2012) | 1 line
Final version of testfile.txt
------------------------------------------------------------------------
r2 | kmahan | 2012-02-17 09:17:40 -0800 (Fri, 17 Feb 2012) | 1 line
Moved trunk to subproject/trunk
------------------------------------------------------------------------
r1 | kmahan | 2012-02-17 09:14:46 -0800 (Fri, 17 Feb 2012) | 1 line
Original version in trunk configuration
------------------------------------------------------------------------
C:hgtest>hg clone svn://localhost:22222/subproject/trunk hgrepo
[r2] kmahan: Moved trunk to subproject/trunk
[r3] kmahan: Final version of testfile.txt
pulled 2 revisions
updating to branch default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
C:hgtest>cd hgrepo
C:hgtesthgrepo>dir
Volume in drive C is OSDisk
Volume Serial Number is 74C7-4865
Directory of C:hgtesthgrepo
02/17/2012 09:30 AM <DIR> .
02/17/2012 09:30 AM <DIR> ..
02/17/2012 09:30 AM <DIR> .hg
02/17/2012 09:30 AM 104 testfile.txt
1 File(s) 104 bytes
3 Dir(s) 1,705,932,423,168 bytes free
C:hgtesthgrepo>hg log --follow testfile.txt
changeset: 1:eae92a250a90
tag: tip
user: kmahan@b3f284a4-0405-ad4c-b974-dac5aa90a095
date: Fri Feb 17 17:18:23 2012 +0000
summary: Final version of testfile.txt
changeset: 0:10c6ad198001
user: kmahan@b3f284a4-0405-ad4c-b974-dac5aa90a095
date: Fri Feb 17 17:17:40 2012 +0000
summary: Moved trunk to subproject/trunk
C:hgtest>hg clone svn://localhost:22222/trunk -r 1 original-location
[r1] kmahan: Original version in trunk configuration
pulled 1 revisions
updating to branch default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
C:hgtest>cd hgrepo
C:hgtesthgrepo>hg pull -f ..original-location
pulling from ..original-location
searching for changes
warning: repository is unrelated
requesting all changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 0 changes to 1 files (+1 heads)
(run 'hg heads' to see heads, 'hg merge' to merge)
C:hgtesthgrepo>hg log
changeset: 2:f968692b6301
tag: tip
parent: -1:000000000000
user: kmahan@b3f284a4-0405-ad4c-b974-dac5aa90a095
date: Fri Feb 17 17:14:46 2012 +0000
summary: Original version in trunk configuration
changeset: 1:eae92a250a90
user: kmahan@b3f284a4-0405-ad4c-b974-dac5aa90a095
date: Fri Feb 17 17:18:23 2012 +0000
summary: Final version of testfile.txt
changeset: 0:10c6ad198001
user: kmahan@b3f284a4-0405-ad4c-b974-dac5aa90a095
date: Fri Feb 17 17:17:40 2012 +0000
summary: Moved trunk to subproject/trunk
C:hgtesthgrepo>hg rebase -s 0 -d 2
saved backup bundle to C:hgtesthgrepo.hgstrip-backup10c6ad198001-backup.hg
C:hgtesthgrepo>hg log
changeset: 1:ee10af28394f
tag: tip
user: kmahan@b3f284a4-0405-ad4c-b974-dac5aa90a095
date: Fri Feb 17 17:18:23 2012 +0000
summary: Final version of testfile.txt
changeset: 0:f968692b6301
user: kmahan@b3f284a4-0405-ad4c-b974-dac5aa90a095
date: Fri Feb 17 17:14:46 2012 +0000
summary: Original version in trunk configuration
C:hgtesthgrepo>hg svn rebuildmeta
C:hgtesthgrepo>hg pull
pulling from svn://localhost:22222/subproject/trunk
[r2] kmahan: Moved trunk to subproject/trunk
Marked branch ../ as closed.
[r3] kmahan: Final version of testfile.txt
no changes found
C:hgtesthgrepo>echo "Here's some more text" >> testfile.txt
C:hgtesthgrepo>hg ci -m "Test commit from mercurial side"
C:hgtesthgrepo>hg glog
o changeset: 5:a0e38c8fcfaf
| branch: ../
| tag: tip
| user: kmahan@b3f284a4-0405-ad4c-b974-dac5aa90a095
| date: Fri Feb 17 17:43:38 2012 +0000
| summary: Added new text from the svn side
|
o changeset: 4:39fe2d8d743c
| branch: ../
| parent: 0:f968692b6301
| user: kmahan@b3f284a4-0405-ad4c-b974-dac5aa90a095
| date: Fri Feb 17 17:18:23 2012 +0000
| summary: Final version of testfile.txt
|
| o changeset: 3:4a494fcf85f1
|/ branch: ../
| parent: 0:f968692b6301
| user: kmahan@b3f284a4-0405-ad4c-b974-dac5aa90a095
| date: Fri Feb 17 17:17:40 2012 +0000
| summary: Moved trunk to subproject/trunk
|
| @ changeset: 2:547ed469c516
| | user: Kyle Mahan <kmahan@redacted.com>
| | date: Fri Feb 17 09:33:07 2012 -0800
| | summary: Test commit from mercurial side
| |
| o changeset: 1:ee10af28394f
|/ user: kmahan@b3f284a4-0405-ad4c-b974-dac5aa90a095
| date: Fri Feb 17 17:18:23 2012 +0000
| summary: Final version of testfile.txt
|
o changeset: 0:f968692b6301
user: kmahan@b3f284a4-0405-ad4c-b974-dac5aa90a095
date: Fri Feb 17 17:14:46 2012 +0000
summary: Original version in trunk configuration
是的,但这将是一个手动过程。您需要找到每个分支的高水位线修订,并将其记录在元数据文件中(目前我无法识别其名称)。在这一点上,事情应该基本上是可行的。
注:这是一个理论。根据我对代码的记忆,我很有信心它应该能工作,但我从未测试过它
基本上,我想知道是否可以告诉hgsubversion使用某个svn修订版作为其参考点,只尝试从那时起同步历史?
若我理解正确,那个么克隆命令需要--startrev选项。来自hg help subversion
有时,过去的存储库历史记录很少或根本不感兴趣,并且一个人所想要的就是从今天开始并向前努力。使用"--startrev HEAD"使初始克隆只转换最新的修订稍后的拉动将转换所有后续修订。请注意,这只适用于单目录克隆