gitversion-controlperforcegit-p4

git p4 how to submit a cl after a shelved cl is approved


I currently have a project maintained in git. Another team of the same project is using perforce. And there's no way they're going to use git.

I'm trying to use git p4 to have both repositories updated using the guides in the following links.

https://git-scm.com/docs/git-p4

https://developer.atlassian.com/blog/2015/01/work-with-git-and-perforce/

https://owenou.com/git-up-perforce-with-git-p4

However, I'm getting stuck in Perforce's Swarm Review.

/home/user/projectgit << folder for git project where I work on
/home/user/projectp4 << workspace folder for git p4

Before submitting to Perforce, I must first shelve the updates which I can do by git p4 submit --shelved

Now after my cl is approved, how do I submit it?

There's no git p4 submit <cl>

I tried git p4 unshelved <cl>, but what do I do now with the unshelved commit in refs/remote/p4/unsheved/<cl>?

I also tried using p4 submit <cl> (while in the git p4's workspace) but it complains about no files to commit.

Thanks in advance for the help.


Solution

  • I also tried using p4 submit (while in the git p4's workspace) but it complains about no files to commit

    You can do it by invoking p4 commands yourself, but since you ran into trouble (and probably aren't that interested in learning the p4 details) I suggest letting git-p4 do most of the work for you.

    In your git repo, checkout the branch from which you did git p4 submit --shelve (or the commit that you created using git p4 unshelve), then just do git p4 submit (no --shelve). It will create a new changelist from that same commit and submit it to perforce immediately.

    You can also tidy up the perforce side by deleting the changelist that git p4 submit --shelve had created. From the p4 workspace, run p4 shelve -d <cl> followed by p4 change -d <cl>.