質問

私は私の会社のPerforce DepotからGitリポジトリにプロジェクトをインポートしようとしています。私は単一のgit Repoに単一のブランチを取得しましたが、プロジェクト全体にすべてのブランチを引いてくださいが、正しく機能してもらうことはできません。

私の.p4settingsファイルを持っています:

P4PORT=perforce-server.local:1666
P4USER=my.username
P4CLIENT=my.clientspec.name
.

クライアントペックはかなり簡単です:

//project/... //my.clientspec.name/project/...
-//project/External/... //my.clientspec.name/project/External/...
.

2行目は、チェックアウトから外部ライブラリバイナリを除外することです。

次のコマンドラインを使用してGit-P4のインポートを開始します。

git p4 clone --verbose --detect-branches --max-changes=100 //project/...@all
.

は、すべてのブランチ名などをチェックし、最初のコミットからインポートしようとしています(このプロジェクトはChangeList 771から始まります)

Importing from //project/...@all into project
Initialized empty Git repository in /Users/grant/Development/git_test/project/.git/
Reading pipe: git config git-p4.useclientspec
Reading pipe: git config git-p4.user
Reading pipe: git config git-p4.password
Reading pipe: git config git-p4.port
Reading pipe: git config git-p4.host
Reading pipe: git config git-p4.client
p4 -G branches
Opening pipe: p4 -G branches
p4 -G branch -o branch-1
Opening pipe: p4 -G branch -o branch-1
Reading pipe: git config --bool core.ignorecase
p4 -G branch -o branch-2
...
Opening pipe: p4 -G branch -o branch-n
p4-git branches: []
initial parents: {}
.

P4-GITの枝があるか、最初の両親がここで空になるはずですが、想定されているが、それらはそうです。

最後に、チェンジリストをgitにインポートしようとしているポイントに着き、次のようになります。

Getting p4 changes for //project/...
p4 changes //project/...
Reading pipe: p4 changes //project/...
p4 -G describe 771
Opening pipe: p4 -G describe 771
Importing revision 771 (1%)branch is MAIN

    Importing new branch RCMerge/MAIN
p4 changes //RCMerge/MAIN/...@1,770
Reading pipe: p4 changes //RCMerge/MAIN/...@1,770

    Resuming with change 771
parent determined through known branches: Branch-foo
looking for initial parent for refs/remotes/p4/project/MAIN; current parent is refs/remotes/p4/project/Branch-foo
commit into refs/remotes/p4/project/MAIN
parent refs/remotes/p4/project/Branch-foo
p4 -G -x - print
Opening pipe: p4 -G -x - print
Glue/source/.empty
fatal: Invalid ref name or SHA1 expression: refs/remotes/p4/project/Branch-foo
fast-import: dumping crash report to .git/fast_import_crash_26002
.

上記のファイルは次のとおりです。

fast-import crash report:
    fast-import process: 26002
    parent process     : 26000
    at Thu May 19 11:51:54 2011

fatal: Invalid ref name or SHA1 expression: refs/remotes/p4/project/Branch-foo

Most Recent Commands Before Crash
---------------------------------
  checkpoint
  commit refs/remotes/p4/project/MAIN
  committer Some User <some.user@domain.com> 1253574589 -0800
  data <<EOT
* from refs/remotes/p4/project/Branch-foo

Active Branch LRU
-----------------
    active_branches = 0 cur, 5 max

  pos  clock name
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Inactive Branches
-----------------
refs/remotes/p4/project/MAIN:
  status      : dirty
  tip commit  : 0000000000000000000000000000000000000000
  old tree    : 0000000000000000000000000000000000000000
  cur tree    : 0000000000000000000000000000000000000000
  commit clock: 0
  last pack   : 


Marks
-----

-------------------
END OF CRASH REPORT
.

今、Perforce初心者であることは、これが何を意味するのか、そしてこの問題を解決する方法、またはそれが可能であるならば、わかりません。誰かが以前にも同様の問題に遭遇しましたか?もしそうなら、あなたはそれをどのように解決しましたか?

役に立ちましたか?

解決

I've finally figured out the solution to this problem. It turns out that a Perforce branch mapping was done in reverse and that was the source of this problem.

Branch-foo was branched off of MAIN, which should have a branch mapping like so:

//project/MAIN/... //project/Branch-foo/...

However, the person who created the branch, reversed the mapping, thus resulting in this:

//project/Branch-foo/... //project/MAIN/...

This confused git-p4 as MAIN had the first changelists starting at #771 and Branch-foo had changelists starting at #7652, thus it couldn't find any parent in Branch-foo and crashed. Changing the branch spec to the first one listed above fixed the probblem.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top