threads / discuss / 47320

git-p4: cloning with a change number does not import all files

Subject: git-p4: cloning with a change number does not import all files

## tl;dr

7 messages between Nov 25, 2017 and Dec 2, 2017.

replies: 6people: 3as markdown or json

Patrick Rouleau· Nov 25, 2017, 20:35 UTC · lore
Hi,
I created a git repository with these commands:
  git p4 clone //perforce/path@123456 repo
  cd repo
  git p4 rebase

Some files created before the change 123456 do not exist in git history. I do see why, but those files were not modified after that change number.

If I use "git p4 sync --detect-branches" instead of "git p4 rebase", the branch contains all the files, but not the main trunk, and they appear to be added in the first commit of the branch.

To avoid the problem, I must clone with "@all" or with the change number when //perforce/path was created, which is significantly longer.

Regards, P. Rouleau

Lars Schneider· Nov 27, 2017, 12:52 UTC · re: Patrick Rouleau · lore

Re: git-p4: cloning with a change number does not import all files

Show 24 quoted lines
> On 25 Nov 2017, at 21:35, Patrick Rouleau <prouleau72@gmail.com> wrote:
> 
> Hi,
> 
> I created a git repository with these commands:
>  git p4 clone //perforce/path@123456 repo
>  cd repo
>  git p4 rebase
> 
> Some files created before the change 123456 do not exist in git
> history. I do see why,
> but those files were not modified after that change number.
> 
> If I use "git p4 sync --detect-branches" instead of "git p4 rebase",
> the branch contains
> all the files, but not the main trunk, and they appear to be added in
> the first commit of
> the branch.
> 
> To avoid the problem, I must clone with "@all" or with the change number when
> //perforce/path was created, which is significantly longer.
> 
> Regards,
> P. Rouleau
Hi Patrick,

what is your goal here? Do you want to convert the repo to Git or do you want to use Git to interact with a P4 repo?

I mainly do the former and use the @all switch. You can greatly reduce the time if your `git-p4` machine is close to the P4 server and if you reduce the P4 client spec used for the migration.

- Lars
Patrick Rouleau· Nov 29, 2017, 03:48 UTC · re: Lars Schneider · lore

Re: git-p4: cloning with a change number does not import all files

Hi,

On Mon, Nov 27, 2017 at 7:52 AM, Lars Schneider <larsxschneider@gmail.com> wrote:

>
> what is your goal here? Do you want to convert the repo to Git or do you
> want to use Git to interact with a P4 repo?

I want to use git to interact with a P4 repo. I am used to git tools and I prefer them to P4V. Visual Studio is also slower with P4 plugin and I hate P4 approach to check out a file before modifying it. The .sln files always get check outed for no reason.

I am working remotely. The P4 server is behind a VPN. That one reason I am trying to clone from some point in the past. I also want to have some history to see from where come the code and from who.

Regards, P. Rouleau

Lars Schneider· Dec 1, 2017, 12:45 UTC · re: Patrick Rouleau · lore

Re: git-p4: cloning with a change number does not import all files

Show 21 quoted lines
> On 29 Nov 2017, at 04:48, Patrick Rouleau <prouleau72@gmail.com> wrote:
> 
> Hi,
> 
> On Mon, Nov 27, 2017 at 7:52 AM, Lars Schneider
> <larsxschneider@gmail.com> wrote:
>> 
>> what is your goal here? Do you want to convert the repo to Git or do you
>> want to use Git to interact with a P4 repo?
> 
> I want to use git to interact with a P4 repo. I am used to git tools
> and I prefer them to
> P4V. Visual Studio is also slower with P4 plugin and I hate P4
> approach to check out
> a file before modifying it. The .sln files always get check outed for no reason.
> 
> I am working remotely. The P4 server is behind a VPN. That one reason
> I am trying to
> clone from some point in the past. I also want to have some history to
> see from where
> come the code and from who.

Oh, I am with you. However, I only used git-p4 for a very short time in the way you want to use it. Therefore, I don't have much experience in that kind of usage pattern. I was able to convice my management to move all source to Git and I used git-p4 to migrate the repositories ;-)

Here is a talk on the topic if you want to learn more: https://www.youtube.com/watch?v=QNixDNtwYJ0

