threads / discuss / 9462

git-p4 question

Subject: git-p4 question

## tl;dr

5 messages between Aug 10, 2007 and Aug 10, 2007.

replies: 4people: 2as markdown or json

Govind Salinas· Aug 10, 2007, 02:53 UTC · lore
Hi All,
Me again with more dumb git-perforce questions.

I have been toying with git-p4 and I think it does everything I want except the crazy client map support. I figure I don't really need this. My client is something like this:

//depot/sane/... //clientroot/crazy/... //depot/stuff/... //clientroot/dumb/... //depot/otherstuff/... //clientroot/dumb/... //depot/my/product/... //clientroot/src/realworkhere/...

My "working directory" looks something like this:

c:\path\crazy\xyz_from_perforce c:\path\crazy\abc_from_huge_binary_fileshare_notinp4 c:\path\dumb\... c:\path\src\realworkhere\...

If I can just sync from p4 and then sync my binary share and THEN tell git-p4 that //depot/my/product/... maps to c:\path\src\realworkhere, get it to import history etc, then I would be set.

Is this at all possible to do with git-p4?

If not, what sort of work would be necessary to add that (considering that I am a git noob).

Thanks for the help.
-Govind
Alex Riesen· Aug 10, 2007, 08:06 UTC · re: Govind Salinas · lore

Re: git-p4 question

On 8/10/07, Govind Salinas <govindsalinas@gmail.com> wrote:
> If I can just sync from p4 and then sync my binary share and THEN tell
> git-p4 that //depot/my/product/... maps to c:\path\src\realworkhere,
> get it to import history etc,  then I would be set.

git-p4-import.bat can import a state from the client have-list, but it does not import the history. It can import the history separately, so that you can stitch it into a merge which will be the state imported from the client. Complicated, but I couldn't bring myself to figure out the history automatically.

The script attached (sorry for .gz, gmail wont let me send a .bat).
Alex Riesen· Aug 10, 2007, 08:10 UTC · re: Alex Riesen · lore

Re: git-p4 question

On 8/10/07, Alex Riesen <raa.lkml@gmail.com> wrote:
Show 10 quoted lines
> On 8/10/07, Govind Salinas <govindsalinas@gmail.com> wrote:
> > If I can just sync from p4 and then sync my binary share and THEN tell
> > git-p4 that //depot/my/product/... maps to c:\path\src\realworkhere,
> > get it to import history etc,  then I would be set.
>
> git-p4-import.bat can import a state from the client have-list,
> but it does not import the history. It can import the history
> separately, so that you can stitch it into a merge which will be
> the state imported from the client. Complicated, but I couldn't
> bring myself to figure out the history automatically.
Err, example:
Import a state from p4 client:
  git-p4-import -y -c client-name -e
Import p4 history of a path mapping:
  git-p4-import --p4-path //perforce/path \
    --local-path very-local-path \
    --p4-range '@1234,5678' \
    --start start-commit \
    --branch branch-name

The last argument (--branch) is optional, will just store the last imported commit there. start-commit will be assumed current HEAD, if omitted.

Govind Salinas· Aug 10, 2007, 15:17 UTC · re: Alex Riesen · lore

Re: git-p4 question

I am having some problems running the script.  It seems that (line
1425) $f->{sha1} is uninitialized and causing the import to fail (the
perforce path is missing the leading "//" I don't know if that is
intentional).  Let me know if you want to continue this off list since
it isn't really a part of git.
On 8/10/07, Alex Riesen <raa.lkml@gmail.com> wrote:
Show 29 quoted lines
> On 8/10/07, Alex Riesen <raa.lkml@gmail.com> wrote:
> > On 8/10/07, Govind Salinas <govindsalinas@gmail.com> wrote:
> > > If I can just sync from p4 and then sync my binary share and THEN tell
> > > git-p4 that //depot/my/product/... maps to c:\path\src\realworkhere,
> > > get it to import history etc,  then I would be set.
> >
> > git-p4-import.bat can import a state from the client have-list,
> > but it does not import the history. It can import the history
> > separately, so that you can stitch it into a merge which will be
> > the state imported from the client. Complicated, but I couldn't
> > bring myself to figure out the history automatically.
>
> Err, example:
>
> Import a state from p4 client:
>
>   git-p4-import -y -c client-name -e
>
> Import p4 history of a path mapping:
>
>   git-p4-import --p4-path //perforce/path \
>     --local-path very-local-path \
>     --p4-range '@1234,5678' \
>     --start start-commit \
>     --branch branch-name
>
> The last argument (--branch) is optional, will just store the last imported
> commit there. start-commit will be assumed current HEAD, if omitted.
>
Alex Riesen· Aug 10, 2007, 16:25 UTC · re: Govind Salinas · lore

Re: git-p4 question

On 8/10/07, Govind Salinas <govindsalinas@gmail.com> wrote:
> I am having some problems running the script.  It seems that (line
> 1425) $f->{sha1} is uninitialized and causing the import to fail (the
> perforce path is missing the leading "//" I don't know if that is
> intentional).

the line in question deals with local pathnames, so it is expected. What i don't understand is how did you manage to have the file without sha1... Could you put a

 print "$tmpfile\n";
after line 1400?
 open($ft,'>',$tmpfile) or die "$tmpfile: $!\n";

and run git-p4-import -v -v -v? Than it possible to compare lists of the files which is acquired through p4 change with the list of files output by p4 print.

What perforce client version do you have, BTW?
>  Let me know if you want to continue this off list since
> it isn't really a part of git.
It isn't. We can continue privately

← back to recent threads