threads / discuss / 12253

[GIT-P4] usage under Windows

Subject: [GIT-P4] usage under Windows

## tl;dr

9 messages between Feb 22, 2008 and Mar 3, 2008.

replies: 8people: 3as markdown or json

Maxim Gordienko· Feb 22, 2008, 06:44 UTC · lore
Hello!

What are best practices to use git-p4 under windows? What p4 client should i use, native or cygwin one? Is any special perforce client configuration required? What python distribution is preferred, included in cygwin or active python? Where i need to put imported directory under perforce client' root or in any other place?

Thank you!
Marius Storm-Olsen· Feb 27, 2008, 22:32 UTC · re: Maxim Gordienko · lore

Re: [GIT-P4] usage under Windows

Maxim Gordienko wrote:
> What are best practices to use git-p4 under windows?
> What p4 client should i use, native or cygwin one? Is any special
> perforce client configuration required?
 > What python distribution is preferred, included in cygwin or active 
python?

Depends on what your system is. Are you using Git under Cygwin or MSys? If you're using Cygwin normally, it's probably wise to use the cygwin version of perforce too.

Here's what I do:
     1) Use MSys Git. It's faster. (http://code.google.com/p/msysgit/)
     2) Use native Perforce. It's faster.
     3) Get Python from python.org. There's a binary installer.
> Where i need to put imported directory under perforce client' root or
> in any other place?

In perforce create your client spec somewhere where you don't see it. You never need to touch these files, but they are needed to be able to submit back to the perforce depot, if you need that. For cloning a perforce depot, you don't need a checkout (git-p4 used 'p4 print' to get the files directly)

Keep in mind to always rebase your patches before submitting back to a 
Perforce depot, since merges can be represented properly. So, a good 
work practice is to
    1) Clone perforce branch
    2) work, work, commit, work, commit...
    3) git p4 rebase
    4) git p4 submit
Good luck!

-- .marius

Maxim Gordienko· Feb 29, 2008, 18:48 UTC · re: Marius Storm-Olsen · lore

Re: [GIT-P4] usage under Windows

Thank you, Marius for detailed instructions! Now everything except submitting back to perforce works like a charm. Perforce complains about git-p4 checkout is not under it's root

Synchronizing p4 checkout... executing p4 sync ... Path 'c:/tmp/p42/main\...' is not under client's root 'c:\p4'.

if I move checkout under perforce root git-p4 unable to create patch. Have you encounter such errors? Thank you!

On Thu, Feb 28, 2008 at 1:32 AM, Marius Storm-Olsen <marius@trolltech.com> wrote:

Show 39 quoted lines
> Maxim Gordienko wrote:
> > What are best practices to use git-p4 under windows?
> > What p4 client should i use, native or cygwin one? Is any special
> > perforce client configuration required?
>  > What python distribution is preferred, included in cygwin or active
> python?
>
> Depends on what your system is. Are you using Git under Cygwin or MSys?
> If you're using Cygwin normally, it's probably wise to use the cygwin
> version of perforce too.
>
> Here's what I do:
>     1) Use MSys Git. It's faster. (http://code.google.com/p/msysgit/)
>     2) Use native Perforce. It's faster.
>     3) Get Python from python.org. There's a binary installer.
>
> > Where i need to put imported directory under perforce client' root or
> > in any other place?
>
> In perforce create your client spec somewhere where you don't see it.
> You never need to touch these files, but they are needed to be able to
> submit back to the perforce depot, if you need that. For cloning a
> perforce depot, you don't need a checkout (git-p4 used 'p4 print' to get
> the files directly)
>
> Keep in mind to always rebase your patches before submitting back to a
> Perforce depot, since merges can be represented properly. So, a good
> work practice is to
>    1) Clone perforce branch
>    2) work, work, commit, work, commit...
>    3) git p4 rebase
>    4) git p4 submit
>
> Good luck!
>
> --
> .marius
>
>
Marius Storm-Olsen· Feb 29, 2008, 21:54 UTC · re: Maxim Gordienko · lore

Re: [GIT-P4] usage under Windows