Cheers, Lars

Patrick Rouleau· Dec 2, 2017, 15:35 UTC · re: Lars Schneider · lore

Re: git-p4: cloning with a change number does not import all files

On Fri, Dec 1, 2017 at 7:45 AM, Lars Schneider <larsxschneider@gmail.com> wrote:
Show 10 quoted lines
> Oh, I am with you. However, I only used git-p4 for a very short time in the
> way you want to use it. Therefore, I don't have much experience in that kind
> of usage pattern. I was able to convice my management to move all source to
> Git and I used git-p4 to migrate the repositories ;-)
>
> Here is a talk on the topic if you want to learn more:
> https://www.youtube.com/watch?v=QNixDNtwYJ0
>
> Cheers,
> Lars

Sadly, there is no way I convince the company to switch to git. They have acquired many companies in the past years and they have standardized around Perforce. It is in part because they want access control and they need to store a lot of binary files (including big VM images).

I keep this video close to explain why I like git: https://www.youtube.com/watch?v=o4PFDKIc2fs

Regards, P. Rouleau

Luke Diamand· Dec 2, 2017, 17:55 UTC · re: Patrick Rouleau · lore

Re: git-p4: cloning with a change number does not import all files

On 2 December 2017 at 15:35, Patrick Rouleau <prouleau72@gmail.com> wrote:
Show 21 quoted lines
> On Fri, Dec 1, 2017 at 7:45 AM, Lars Schneider <larsxschneider@gmail.com> wrote:
>> Oh, I am with you. However, I only used git-p4 for a very short time in the
>> way you want to use it. Therefore, I don't have much experience in that kind
>> of usage pattern. I was able to convice my management to move all source to
>> Git and I used git-p4 to migrate the repositories ;-)
>>
>> Here is a talk on the topic if you want to learn more:
>> https://www.youtube.com/watch?v=QNixDNtwYJ0
>>
>> Cheers,
>> Lars
>
> Sadly, there is no way I convince the company to switch to git. They
> have acquired
> many companies in the past years and they have standardized around Perforce.
> It is in part because they want access control and they need to store
> a lot of binary
> files (including big VM images).
>
> I keep this video close to explain why I like git:
> https://www.youtube.com/watch?v=o4PFDKIc2fs
I feel your pain.

I think I've sort of stumbled across something like the problem you've described in the past. Perhaps the files you need have been deleted and then re-integrated or some such.

Would you be able to take a look at some files with this problem and see if you can spot what's happened to it ("p4 changes" and perhaps "p4 changes -i").

One thing that can certainly happen is that Perforce gets *very* confused if you start getting too clever with symlinked directories, and git-p4 can only do so much in the face of this. But it may be something else.

Thanks Luke

Patrick Rouleau· Dec 2, 2017, 19:58 UTC · re: Luke Diamand · lore

Re: git-p4: cloning with a change number does not import all files

On Sat, Dec 2, 2017 at 12:55 PM, Luke Diamand <luke@diamand.org> wrote:
Show 7 quoted lines
> I think I've sort of stumbled across something like the problem you've
> described in the past. Perhaps the files you need have been deleted
> and then re-integrated or some such.
>
> Would you be able to take a look at some files with this problem and
> see if you can spot what's happened to it ("p4 changes" and perhaps
> "p4 changes -i").

Sorry, but these commands only show the date and an extract of the commit message.

Show 5 quoted lines
>
> One thing that can certainly happen is that Perforce gets *very*
> confused if you start getting too clever with symlinked directories,
> and git-p4 can only do so much in the face of this. But it may be
> something else.

Overall, the depot history is very "messy". It contains a lot of projects. The project on which I work has reach v5 and it has been branched from v4. From p4v's "show graph", I can see there was a 'main' branch at some point, but it doesn't exist anymore.

One of the files missing from my clone only has 2 revisions and it was created in the v5 branch. It was created at 608436 and modified at 608816. I cloned from 610443, mainly because we added a feature branch and I want to access it from git too (610443 is one month before the branch creation).

I will play a little bit with p4 to see if I can locate where the problem comes from and maybe hack git-p4 to make it more verbose.

Thanks, P. Rouleau

← back to recent threads