# [GIT-P4] usage under Windows

9 messages from 2008-02-22 to 2008-03-03. Participants: Maxim Gordienko, Marius Storm-Olsen, Tor Arvid Lund.
Thread: https://gitlist.dev/t/12253

## Maxim Gordienko, 2008-02-22 06:44

Subject: [GIT-P4] usage under Windows
Message-ID: <96c268400802212244g7fd2de2bj6c1b7022885c8e89@mail.gmail.com>
URL: https://gitlist.dev/e/96c268400802212244g7fd2de2bj6c1b7022885c8e89%40mail.gmail.com

```
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, 2008-02-27 22:32

Subject: Re: [GIT-P4] usage under Windows
Message-ID: <47C5E4EC.1060003@trolltech.com>
URL: https://gitlist.dev/e/47C5E4EC.1060003%40trolltech.com
In-Reply-To: <96c268400802212244g7fd2de2bj6c1b7022885c8e89@mail.gmail.com>

```
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, 2008-02-29 18:48

Subject: Re: [GIT-P4] usage under Windows
Message-ID: <96c268400802291048u31a2d8b6ub1726ade941afb8c@mail.gmail.com>
URL: https://gitlist.dev/e/96c268400802291048u31a2d8b6ub1726ade941afb8c%40mail.gmail.com
In-Reply-To: <47C5E4EC.1060003@trolltech.com>

```
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:
> 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, 2008-02-29 21:54

Subject: Re: [GIT-P4] usage under Windows
Message-ID: <47C87F1C.10309@trolltech.com>
URL: https://gitlist.dev/e/47C87F1C.10309%40trolltech.com
In-Reply-To: <96c268400802291048u31a2d8b6ub1726ade941afb8c@mail.gmail.com>

```
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



```

## Maxim Gordienko, 2008-03-01 07:41

Subject: Re: [GIT-P4] usage under Windows
Message-ID: <96c268400802292341y5ac5f287yc5af7afe9aff983a@mail.gmail.com>
URL: https://gitlist.dev/e/96c268400802292341y5ac5f287yc5af7afe9aff983a%40mail.gmail.com
In-Reply-To: <47C87F1C.10309@trolltech.com>

```
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:
> 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, 2008-03-01 09:50

Subject: Re: [GIT-P4] usage under Windows
Message-ID: <47C926E8.1000201@trolltech.com>
URL: https://gitlist.dev/e/47C926E8.1000201%40trolltech.com
In-Reply-To: <96c268400802292341y5ac5f287yc5af7afe9aff983a@mail.gmail.com>

```
Maxim Gordienko wrote:
> 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, 2008-03-01 11:44

Subject: Re: [GIT-P4] usage under Windows
Message-ID: <B929D1FF-BAF7-4595-9DAF-07E62B90D767@gmail.com>
URL: https://gitlist.dev/e/B929D1FF-BAF7-4595-9DAF-07E62B90D767%40gmail.com
In-Reply-To: <96c268400802291048u31a2d8b6ub1726ade941afb8c@mail.gmail.com>

```
On 29. feb.. 2008, at 19.48, 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'.

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, 2008-03-01 15:53

Subject: Re: [GIT-P4] usage under Windows
Message-ID: <47C97C03.8040303@trolltech.com>
URL: https://gitlist.dev/e/47C97C03.8040303%40trolltech.com
In-Reply-To: <B929D1FF-BAF7-4595-9DAF-07E62B90D767@gmail.com>

```
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


```

## Maxim Gordienko, 2008-03-03 19:24

Subject: Re: [GIT-P4] usage under Windows
Message-ID: <96c268400803031124s28e7f5f2s3d0a41ab670477c1@mail.gmail.com>
URL: https://gitlist.dev/e/96c268400803031124s28e7f5f2s3d0a41ab670477c1%40mail.gmail.com
In-Reply-To: <47C97C03.8040303@trolltech.com>

```
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:
> 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
>
>

```