Maxim Gordienko wrote:
Show 10 quoted lines
> Thank you, Marius for detailed instructions!
> Now everything except submitting back to perforce works like a charm.
> Perforce complains about git-p4 checkout is not under it's root
> 
> Synchronizing p4 checkout...
> executing p4 sync ...
> Path 'c:/tmp/p42/main\...' is not under client's root 'c:\p4'.
> 
> if I move checkout under perforce root git-p4 unable to create patch.
> Have you encounter such errors?

Not that I recall.. However, it seems like you are using an older version of git-p4, so try just grabbing the latest one (http://repo.or.cz/w/git.git?a=blob_plain;f=contrib/fast-import/git-p4;hb=maint) and see if that helps you. If it doesn't work maybe you can tell me what your p4 client spec looks like?

-- .marius

Maxim Gordienko· Mar 1, 2008, 07:41 UTC · re: Marius Storm-Olsen · lore

Re: [GIT-P4] usage under Windows

No, unfortunately lattest git-p4 does not help. p4 still complain about location of checkout or unable to apply patch("file(s) not on client"). My client spec is (p4 itselt is 2007.3) --- Client: YOUR-6C9B4BEFA3

Update:	2008/02/22 01:03:06
Access:	2008/03/01 10:32:50
Owner:	foo
Description:
	Created by foo.
Root:	c:\p4
Options:	noallwrite noclobber nocompress unlocked nomodtime normdir
SubmitOptions:	submitunchanged
LineEnd:	local
View:
	//depot/... //YOUR-6C9B4BEFA3/...
---
Thank you!

On Sat, Mar 1, 2008 at 12:54 AM, Marius Storm-Olsen <marius@trolltech.com> wrote:

Show 24 quoted lines
> Maxim Gordienko wrote:
> > Thank you, Marius for detailed instructions!
> > Now everything except submitting back to perforce works like a charm.
> > Perforce complains about git-p4 checkout is not under it's root
> >
> > Synchronizing p4 checkout...
> > executing p4 sync ...
> > Path 'c:/tmp/p42/main\...' is not under client's root 'c:\p4'.
> >
> > if I move checkout under perforce root git-p4 unable to create patch.
> > Have you encounter such errors?
>
> Not that I recall..
> However, it seems like you are using an older version of git-p4, so try
> just grabbing the latest one
> (http://repo.or.cz/w/git.git?a=blob_plain;f=contrib/fast-import/git-p4;hb=maint)
> and see if that helps you. If it doesn't work maybe you can tell me what
> your p4 client spec looks like?
>
> --
> .marius
>
>
>
Marius Storm-Olsen· Mar 1, 2008, 09:50 UTC · re: Maxim Gordienko · lore

Re: [GIT-P4] usage under Windows

Maxim Gordienko wrote:
Show 17 quoted lines
> No, unfortunately lattest git-p4 does not help. p4 still complain
> about location of checkout or unable to apply patch("file(s) not on
> client").
> My client spec is (p4 itselt is 2007.3)
> ---
> Client:	YOUR-6C9B4BEFA3
> Update:	2008/02/22 01:03:06
> Access:	2008/03/01 10:32:50
> Owner:	foo
> Description:
> 	Created by foo.
> Root:	c:\p4
> Options:	noallwrite noclobber nocompress unlocked nomodtime normdir
> SubmitOptions:	submitunchanged
> LineEnd:	local
> View:
> 	//depot/... //YOUR-6C9B4BEFA3/...
Hmm, odd. The only thing I can think of is that maybe you have the 
client spec set up correctly, but you never initially checked out the 
sources into C:\p4 ?
Try to run
     cd /D C:\ && p4 sync -f ...
manually, and then see if you're able to 'git p4 submit'.
Oh, and why is Perforce reporting
     Path 'c:/tmp/p42/main\...' is not under client's root 'c:\p4'.
It seems to me that you're still using the Cygwin version of Perforce, 
is this correct? If so, ensure that you're only using the native 
version. And please try to remove the Cygwin directories from your PATH 
environment variable, so we're sure that Cygwin isn't messing with us 
to. MSys (which the Git Windows port uses) and Cygwin are not that 
compatible.

-- .marius

Tor Arvid Lund· Mar 1, 2008, 11:44 UTC · re: Maxim Gordienko · lore

Re: [GIT-P4] usage under Windows

On 29. feb.. 2008, at 19.48, Maxim Gordienko wrote:
Show 7 quoted lines
> Thank you, Marius for detailed instructions!
> Now everything except submitting back to perforce works like a charm.
> Perforce complains about git-p4 checkout is not under it's root
>
> Synchronizing p4 checkout...
> executing p4 sync ...
> Path 'c:/tmp/p42/main\...' is not under client's root 'c:\p4'.

I have seen it too. I'm not sure, but it seems to me like even though the git-p4 script does a chdir(<perforce_dir>) before calling "p4 <command> <args>" the chdir is "not seen by" p4 on windows.

I have a patch on my machine where i simply change all the p4 calls, like so:

system("p4 sync ...") --> system("p4 sync %s..." % self.clientPath)

This seems to work in all cases, and also in Mac OS X... I can probably clean the patch up a bit, and submit it later today or tomorrow if you're interested.

      -- Tor Arvid
Marius Storm-Olsen· Mar 1, 2008, 15:53 UTC · re: Tor Arvid Lund · lore

Re: [GIT-P4] usage under Windows

Tor Arvid Lund wrote:
Show 16 quoted lines
> On 29. feb.. 2008, at 19.48, Maxim Gordienko wrote:
>> Synchronizing p4 checkout... executing p4 sync ... Path
>> 'c:/tmp/p42/main\...' is not under client's root 'c:\p4'.
> 
> I have seen it too. I'm not sure, but it seems to me like even though
> the git-p4 script does a chdir(<perforce_dir>) before calling "p4 
> <command> <args>" the chdir is "not seen by" p4 on windows.
> 
> I have a patch on my machine where i simply change all the p4 calls,
> like so:
> 
> system("p4 sync ...") --> system("p4 sync %s..." % self.clientPath)
> 
> This seems to work in all cases, and also in Mac OS X... I can
> probably clean the patch up a bit, and submit it later today or
> tomorrow if you're interested.
It must mean that you initially didn't have the perforce files synced to 
disk according to you client spec, so the command to 'cd' into the 
perforce directory failed? I think this problem is solved by just doing a
     p4 sync //depot/...
to make sure that all the files exists on disk, before trying the 'git 
p4 submit' again.

git-p4 does not require checked out files to clone from perforce, but requires the files to exist on disk to be able to submit back to the depot.

-- .marius

Maxim Gordienko· Mar 3, 2008, 19:24 UTC · re: Marius Storm-Olsen · lore

Re: [GIT-P4] usage under Windows

Marius, thank you for the tip! but unsynced files not the case. Entire p4 client dir is in sync with depot. but i found this: $ p4 edit 1.txt 1.txt - file(s) not on client.

$ p4 revert //depot/main/1.txt //depot/main/1.txt#21 - was edit, reverted

git-p4 issues command not pointing on existing file (from p4 point of view). So we just need to issue full path in sync command.

On Sat, Mar 1, 2008 at 6:53 PM, Marius Storm-Olsen <marius@trolltech.com> wrote:
Show 32 quoted lines
> Tor Arvid Lund wrote:
> > On 29. feb.. 2008, at 19.48, Maxim Gordienko wrote:
> >> Synchronizing p4 checkout... executing p4 sync ... Path
> >> 'c:/tmp/p42/main\...' is not under client's root 'c:\p4'.
> >
> > I have seen it too. I'm not sure, but it seems to me like even though
> > the git-p4 script does a chdir(<perforce_dir>) before calling "p4
> > <command> <args>" the chdir is "not seen by" p4 on windows.
> >
> > I have a patch on my machine where i simply change all the p4 calls,
> > like so:
> >
> > system("p4 sync ...") --> system("p4 sync %s..." % self.clientPath)
> >
> > This seems to work in all cases, and also in Mac OS X... I can
> > probably clean the patch up a bit, and submit it later today or
> > tomorrow if you're interested.
>
> It must mean that you initially didn't have the perforce files synced to
> disk according to you client spec, so the command to 'cd' into the
> perforce directory failed? I think this problem is solved by just doing a
>     p4 sync //depot/...
> to make sure that all the files exists on disk, before trying the 'git
> p4 submit' again.
>
> git-p4 does not require checked out files to clone from perforce, but
> requires the files to exist on disk to be able to submit back to the depot.
>
> --
> .marius
>
>

← back to recent threads