Reputation: 1458
I have perforce repo //depot/myprog/...
which is having branches as
Now i want to stop using perforce and want to migrate my whole code with branch and tag histroy to git .
How to do it ? I know i can use git p4
command,but it is taking two much time and we have only 12 hours of perforce login session, the command is failing as it is auto logging out .
Any help would be greatly appreciated .
Upvotes: 3
Views: 1987
Reputation: 609
It's a bit nasty, but you can just setup a cron that logs you in every hour or so. You obviously have to put your password into the cron script, which is why it's nasty.
The other way is to clone your repo using normal Perforce commands at the revision you want to start from, and then trick git-p4 into using it.
i.e. something like:
$ p4 client
<create suitable client spec>
$ p4 sync //depot/foo
$ cd foo
$ git init
$ git add .
$ git commit
Your git commit needs to be in the right format, i.e. a message, followed by:
[git-p4: depot-paths = "//depot/foo": change = 1234]
Then do:
$ mkdir .git/refs/remotes/p4
$ git rev-parse HEAD >.git/refs/remotes/p4/master
Now git-p4 will use your repo:
$ git p4 sync
Upvotes: 1