我有一个 git 存储库,我想将其镜像到 Perforce 存储库。我已经下载了 git-p4 脚本(不提供弃用警告的较新版本),并且一直在使用它。我已经想出了如何从 Perforce 中提取更改,但是当我尝试从 git repo 同步更改时出现错误。这是我到目前为止所做的:
git clone git@github.com:asdf/qwerty.git
git-p4 sync //depot/path/to/querty
git merge remotes/p4/master (there was a single README file...)
Run Code Online (Sandbox Code Playgroud)
所以,我已经将原点复制到一个干净的新导演,得到了一个看起来很可爱的合并文件树,并git status
表明我是最新的。但:
> git-p4 submit
fatal: Not a valid object name HEAD~261
Command failed: git cat-file commit HEAD~261
Run Code Online (Sandbox Code Playgroud)
git 邮件列表上的这个线程似乎是相关的,但我无法弄清楚他们对所有 A、B 和 C 做了什么。有人可以澄清“无效的对象名称”是什么意思,以及我能做些什么来解决这个问题?我想要做的就是定期将源/主节点快照到 Perforce 中;不需要完整的历史记录。谢谢。
我一直在尝试使用git-p4 python脚本将p4 depot路径导入git.在配置我的环境(git 1.7.1,python 2.7,Windwos XP,p4 env变量)后,我尝试运行git-p4脚本,设置以下ouptut:
F:\gitp4>c:\Python27\python.exe git-p4.py clone --destination=master //depot/quake/main/...@all
Reading pipe: git config git-p4.syncFromOrigin
Importing from //depot/quake/main/...@all into master
Initialized empty Git repository in F:/gitp4/master/.git/
Traceback (most recent call last):
File "git-p4.py", line 1926, in <module>
main()
File "git-p4.py", line 1921, in main
if not cmd.run(args):
File "git-p4.py", line 1798, in run
if not P4Sync.run(self, depotPaths):
File "git-p4.py", line 1501, in run
self.hasOrigin = originP4BranchesExist()
File "git-p4.py", line 439, in originP4BranchesExist
return gitBranchExists("origin") or gitBranchExists("origin/p4") or gitBranchExists("origin/p4/master") …
Run Code Online (Sandbox Code Playgroud) 选择性导入大型 Perforce 存储库的正确方法是什么?
git-p4 文档提到您可以-//depot/main/ignore
切换到过滤目录。这是否等同于运行 agit filter-branch
以在克隆后删除相同的目录?
此外,Perforce 似乎提供了另一个称为“客户端”视图的功能。之前没有用过Perforce,所以对使用模型有点陌生。我目前的理解是,p4
在运行git p4 clone
. 有人有完整的细节吗?
是否有可能以git clone
现有的git p4
资源库,因此将有可能使用git p4
了新的资料库?
这是用例:我有一个带有从 perforce ( git p4 clone <somepath>@all
)克隆的完整存储库的台式机,我想在不接触 p4 服务器的情况下将其克隆到笔记本电脑(链接到它的速度非常慢且滞后)并且能够提交对 perforce 的更改。理想情况下,最好使用git clone --depth
稀疏克隆来减少笔记本电脑磁盘的使用。
今天我可以将一些相当旧的 perforce 存储库迁移到 git。虽然这确实很有趣,但有一件事引起了我的注意。提交消息中的所有特殊字符甚至作者姓名的编码都不正确。
所以我试图调查问题出在哪里。
Unicode clients require a unicode enabled server.
p4 users
wich 实际上在 ANSI 中(咨询 notepad++,或根据file -bi
重定向输出的 ISO-8859-1)locale
显示 LANG=en_US.UTF-8 ...毕竟我的猜测是所有 p4 客户端输出都采用 ISO-8859-1 格式,但 git-p4 假定采用 UTF-8 格式。
我尝试重写提交消息
git filter-branch --msg-filter 'iconv -f iso-8859-1 -t utf-8' -- --all
Run Code Online (Sandbox Code Playgroud)
但这并不能解决问题,特别是因为它无意重写作者姓名。
有人猜测如何在 git-p4 接收输出之前强制将输出转换为 UTF-8 吗?
更新:
我试图用一个简单的 shell 脚本“覆盖”默认的 p4 命令输出,该脚本是我添加到 PATH 中的
/usr/bin/p4 $@ | iconv -f iso-8859-1 -t utf-8
Run Code Online (Sandbox Code Playgroud)
但这会破坏明显使用的编组Python对象:
File "/usr/local/bin/git-p4", line 2467, in getBranchMapping
for …
Run Code Online (Sandbox Code Playgroud) 我想将源代码树从perforce迁移到git.源代码包含分散在perforce depot中的几个dev分支,不一定在同一目录中.例如,结构是这样的 -
//depot/dev/project/master
//depot/dev/project/branch1
//depot/dev/project/branch2
//depot/dev/sub-project/branch3
//depot/dev/sub-project/branch4
//depot/patch-project/branch5
//depot/patch-project/special/developern/branch6
Run Code Online (Sandbox Code Playgroud)
我去了git-p4文档https://git-scm.com/docs/git-p4 BRANCH DETECTION部分以及类似的文章http://forums.perforce.com/index.php?/topic/1395-git- p4和多分支/.
我可以迁移具有历史记录的分支,这些分支是直接父母的
//depot/dev/project/branch1 and
//depot/dev/project/branch2
Run Code Online (Sandbox Code Playgroud)
我无法实现的是如何一次将所有六个分支迁移到一起.
我在指定分支规范后尝试在// depot @ all级别上运行迁移,但由于perforce服务器很大,它会失败,它会产生maxresults异常或会话超时.有人可以指导如何处理这种情况吗?
我看到的另一个选项是单独迁移分支(一个分支到一个git repo),然后将所有分支合并到一个新的git repo中.我不确定这样做会产生什么影响/不利影响.
Thanks and Regards,
Amar Kumbhar.
Run Code Online (Sandbox Code Playgroud) 所以,我可以使用git-p4从p4导入而没有任何问题.一切似乎都有效,但我的PNG文件(或许还有其他文件)正在被破坏.
我已经阅读了gitattributes和行结束问题,但我没做什么似乎改变了最终结果.破碎的图像.
我的属性文件是:*.png二进制文件
有任何想法吗?据我了解,git应该足够聪明,可以发现png是一个没有这个帮助的二进制文件.
这与p4-git如何从Perforce中提取文件有什么关系?
更新:这是在Windows上.我忘了这很重要.
我正在尝试从Perforce迁移到Git.我们的发展结构如下:
版本1.3.0已创建,开发,发布到生产中.继续发展,版本1.3.1已经分支和开发等.
目前,我们有一大堆版本以递增的顺序创建.我的任务是将这些版本作为连续分支导入,即分支1.3.1来自1.3.0; 分支1.4.0来自分支1.3.1等...
我使用以下命令集:
git init
git config --add git-p4.branchList 1.3.0:1.3.1
#continue configuration for all of the branches
git p4 sync --detect-branches //depot/path/to/code@all
Run Code Online (Sandbox Code Playgroud)
最终的branchList配置看起来像这样:
[git-p4]
branchList = 1.3.0:1.3.0
branchList = 1.3.0:1.3.1
branchList = 1.3.1:1.4.0
branchList = 1.4.0:1.5.0
etc...
Run Code Online (Sandbox Code Playgroud)
当我运行上面的命令时,我收到一个错误:
Importing revision 457240 (18%)
Importing new branch common/1.4.0
Resuming with change 457240
fatal: ambiguous argument 'refs/remotes/p4/common/1.3.1': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
Command …
Run Code Online (Sandbox Code Playgroud) 我有一台笔记本电脑和一台台式机,我正在努力学习使用git来管理我对perforce存储库的工作.我在桌面上成功使用git-p4,并且可以在笔记本电脑上成功使用它.但是,我希望能够做的事情之一就是"拉"或"推"更改从笔记本电脑到桌面,反之亦然,而不先将它们检入到与git同步的p4分支.
所以,这就是我设置两个回购的方法:1)使用git-p4 clone在我的桌面上设置一个repo.做一些工作,做几个提交git,几个提交到git-p4.一切都按预期工作.2)之后,在我的笔记本电脑上设置一个回购,准备在两台机器上工作.同样地,使用git-p4来复制现在的当前p4 repo(现在已经检查过几次修改,我在(1)中执行了git-p4.
现在,我希望做的事情:1)在桌面上做一些工作.将工作交给git,但不是p4.2)转到笔记本电脑,从桌面回购中做一个git pull ... 3)继续我的笔记本电脑工作,定期做git.4)(可选)从笔记本电脑提交p4 5)(可选)推送到桌面(或从笔记本电脑拉到桌面)并继续在桌面上工作等.
基本上,我希望能够在笔记本电脑和台式机之间来回推送/拉出东西,而无需实际登录到p4.
这听起来应该是可能的吗?如果是这样,我上面有错误的步骤吗?
以下是持续发生的事情:当我尝试在上面的(2)中执行"拉"时,我收到错误消息,说明存在冲突 - 这些冲突与p4分支的第一次检出之间发生的变化有关,第二个git-p4 repo创建的时间.换句话说,它们似乎是对第二个回购包含的代码中应该已经存在的更改的重放,但出于某种原因,它们不是.
我对git很新,所以我希望我的问题不是愚蠢或不可能理解.在此先感谢您提供任何帮助.
在我当前的设置中,在 Perforce 仓库中所做的所有更改都迁移到了 git 存储库。转移是一种方式,总是从 Perforce 到 git,而不是相反。使用git p4 clone
将 depot 复制到新的 git repo没有问题,但是,我现在正在尝试使用git p4 sync
,并且我的 repo 没有更新。
当我运行时git p4 sync
,它确实显示了从 Perforce depot 导入新更改的状态消息。如果我再次运行该命令,它会说一切都是最新的。我的master
分支没有更改,并且我的存储库中没有列出任何其他分支或远程(例如使用git branch -v
和git remote -v
。我如何检查这些更改?
(使用git version 2.3.2 (Apple Git-55)
)。
我正在尝试将项目从Perforce迁移到Git.我正在使用git-p4
我的主要工具为我做繁重的工作,默认情况下在Windows上使用Git:
C:\Program Files\Git\mingw64\libexec\git-core\git-p4
.
继迁移Perforce公司在Windows到Git,我已经到了我执行我的命令克隆步骤:git p4 clone <PerforceRepo>
(其中P4是文件git-p4.py的别名)
我一直收到错误:
选项无效:-r.
C:\P4-To-Git>git p4 clone //depot/C:\build\mainline@all .
Importing from //depot/C:/build/mainline@all into .
Reinitialized existing Git repository in C:/P4-To-Git/.git/
Perforce client error:
p4 -h for usage.
Invalid option: -r.
Traceback (most recent call last):
File "C:\Program Files\Git\mingw64\libexec\git-core\git-p4", line 3840, in <module>
main()
File "C:\Program Files\Git\mingw64\libexec\git-core\git-p4", line 3834, in main
if not cmd.run(args):
File "C:\Program Files\Git\mingw64\libexec\git-core\git-p4", line 3706, in run
if not P4Sync.run(self, depotPaths):
File "C:\Program Files\Git\mingw64\libexec\git-core\git-p4", line …
Run Code Online (Sandbox Code Playgroud)