是否可以(重新)将 hgsubversion 连接到手动构建的存储库?

发布于 2025-01-06 20:47:25 字数 7282 浏览 0 评论 0原文

我正在使用一个存储库,其根在其历史记录中已经移动过一些(从 trunk/ 开始,移动到 subproject/trunk)。现在,我可以使用 hgsubversion 来处理所有历史记录,直到它移动到 subproject/trunk 为止(请参阅 https://bitbucket.org/durin42/hgsubversion/issue/135/move-tracking), 或者我可以使用 hg Convert 或 rebase 将历史记录拼接到一个内聚的存储库中。

拼接后调用hg svnrebuildmeta,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:\hgtest\svncheckout>mkdir trunk/
The syntax of the command is incorrect.

C:\hgtest\svncheckout>svn mkdir trunk
A         trunk

C:\hgtest\svncheckout>cd trunk

C:\hgtest\svncheckout\trunk>echo "Test file version 1" > testfile.txt

C:\hgtest\svncheckout\trunk>cd ..

C:\hgtest\svncheckout>svn add trunk\testfile.txt
A         trunk\testfile.txt

C:\hgtest\svncheckout>svn ci -m "Original version in trunk configuration"
Adding         trunk
Adding         trunk\testfile.txt
Transmitting file data .
Committed revision 1.

C:\hgtest\svncheckout>svn mkdir subproject
A         subproject

C:\hgtest\svncheckout>svn mv trunk subproject
A         subproject\trunk
D         trunk
D         trunk\testfile.txt

C:\hgtest\svncheckout>svn ci -m "Moved trunk to subproject/trunk"
Adding         subproject
Adding         subproject\trunk
Deleting       trunk

Committed revision 2.

C:\hgtest\svncheckout>echo ". Adding some text to distinguish the subproject/trunk version of this file" >> subproject\trunk\testfile.txt

C:\hgtest\svncheckout>svn ci -m "Final version of testfile.txt"
Sending        subproject\trunk\testfile.txt
Transmitting file data .
Committed revision 3.

C:\hgtest\svncheckout>svn log subproject\trunk\testfile.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:\hgtest\hgrepo>dir
 Volume in drive C is OSDisk
 Volume Serial Number is 74C7-4865

 Directory of C:\hgtest\hgrepo

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:\hgtest\hgrepo>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:\hgtest\hgrepo>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:\hgtest\hgrepo>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:\hgtest\hgrepo>hg rebase -s 0 -d 2
saved backup bundle to C:\hgtest\hgrepo\.hg\strip-backup\10c6ad198001-backup.hg

C:\hgtest\hgrepo>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:\hgtest\hgrepo>hg svn rebuildmeta

C:\hgtest\hgrepo>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:\hgtest\hgrepo>echo "Here's some more text" >> testfile.txt

C:\hgtest\hgrepo>hg ci -m "Test commit from mercurial side"

C:\hgtest\hgrepo>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 <[email protected]>
| |  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

I am working with a repository whose root has moved around some in its history (started at trunk/, moved to subproject/trunk). Right now I can either use hgsubversion to work with all the history up to the point when it moved to subproject/trunk (see https://bitbucket.org/durin42/hgsubversion/issue/135/move-tracking), or I can use hg convert or rebase to splice together the histories into one cohesive repository.

After splicing and calling hg svn rebuildmeta, hgsubversion is all confused. New revisions in the svn repository are pulled into a branch called "../".

Basically, I'm wondering if it's possible to tell hgsubversion to use a certain svn revision as its reference point, only attempting to sync up the histories from that point forward?

Here is a small test illustrating the issue (sorry for the DOS commands)

C:\hgtest>svnadmin create svnrepo

C:\hgtest>svn co file:///C:/hgtest/svnrepo svncheckout
Checked out revision 0.

C:\hgtest>cd svncheckout

C:\hgtest\svncheckout>mkdir trunk/
The syntax of the command is incorrect.

C:\hgtest\svncheckout>svn mkdir trunk
A         trunk

C:\hgtest\svncheckout>cd trunk

C:\hgtest\svncheckout\trunk>echo "Test file version 1" > testfile.txt

C:\hgtest\svncheckout\trunk>cd ..

C:\hgtest\svncheckout>svn add trunk\testfile.txt
A         trunk\testfile.txt

C:\hgtest\svncheckout>svn ci -m "Original version in trunk configuration"
Adding         trunk
Adding         trunk\testfile.txt
Transmitting file data .
Committed revision 1.

C:\hgtest\svncheckout>svn mkdir subproject
A         subproject

C:\hgtest\svncheckout>svn mv trunk subproject
A         subproject\trunk
D         trunk
D         trunk\testfile.txt

C:\hgtest\svncheckout>svn ci -m "Moved trunk to subproject/trunk"
Adding         subproject
Adding         subproject\trunk
Deleting       trunk

Committed revision 2.

C:\hgtest\svncheckout>echo ". Adding some text to distinguish the subproject/trunk version of this file" >> subproject\trunk\testfile.txt

C:\hgtest\svncheckout>svn ci -m "Final version of testfile.txt"
Sending        subproject\trunk\testfile.txt
Transmitting file data .
Committed revision 3.

C:\hgtest\svncheckout>svn log subproject\trunk\testfile.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:\hgtest\hgrepo>dir
 Volume in drive C is OSDisk
 Volume Serial Number is 74C7-4865

 Directory of C:\hgtest\hgrepo

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:\hgtest\hgrepo>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:\hgtest\hgrepo>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:\hgtest\hgrepo>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:\hgtest\hgrepo>hg rebase -s 0 -d 2
saved backup bundle to C:\hgtest\hgrepo\.hg\strip-backup\10c6ad198001-backup.hg

C:\hgtest\hgrepo>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:\hgtest\hgrepo>hg svn rebuildmeta

C:\hgtest\hgrepo>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:\hgtest\hgrepo>echo "Here's some more text" >> testfile.txt

C:\hgtest\hgrepo>hg ci -m "Test commit from mercurial side"

C:\hgtest\hgrepo>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 <[email protected]>
| |  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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

成熟的代价 2025-01-13 20:47:25

是的,但这将是一个手动过程。您需要找到每个分支的高水位线修订版并将其记录在元数据文件中(目前我不知道其名称)。到那时,事情应该大部分正常了。

注:这是一个理论。我非常有信心它应该根据我对代码的记忆来工作,但我从未测试过它。

Yes, but it'll be a manual process. You'll need to find the high water mark revision for each branch and record it in the metadata files (the names of which escape me at the moment). At that point, things should mostly work.

Note: this is a theory. I have high confidence that it should work based on my memory of the code, but I've never tested it.

向地狱狂奔 2025-01-13 20:47:25

基本上,我想知道是否可以告诉 hgsubversion 使用某个 svn 修订版作为其参考点,仅尝试同步从该点开始的历史记录?

如果我理解正确的话,您想要克隆命令的 --startrev 选项。来自hg help subversion

有时,过去的存储库历史很少或没有兴趣,并且
人们所希望的只是从今天开始,努力向前。使用
“--startrev HEAD”导致初始克隆仅转换最新的
修订;稍后的拉取将转换所有后续修订。请
请注意,这仅适用于单目录克隆

Basically, I'm wondering if it's possible to tell hgsubversion to use a certain svn revision as its reference point, only attempting to sync up the histories from that point forward?

If I understood you correctly, you wanted --startrev option for clone command. From hg help subversion

Sometimes, past repository history is of little or no interest, and
all one wants is to start from today and work forward. Using
"--startrev HEAD" causes the initial clone to only convert the latest
revision; later pulls will convert all subsequent revisions. Please
note that this only works for single-directory clones

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文