Re: [RFC PATCH 1/2] git-p4: introduce alien branch mappings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>> Labels in Perforce are not global, but can be placed on a particular view/subdirectory.
>> This might pose difficulties when importing only parts of Perforce depot into a git repository.
>> For example:
>>  1. Depot layout is as follows:
>>     //depot/metaproject/branch1/subprojectA/...
>>     //depot/metaproject/branch1/subprojectB/...
>>     //depot/metaproject/branch2/subprojectA/...
>>     //depot/metaproject/branch2/subprojectB/...
>>  2. Labels are placed as follows:
>>     * label 1A on //depot/metaproject/branch1/subprojectA/...
>>     * label 1B on //depot/metaproject/branch1/subprojectB/...
>>     * label 2A on //depot/metaproject/branch2/subprojectA/...
>>     * label 2B on //depot/metaproject/branch2/subprojectB/...
>>  3. The goal is to import
>>     subprojectA into subprojectA.git and
>>     subprojectB into subprojectB.git
>>     preserving all the branches and labels.
>>  4. Importing subprojectA.
>>     Label 1A is imported fine because it's placed on certain commit on branch1.
>>     However, label 1B is not imported because it's placed on a commit in another subproject:
>>     git-p4 says: "importing label 1B: could not find git commit for changelist ..."
>>     The same is with label 2A, which is imported; and 2B, which is not.
>>
>> Currently, there is no easy way (that I'm aware of) to tell git-p4 to
>> import an empty commit into a desired branch,
>> so that a label placed on that changelist could be imported as well,
> 
> So there is a file in subprojectA/foo.c@41.
> And label 1B is against //depot/metaproject/branch1/subprojectB/bar.c@42.
> 
> And I suppose in Perforce you could still checkout subprojectA at
> change 42 and you would get change 41.
> 
> But with the way git-p4 works, the label just gets discarded.

Yes, exactly.

> You want to be able to checkout the subjectA with a tag called 1B and
> get the file contents as of 42.
> 
> I wonder if it would be easier to teach the code in importP4Labels to
> go searching harder for the next lower changelist number?
> 
> Where it currently says "could not find git commit"... could it do
> something like "p4 changes -m1 //depot/path/...@LABEL" and use that
> instead?
> 
> I'm not sure if that would work but it would mean you wouldn't need
> any extra configuration to maintain.

Yeah, that's a great idea!
I think, it should work pretty well in simpler cases for sure.
Initially, I was thinking, that I needed an explicit configuration option
to choose the proper branch/subproject in a more complicated case,
but let me give it a try to your idea -- hopefully it just works.

Some new option like git-p4.allowInexactLabels to enable this behavior?
Don't think it should be enabled by default unless git-p4.labelImportRegexp is set, right?

> But perhaps I have misunderstood what you're trying to do here!
> Perhaps a failing test case might help explain it better?

No, I think, you got it right!
Thank you for the great suggestion!

Yeah, let me see if I can get a simple but representative test case.

> 
> Thanks
> Luke




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux