7

会社の Perforce デポから git リポジトリにプロジェクトをインポートしようとしています。単一のブランチを単一の git リポジトリに入れることに成功しましたが、プロジェクト全体とすべてのブランチをプルしたいのですが、正しく動作させることができません。

.p4settings ファイルがあります。

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

Clientspec はかなり単純です。

//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

これにより、すべてのブランチ名などがチェックされ、最初のコミットからインポートが試行されます (この特定のプロジェクトは変更リスト 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の初心者であるため、これが何を意味するのか、この問題を解決する方法、または可能かどうかさえわかりません。誰かが以前に同様の問題に遭遇したことがありますか? もしそうなら、どのように解決しましたか?

4

1 に答える 1

4

私はついにこの問題の解決策を見つけました。PERFORCEブランチマッピングが逆に行われたことが判明し、それがこの問題の原因でした。

Branch-fooはMAINから分岐しました。これには、次のような分岐マッピングが必要です。

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

ただし、ブランチを作成した人がマッピングを逆にしたため、次のようになりました。

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

MAINには#771から始まる最初のチェンジリストがあり、Branch-fooには#7652から始まるチェンジリストがあるため、この混乱したgit-p4は、Branch-fooで親を見つけることができず、クラッシュしました。ブランチの仕様を上記の最初の仕様に変更すると、問題が修正されました。

于 2011-05-23T20:24:19.220 に答える