Kester
Kester

Reputation: 99

git p4 sync operation failure

I am using "git-p4" script for migration from p4 to GIT. clone operation is failing due to large number of change list (about 5 million). So I am trying to perform incremental import operation: I tried to clone for first run then sync operation. I tested with small changes list.

First run:

git p4 clone //depot/f1/f2/f3/ere@17888479,17918050 -v

Second run:

git p4 sync //depot/f1/f2/f3/ere@17918051,17918064 -v     

Error:

Traceback (most recent call last):
  File "C:\Program Files\Git\mingw64/libexec/git-core\git-p4", line 3677, in <module>
    main()
  File "C:\Program Files\Git\mingw64/libexec/git-core\git-p4", line 3671, in main
    if not cmd.run(args):
  File "C:\Program Files\Git\mingw64/libexec/git-core\git-p4", line 3429, in run
    die("fast-import failed: %s" % self.gitError.read())
  File "C:\Program Files\Git\mingw64/libexec/git-core\git-p4", line 122, in die
    raise Exception(msg)
Exception: fast-import failed: warning: Not updating refs/remotes/p4/master (new tip 85c94d84335bb1441a7f959b384729b2a4d633f4 does not contain 3222bdc29799d1fe5fff91c36524481b1469f1d9)

Upvotes: 4

Views: 1470

Answers (2)

VonC
VonC

Reputation: 1330082

There is a similar case described recently during a git-fast-import process

With Git 2.26 (Q1 2020), git-p4 should be more robust around that edge-case.

See commit 43f33e4 (30 Jan 2020), and commit 19fa5ac, commit 6026aff, commit ca5b5cc, commit 4c1d586, commit 5c3d502, commit 837b3a6 (29 Jan 2020) by Luke Diamand (ldiamand42).
(Merged by Junio C Hamano -- gitster -- in commit 4a77434, 14 Feb 2020)

git-p4: cleanup better on error exit

Signed-off-by: Luke Diamand

After an error, git-p4 calls die(). This just exits, and leaves child processes still running.

Instead of calling die(), raise an exception and catch it where the child process(es) (git-fastimport) are created.

This change does not address the particular issue of p4CmdList() invoking a subchild and not waiting for it on error.


And, if git-p4 is the cause of the problem, with Git 2.46 (Q3 2024), batch 3, git-fast-import will be more explicit:

See commit 55702c5 (08 May 2024) by Fahad Alrashed (alrashedf).
(Merged by Junio C Hamano -- gitster -- in commit bbffcd4, 13 May 2024)

git-p4: show Perforce error to the user

Signed-off-by: Fahad Alrashed

During git p4 clone, if p4 process returns an error from the server, it will store the message in the 'err' variable.
Then it will send a text command "die-now" to git-fast-import.
However, git-fast-import(man) raises an exception: fatal: Unsupported command: die-now, and err is never displayed.
This patch ensures that err is shown to the end user.

Upvotes: 0

Kester
Kester

Reputation: 99

Workaround: - Create a directory and clone codes with a change list ranges. git p4 clone //depot/f1/f2/f3/ere@17888479,17918050 -v - Push codes to GIT repository. You can use given script on below link to move code with history. https://gist.github.com/emiller/6769886 - Create another directory (empty repository) and clone codes with incremental change list ranges. - Pull codes from GIT and merge it with codes in local repository. - Resolve conflict and push it after commit

Upvotes: 0

Related Questions