我是Git用户,很难与Perfoce一起提交,因此在Windows平台上使用git-p4。我能够在本地计算机上克隆和同步软件仓库,但是无法使用git-p4 Submit在Perforce软件仓库上提交我的更改。
由于git-p4命令不起作用。我从git-p4.py下载了! 。然后执行以下命令:
C:\fold\fold2> python2.7 C:\here\git.p4.py clone //depot/main/Tool/repo2/@all
成功fast-import failed.
C:\fold\fold2> python2.7 C:\here\git.p4.py sync
成功
然后在C:\ fold \ fold2 ... \ repo2 \ utils.py中进行了一些更改
C:\fold\fold2> git add .
C:\fold\fold2> git commit -m "git p4 submit change".
C:\fold\fold2> python2.7 C:\here\git.p4.py submit
提交命令后的操作:
Synchronozing p4 checkout ...
... -files up to date
('Applying', 'bda666969 myuser:git p4 submit change')
//depot/main/Tool/repo2/utils.py#6 - opened for edit
Submission cancelled, undoing p4 changes.
//depot/main/Tool/repo2/utils.py#6 - was edit, reverted
traceback File : "C:\here\git.p4.py line 4172" in module
.....
WindowsError [Error 2] The system can nit find the file specified
这里我不确定哪个文件git-p4出错了,因为我在本地存储库中有utils.py并将相同的utils.py成功提交给了本地主服务器。
我在提交或提交过程中缺少什么吗?
我看到两个可能的错误来源。
首先,同步还不够,您必须重新设置基准。 git p4 sync
仅将新更改从Perforce服务器导入到git存储库中。之后,如果服务器上实际上有新的CL,则可以看到p4/master
分支指向的提交与以前不同。示例:您在提交A处克隆,现在有两个本地提交B和C。因此p4 / master指向A,C指向master。
A-----B-----C
^ ^- master
+- p4/master
现在同步后,导入了两个提交C和E,因此p4 / master指向E。
A-----B-----C
\ ^- master
\
\--D-----E
^- p4/master
git p4 submit
本地更改之前,必须确保所有本地更改都在p4/master
指向的提交之后进行。这就是git p4 rebase
的目的。它需要您进行所有本地更改,然后将其播放回p4/master
:
A-----B-----C
\
\
\--D-----E-----B'----C'
^ ^- master
- p4/master
如果没有其他依赖于C的提交(例如存储),则git将清理干净,您将得到以下结果:
A-----D-----E-----B'----C'
^ ^- master
- p4/master
在同步之后,但在重新设置基准之前,master
和p4/master
可能有共同的祖先。重新设置基准后,p4/master
将是master
的祖先。
我能想到的另一个可能的错误源是您触摸了git p4
以任何方式使用的Perforce工作区。确保为git p4
保留一个Perforce工作区,并且永远不要对其进行任何手动更改。
尽管git p4
在Windows上不受官方支持,但我已经使用了几个月,而且到目前为止,我发现它可以完美地工作。这比必须使用Perforce提供的工具进行日常工作要好得多。