几年前,我的一个Perforce仓库(例如//FirstDepot/LargeSubfolder/...)中的一个子文件夹变得太大,无法维护,所以我把它“迁移”到了自己的仓库(例如//NewDepotFromLargeSubfolder/...)。Perforce不支持从一个仓库到另一个仓库的集成,所以我基本上检查了文件,将它们添加到新的仓库,并从子文件夹中删除它们。
现在,我要将整个Perforce服务器迁移到许多git存储库。git p4过程运行得很好,我已经成功地将其他无关的Perforce库迁移到git (包括它们使用@all的完整文件历史--但是,这些仓库从未按照描述的方式在Perforce内部“迁移”)。
问题是我不想丢失//FirstDepot/LargeSubfolder/...下的文件历史记录。其中有几千名变更者(再加上//NewDepotFromLargeSubfolder/...的另外几千名),其中许多包含了非常有价值的信息。
我试图从第一个位置迁移文件历史记录,然后将第二个位置的历史“堆栈”到上面:
host:~ user$ mkdir SomeTempFolder
host:~ user$ cd SomeTempFolder
host:SomeTempFolder user$ export P4PORT=perforce:1666
host:SomeTempFolder user$ git p4 clone //FirstDepot/LargeSubfolder@all gitRepoFolder
Importing from //FirstDepot/LargeSubfolder@all into gitRepoFolder
Initialized empty Git repository in /Users/user/SomeTempFolder/gitRepoFolder/.git/
Import destination: refs/remotes/p4/master
Importing revision 26776 (99%)
Ignoring apple filetype file //FirstDepot/LargeSubfolder/SomePath/SomeIconFile.icns
Importing revision 26778 (100%)因此,除了一条关于Mac图标文件被忽略的消息外,第一位还能工作。然而,第二部分失败了:
host:SomeTempFolder user$ git p4 clone //NewDepotFromLargeSubfolder@all gitRepoFolder
Importing from //NewDepotFromLargeSubfolder@all into gitRepoFolder
Reinitialized existing Git repository in /Users/user/SomeTempFolder/gitRepoFolder/.git/
Import destination: refs/remotes/p4/master
Importing revision 26777 (0%)
Ignoring apple filetype file //NewDepotFromLargeSubfolder/SomePath/SomeIconFile.icns
Importing revision 27142 (33%)
Ignoring apple filetype file //NewDepotFromLargeSubfolder/AnotherPath/Some AppleScript file.scpt
Ignoring apple filetype file //NewDepotFromLargeSubfolder/AnotherPath/Another AppleScript file.scpt
Importing revision 27620 (100%)
fast-import failed: warning: Not updating refs/remotes/p4/master (new tip <some long git ID> does not contain <another long git ID>)
git-fast-import statistics:
<loads of git statistic>使用git p4运行--verbose似乎表明Perforce修订版的实际导入成功完成,但随后发生了一些我不明白的错误:
Importing revision 27620 (100%)commit into refs/remotes/p4/master
Opening pipe: ['p4', '-G', '-x', '-', 'print']
Path/of/the/file/in/the/last/Changelist
Reading pipe: ['git', 'config', '--bool', 'git-p4.importLabels']
Traceback (most recent call last):
File "/usr/libexec/git-core/git-p4", line 3287, in <module>
main()
File "/usr/libexec/git-core/git-p4", line 3281, in main
if not cmd.run(args):
File "/usr/libexec/git-core/git-p4", line 3155, in run
if not P4Sync.run(self, depotPaths):
File "/usr/libexec/git-core/git-p4", line 3030, in run
die("fast-import failed: %s" % self.gitError.read())
File "/usr/libexec/git-core/git-p4", line 106, in die
raise Exception(msg)
Exception: fast-import failed: warning: ... (as above) ...当迁移到一个新的git存储库中时,第二部分的迁移工作得很好。
在阅读失败“新提示.不包含.”之后,我在一个没有空格的工作文件夹中重新尝试了迁移;同样的结果。我正在Mac上工作,但是Perforce服务器正在Debian7.5虚拟机上运行。
我的问题:
我根本不是一个git专家,但到目前为止,我几乎可以抛出一些东西,而且git在找出我想做什么方面做得非常出色;而且Reinitialized existing Git repository的消息似乎表明我并没有完全离开。
发布于 2015-01-26 22:03:55
当迁移到新的git存储库中时,第二部分的迁移工作得很好。
这可能是一个可以接受的解决方案的基础:必须分离Git,并从"如何合并两个git存储库?“中选择一种技术来获得最终的回购。
git filter-branch方法在"组合多个git存储库“中有详细说明。
(您还有一个基于合并的简单方法,也是在此描述:选择的OP ssc "合并两个Git存储库而不破坏文件历史记录")
https://stackoverflow.com/questions/28127479
复制相似问题