几年前,我的一个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 OS X图标文件被忽略的消息外,第一位有效。但是第二部分失败:
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存储库后,迁移工作正常。
读完git-p4 clone后,“新提示...不包含...”失败后,我在没有空格的工作文件夹中重试了迁移;同样的结果。我正在Mac OS X btw上工作,但是Perforce服务器在Debian 7.5虚拟机上运行。
我的问题:
+是否有人建议如何在这里找出问题所在?
+通常可以“堆叠”很多修订历史记录吗?
+谁能想到一种替代方法(除了拥有两个git repos之外)?
我根本不是git专家,但是到目前为止,我几乎可以向它扔东西,而git在弄清楚我想做什么方面做得很好。该Reinitialized existing Git repository
消息似乎表明我还没有完全离开。
将第二部分移植到新的git存储库后,迁移工作正常
那可能是这里可以接受的解决方法的基础:必须分离Git存储库,然后从“如何合并两个git存储库? ”中选择一种技术,以获得一个最终的存储库。
该git filter-branch
方法在“合并多个git存储库”中详细介绍。
(您还有一种基于merge的更简单方法,也在此处进行了描述:OP ssc选择了“合并两个Git存储库而不会破坏文件历史记录”)
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句