I'm probably overcomplicating things, and am probable in a unique situation here, but if anything stands out to anyone, would love some ideas.
Summary: I am trying to copy a chunk of source code from our perforce repo to github and manually keep them in sync. The initial setup and push to git worked great, but now things are falling apart. For example right now another team submitted a PR with a bunch of files in /dira/dirb/
I accepted the PR, pulled the changes down to my local git project, merged them to the p4 branch, but when I tried to submit it, p4 doubled the directories - pushing all of the files from /dira/dirb to /dira/dirb/dira/dirb/
The details:
We are using streams, so the first thing I did was create a substream with just the code I was interested in. Since I don't need this substream forever (eventually the whole repo is going to git) I used a task stream:
Stream Root: //streambase/taskstream
Parent: //streambase/projectstream
Paths: exclude ... (exclude the original project)
share dira/dirb/...
exclude dira/dirb/buildcode/...
Which gave me a view of:
-//streambase/taskstream/... ...
//streambase/taskstream/dira/dirb/... dira/dirb/...
-//streambase/taskstream/dira/dirb/buildcode/... dira/dirb/buildcode/...
Next, created a new workspace for the substream:
Workspace name: substream_workspace
Workspace root: /Users/me/p4/gitp4parent/gitp4project
Stream: taskstream (//streambase/taskstream)
Workspace Mappings
-//streambase/taskstream/... //substream_workspace/...
//streambase/taskstream/dira/dirb/... //substream_workspace/dira/dirb/...
-//streambase/taskstream/dira/dirb/buildcode/... //substream_workspace/dira/dirb/buildbode/...
- Created a .p4config file just above where I was going to clone:
vi /Users/me/p4/gitp4parent/.p4config
P4USER=me
P4CLIENT=substream_workspace
I then git p4 cloned the perforce substream to my local machine
git p4 clone //substream/taskstream
My local version of git created a 'master' branch. I created a new 'main' branch, merged master to it, and gave it a remote of a repo in our github account:
git branch main
git checkout main
git remote add github git@github:mycompany/taskproject
git push -u github main
When I accepted the PR, I fetched it back into the local 'main' branch, switched to master, and merged.
At this point all of the files from the PR were under dira/dirb.
When I did git p4 submit –prepare-p4-only
,
all of the local files were moved to dira/dirb/dira/dirb and showed up in the changelist accordingly.