首页 > 解决方案 > 尝试从 Perforce 同步到 GIt,来自不同版本的相同产品

问题描述

我正在尝试从 perforce 同步到 Git,将不同版本的相同产品同步到 diff 分支,我需要每周进行一次。我不需要以其他方式进行(git-> perforce),并且 git repo 不会有任何更改,它只是每周同步的一种方式

  (perforce)//depot/Rel1/cla  -> master in git
  (perforce)//depot/Rel2/cla  -> branch1 in git

 Is there any way to sync both the branches at the same time to git? 
 Is there any way to Sync from the label of each release to git?Instead of the release it self? 
 And as i need to do it weekly, is there way to do just the delta on every next scan? 

我在一定程度上遵循了这个git-p4 migrate 不同子目录中的分支,但是由于我需要同步的最终文件夹名称是相同的,我有点困惑如何把它向前推进

   This is what i tried
    p4 branch -o test | grep //
    //depot/Rel1/... //depot/Rel2/...

   git config git-p4.branchList Rel1:Rel2

    client view - View:
    //depot/... //myws/...

    git init
    git config git-p4.useClientSpec true
    git config git-p4.client myws
    git config git-p4.branchUser myusername
    p4 changes //depot/Rel1/...  | cut -d' ' -f2 >> list.txt
    p4 changes //depot/Rel2/... | cut -d' ' -f2 >>  list.txt
    git p4 sync //depot/... --detect-branches --verbose --changesfile list.txt 

在此之后,命令无限运行了几个小时,我不得不杀死它,之后我跑了

       git branch -a
     remotes/p4/depot/Rel1 (Only Rel1 and no Rel2) 

这是我在日志中看到的,对于 Rel1 看起来不错,对于 Rel2 看起来不太好

                   ^MImporting revision 1998133 (46%)Opening pipe: ['p4', '-c', myws, '-r', '3', '-G', '-x', '-', 'where']
    Opening pipe: ['p4', '-c', myws, '-r', '3', '-G', '-x', '-', 'print']
    branch is Rel1
    looking for initial parent for refs/remotes/p4/depot/Rel1; current parent is
    Parent of refs/remotes/p4/depot/Rel1 not found. Committing into head of
    commit into refs/remotes/p4/depot/Rel1
    ^M//depot/Rel1/cla/depot/bb/cClient/uifclient/src/main/java/com/depotm/crm/isupport/site/popup/properties 100% (0 MB)^M//depot/Rel1/cla/depot/bb/cClient/uifcli
    ent/src/main/java/com/depotm/crm/isupport/site/popup/properties --> cla/depot/bb/cClient/uifclient/src/main/java/com/depotm/crm/isupport/site/popup/Cpro
    perties (0 MB)
    Opening pipe: ['p4', '-c', myws, '-r', '3', '-G', 'describe', '-s', '1998144']
    ^MImporting revision 1998144 (48%)Opening pipe: ['p4', '-c', myws, '-r', '3', '-G', '-x', '-', 'where']
    Opening pipe: ['p4', '-c', myws, '-r', '3', '-G', 'changes', '//depot/Rel2/...@1,513']
    Opening pipe: ['p4', '-c', myws, '-r', '3', '-G', 'changes', '//depot/Rel2/...@514,1026']
    Opening pipe: ['p4', '-c', myws, '-r', '3', '-G', 'changes', '//depot/Rel2/...@1027,1539']
    Opening pipe: ['p4', '-c', myws, '-r', '3', '-G', 'changes', '//depot/Rel2/...@1540,2052']
    Opening pipe: ['p4', '-c', myws, '-r', '3', '-G', 'changes', '//depot/Rel2/...@2053,2565']
    Opening pipe: ['p4', '-c', myws, '-r', '3', '-G', 'changes', '//depot/Rel2/...@2566,3078']
    Opening pipe: ['p4', '-c', myws, '-r', '3', '-G', 'changes', '//depot/Rel2/...@3079,3591']
    Opening pipe: ['p4', '-c', myws, '-r', '3', '-G', 'changes', '//depot/Rel2/...@3592,4104']
    Opening pipe: ['p4', '-c', myws, '-r', '3', '-G', 'changes', '//depot/Rel2/...@4105,4617']
    Opening pipe: ['p4', '-c', myws, '-r', '3', '-G', 'changes', '//depot/Rel2/...@4618,5130']
    Opening pipe: ['p4', '-c', myws, '-r', '3', '-G', 'changes', '//depot/Rel2/...@5131,5643']
    Opening pipe: ['p4', '-c', myws, '-r', '3', '-G', 'changes', '//depot/Rel2/...@5644,6156']

任何帮助/指导表示赞赏

标签: gitperforcegit-p4

解决方案


您拥有其中一个巨大的存储库。不幸的是,至少目前还没有很好的解决方案来解决您的问题。

使用--max-changes <n>仍会在停止之前检查所有更改块。也许使用--changes-block-size <n>减少块数可能会有所帮助。

//depot/...@<n>,<n+1>使用影响的第一个更改列表进行克隆//depot/Rel1/至少可以让您测试分支检测是否正常工作。但如果我没记错的话,随后的调用sync将失败(现在无法确认)。


推荐阅读