git p4:迁移完整历史记录-包括集成历史记录

ssc

几年前,我的一个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] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

如何清除git历史记录?

来自分类Dev

添加缺少的git历史记录

来自分类Dev

从TFS迁移-> GIT ...如何保留分支的历史记录

来自分类Dev

从CVS迁移到Git,而不会丢失历史记录

来自分类Dev

需要已经迁移的 SVN-GIT 的历史记录

来自分类Dev

如何始终显示Git的完整历史记录?

来自分类Dev

使用非标准的SVN布局从SVN迁移到Git(需要完整的历史记录)

来自分类Dev

从git删除历史记录-git命令失败

来自分类Dev

如何查看Git分支随时间的变化(包括历史记录重写)?

来自分类Dev

git保存已解决的合并冲突的历史记录

来自分类Dev

git:合并分支但保留提交历史记录

来自分类Dev

如何撤消git合并,但保留历史记录

来自分类Dev

如何连接未连接的git历史记录?

来自分类Dev

如何从git历史记录中提取提交?

来自分类Dev

“ git squash”(推送后)是否重写历史记录?

来自分类Dev

将CVS的历史记录转移到GIT

来自分类Dev

Git从合并和历史记录中排除文件

来自分类Dev

从git历史记录中删除未使用的资产

来自分类Dev

git删除某些提交后的远程历史记录

来自分类Dev

如何从git历史记录中完全删除提交

来自分类Dev

整理或删除git历史记录以进行发布?

来自分类Dev

git tfs具有部分历史记录的克隆

来自分类Dev

按日期对git commit历史记录重新排序

来自分类Dev

在git上重命名文件并保留历史记录

来自分类Dev

显示git commit历史记录的差异

来自分类Dev

作者的Git Squash顺序提交以压缩历史记录

来自分类Dev

从git历史记录中删除提交(永远)

来自分类Dev

使用Git强制文件历史记录关联

来自分类Dev

git在保持历史记录的同时移动文件

Related 相关文章

热门标签

归档