[Source Control] Choose Changelist when saving

Hello !

We would like to know if there is a way to specify the target changelist for the assets that will be checked out when saving.

For now, they are always moved to the “default” changelist which is not really handy. We have to move them to the proper changelist right after the save; otherwise, if we move them later, we could forget some of them.

Having a pop-up window like the one P4V displays would be really nice.

Thanks,

Tom

p4_checkout_target.png(6.39 KB)
ue_checkout_file.png(12.4 KB)

Hi,

This is not implemented. We have a similar task in the backlog to add a contextual menu to ‘checkout to a specific CL’ (UE-116655). I will add a note to this JIRA or search again to verify if we have your specific use case, but I don’t expect this to be implemented anytime soon. So, you could ‘hack’ something with a CVar and update the code. Most of the code should already there, but current implementation doesn’t capture/pass a changelist (It uses an ISourceControlProvider::Execute() without the CL parameter. If you put a breakpoint into: \Engine\Source\Editor\UnrealEd\Private\FileHelpers.cpp (function below), this is where the files you are saving are checked out. This is one place were you could pass a changelist by calling a version ISourceControlProvider::Execute() that takes a changelist as parameter. You need some way to pull the CL (hence a CVar) from somewhere though.

ECommandResult::Type FEditorFileUtils::CheckoutPackages(const TArray<UPackage*>& PkgsToCheckOut, TArray<UPackage*>* OutPackagesCheckedOut, const bool bErrorIfAlreadyCheckedOut, const bool bConfirmPackageBranchCheckOutStatus)
{
...
			CheckOutResult = SourceControlProvider.Execute(ISourceControlOperation::Create<FCheckOut>(), FinalPackageCheckoutList);
...
}

The function above calls: \Engine\Plugins\Developer\PerforceSourceControl\Source\PerforceSourceControl\Private\PerforceSourceControlProvider.cpp and in our case InBaseChangelist parameter will always null because the function above does pass a changlist.

ECommandResult::Type FPerforceSourceControlProvider::Execute( const FSourceControlOperationRef& InOperation, FSourceControlChangelistPtr InBaseChangelist, const TArray<FString>& InFiles, EConcurrency::Type InConcurrency, const FSourceControlOperationComplete& InOperationCompleteDelegate )
{
...
	TSharedPtr<FPerforceSourceControlChangelist, ESPMode::ThreadSafe> InChangelist = StaticCastSharedPtr<FPerforceSourceControlChangelist>(InBaseChangelist);
...
	FPerforceSourceControlChangelist Changelist = InChangelist ? InChangelist.ToSharedRef().Get() : FPerforceSourceControlChangelist();
...
}

So in this code, if ‘InChanglist’ is null, you could read a CVar and set your changelist number. This might be simpler at this level. Alternatively, you could use FPerforceSourceControlSettings::SetChangelistNumber()/FPerforceSourceControlSettings::GetChangelistNumber. The ‘user friendliness’ is the hard part if you want to implement all the nice UI to make it obvious and easy.

Regards,

Patrick

Hi,

Thank you for your elaborate answer.

We will patch on our side and check later if we can simplify once your contextual action is available :+1:

Regards,

Tom