threads / bug / 19176

bug in git-p4?

Subject: bug in git-p4?

## tl;dr

4 messages between May 4, 2009 and May 8, 2009.

replies: 3people: 3as markdown or json

Mercier, Carl· May 4, 2009, 19:20 UTC · lore
Hello all,
I've been trying to use git-p4 without much success.  My setup is very simple:
- 1 existing Git repo (with data)
- 1 existing P4 depot (with an empty subdirectory)
- We commit and push to Git and our company requires all the code to be stored in P4 (in the p4 empty subdir).
Here's what I did:

cd /root/p4-repo/SecTech git clone /home/git/repositories/web website cd website git-p4 sync //SecTech/website git branch --track p4-master p4/master git checkout p4-master git merge master git-p4 submit

CRASHES WITH: Perforce checkout for depot path //SecTech/website/ located at /root/p4-repo/SecTech/website/ Syncronizing p4 checkout... ... - file(s) up-to-date. Applying 32a1b2fe93f48c044d04ca37a276fe66afc988ce initial import

fatal: ambiguous argument '32a1b2fe93f48c044d04ca37a276fe66afc988ce^': unknown revision or path not in the working tree. Use '--' to separate paths from revisions Command failed: git diff-tree -r "32a1b2fe93f48c044d04ca37a276fe66afc988ce^" "32a1b2fe93f48c044d04ca37a276fe66afc988ce"

Am I doing something wrong or is there a bug in git-p4?
I'm a bit confused right now.  Thanks!
Carl
 Protected by Websense Hosted Email Security -- www.websense.com 
Tor Arvid Lund· May 8, 2009, 11:43 UTC · re: Mercier, Carl · lore

Re: bug in git-p4?

On Mon, May 4, 2009 at 9:20 PM, Mercier, Carl <cmercier@websense.com> wrote:
Show 18 quoted lines
> Hello all,
>
> I've been trying to use git-p4 without much success.  My setup is very simple:
>
> - 1 existing Git repo (with data)
> - 1 existing P4 depot (with an empty subdirectory)
> - We commit and push to Git and our company requires all the code to be stored in P4 (in the p4 empty subdir).
>
> Here's what I did:
>
> cd /root/p4-repo/SecTech
> git clone /home/git/repositories/web website
> cd website
> git-p4 sync //SecTech/website
> git branch --track p4-master p4/master
> git checkout p4-master
> git merge master
> git-p4 submit

Hi. What I try to do at my job, is to consider the P4 depot to be the "master" depot, since I consider it the "weaker" of the two VCSs. I have not had much success doing git merges and then trying to sync with P4. I instead use rebasing a lot. So what I would do in your situation is something like:

... git-p4 sync //SecTech/website git rebase p4/master git-p4 submit

So.. my normal flow of work is:

code commit code commit git p4 sync git rebase p4/master git p4 commit

Don't know if this is something that might work for you, though...
-Tor Arvid-
Carl Mercier· May 8, 2009, 18:02 UTC · re: Tor Arvid Lund · lore

Re: bug in git-p4?

Thank you.

What I'm trying to accomplish is a little bit different. We've been using Git with a remote server for so long, we don't want to give that up. (and we also can't for some reasons). So what I was hoping to do was simply keep working with out remote Git server as normal, and then have another server pull from Git and submit to P4.

We have many Git repos we'd like to store into P4 subdirectories. For example:

website.git -> //SecTech/website api.git -> //SecTech/api

I just can't seem to get this to work because git-p4 seems to expect a brand new Git repo to work properly.

What would be the correct way to accomplish this?

Carl Mercier Director of software development Defensio.com, a Websense service

On 8-May-09, at 7:43 AM, Tor Arvid Lund wrote:
Show 47 quoted lines
> On Mon, May 4, 2009 at 9:20 PM, Mercier, Carl  
> <cmercier@************> wrote:
>> Hello all,
>>
>> I've been trying to use git-p4 without much success.  My setup is  
>> very simple:
>>
>> - 1 existing Git repo (with data)
>> - 1 existing P4 depot (with an empty subdirectory)
>> - We commit and push to Git and our company requires all the code  
>> to be stored in P4 (in the p4 empty subdir).
>>
>> Here's what I did:
>>
>> cd /root/p4-repo/SecTech
>> git clone /home/git/repositories/web website
>> cd website
>> git-p4 sync //SecTech/website
>> git branch --track p4-master p4/master
>> git checkout p4-master
>> git merge master
>> git-p4 submit
>
> Hi. What I try to do at my job, is to consider the P4 depot to be the
> "master" depot, since I consider it the "weaker" of the two VCSs. I
> have not had much success doing git merges and then trying to sync
> with P4. I instead use rebasing a lot. So what I would do in your
> situation is something like:
>
> ...
> git-p4 sync //SecTech/website
> git rebase p4/master
> git-p4 submit
>
> So.. my normal flow of work is:
>
> code
> commit
> code
> commit
> git p4 sync
> git rebase p4/master
> git p4 commit
>
> Don't know if this is something that might work for you, though...
>
> -Tor Arvid-
 Protected by Websense Hosted Email Security -- www.websense.com 
Daniel Barkalow· May 8, 2009, 21:46 UTC · re: Carl Mercier · lore

Re: bug in git-p4?

On Fri, 8 May 2009, Carl Mercier wrote:
Show 16 quoted lines
> Thank you.
> 
> What I'm trying to accomplish is a little bit different. We've been using Git
> with a remote server for so long, we don't want to give that up. (and we also
> can't for some reasons).  So what I was hoping to do was simply keep working
> with out remote Git server as normal, and then have another server pull from
> Git and submit to P4.
> 
> We have many Git repos we'd like to store into P4 subdirectories.  For
> example:
> 
> website.git -> //SecTech/website
> api.git -> //SecTech/api
> 
> I just can't seem to get this to work because git-p4 seems to expect a brand
> new Git repo to work properly.

You're going to have a whole bunch of problems, most likely, including that Perforce doesn't suppose the history structure that git uses (where a revision can have multiple parents without these revisions having different codelines).

Most likely, what you actually want to do is essentially send Perforce git's reflog. You should be able to write a short post-update hook that takes the diff between the before and after, add/edit/delete the files that changed, change a client workspace, and submit it.

	-Daniel
*This .sig left intentionally blank*

← back to recent threads