gpt4 book ai didi

windows - 如何在 Windows 中运行 git-p4?

转载 作者:IT王子 更新时间:2023-10-29 01:15:26 24 4
gpt4 key购买 nike

看起来 git-p4 不是 Windows 的 MSys-Git 项目的一部分。有人知道如何让它通过 Windows 运行吗?

最佳答案

2019 年 7 月更新,“Git P4 clone broken”问题现在由 Gabriel Morin 提及:

[alias]
p4 = !python.exe 'c:\\program files\\Git\\mingw64\\libexec\\git-core\\git-p4'

Then using git p4 from the command line worked.


借助 Git 2.32(2021 年第 2 季度),git p4 学会了更高效地查找分支点。

参见 commit 6b79818 , commit c3ab088 (2021 年 5 月 5 日)Joachim Kuebart (jkuebart) .
(由 Junio C Hamano -- gitster -- merge 于 commit e289f68,2021 年 5 月 14 日)

git-p4: speed up search for branch parent

Signed-off-by: Joachim Kuebart
Helped-by: Junio C Hamano
Helped-by: Luke Diamand

For every new branch that git-p4 imports, it needs to find the commit where it branched off its parent branch.
While p4 doesn't record this information explicitly, the first changelist on a branch is usually an identical copy of the parent branch.

The method searchParent() tries to find a commit in the history of the given "parent" branch whose tree exactly matches the initial changelist of the new branch, "target".
The code iterates through the parent commits and compares each of them to this initial changelist using diff-tree.

Since we already know the tree object name we are looking for, spawning diff-tree for each commit is wasteful.

Use the "--format" option of "rev-list" to find out the tree object name of each commit in the history, and find the tree whose name is exactly the same as the tree of the target commit to optimize this.

This results in a considerable speed-up, at least on Windows.
On one Windows machine with a fairly large repository of about 16000 commits in the parent branch, the current code takes over 7 minutes, while the new code only takes just over 10 seconds for the same changelist:

Before:

$ time git p4 sync
Importing from/into multiple branches
Depot paths: //depot
Importing revision 31274 (100.0%)
Updated branches: b1

real 7m41.458s
user 0m0.000s
sys 0m0.077s

After:

$ time git p4 sync
Importing from/into multiple branches
Depot paths: //depot
Importing revision 31274 (100.0%)
Updated branches: b1

real 0m10.235s
user 0m0.000s
sys 0m0.062s

2020 年 3 月更新

在 Git 2.27(2020 年第 2 季度)中,“git p4”已更新为可与 Python 3 一起使用。

参见 commit 6bb40ed (2020 年 1 月 23 日)作者:SZEDER Gábor (szeder) .
参见 commit 7575f4f , commit ce425eb , commit 2e2aa8d , commit a6b1306 , commit 4294d74 , commit 50da1e7 , commit 5a5577d , commit d38208a , commit 86dca24 , commit 6cec21a , commit 1f8b46d , commit 0b4396f (2019 年 12 月 13 日)Yang Zhao (yangminz) .
参见 commit 484d09c (2019 年 12 月 13 日)Ben Keene (seraphire) .
(由 Junio C Hamano -- gitster -- merge 于 commit 9a0fa17 ,2020 年 3 月 25 日)

ci: use python3 in linux-gcc and osx-gcc and python2 elsewhere

Signed-off-by: SZEDER Gábor

Python2 reached end of life, and we have been preparing our Python scripts to work with Python3.

'git p4', the main in-tree user of Python, has just received a number of compatibility updates.

这仅记录在 Git 2.30(2021 年第一季度)中 commit 263dc0 .


2018 年 7 月更新:

Git 2.19(2018 年第 3 季度)将开始为 git p4 带来 Python 3 支持。

参见 commit db2d997 , commit f2606b1 , commit efdcc99 , commit 4d88519 , commit dba1c9d , commit fc35c9d (2018 年 6 月 19 日)作者:Luke Diamand (luked99) .
(由 Junio C Hamano -- gitster -- merge 于 commit 6dcd364 ,2018 年 7 月 18 日)

Code preparation to make "git p4" closer to be usable with Python 3.


2016 年 1 月更新:

自 2010 年以来,contrib/fast-import/git-p4.README自 2012 年 4 月以来的提及

git-p4 脚本移动到 git 源目录的顶层。请注意,顶级 git-p4.py 脚本现在是源代码

Windows users can copy the git-p4.py source script directly, possiblyinvoking it through a batch file called "git-p4.bat" in the same folder.
It should contain just one line:

@python "%~d0%~p0git-p4.py" %*

(虽然这个2013 article is invoking git-p4.py directly)


原始答案(2010 年 4 月)

如“Why Perforce is more scalable than Git”中所述,注意不要在 Git 任何 p4 存储库中导入。 Git 无法处理 P4 可以管理的那种巨大的独特 repo 。

Git-P4 在 Python 中,它应该在 Windows 上运行(如 this question )

您可以 grab git-p4.py here并将其用作 git-p4.bat

@python "%~d0%~p0git-p4" %*

它需要安装 Python 2.x。

别忘了还有 another approach as well .

关于windows - 如何在 Windows 中运行 git-p4?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2646380/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com