265 Commits

Author SHA1 Message Date
juan legaz
acf3d8d0f5 Fix Perforce create changelist moving all files from the default CL to the new changelist instead of creating an empty changelist or moving only the selected files
#rb benoit.chauvin, paul.chipchase

[CL 34280797 by juan legaz in 5.4 branch]
2024-06-11 12:31:39 -04:00
juan legaz
41212abbaa Changed p4 change -i to p4 change and reusing the template that the server provides
This ensures that we use the changelist type from the server which was being dropped

#rb alan.kwan, paul.chipchase
#rnx

[CL 34244739 by juan legaz in 5.4 branch]
2024-06-10 13:28:19 -04:00
wouter burgers
6cb4500c45 Skein / ViewportStatus: Update TTypedElementRevisionControlFactory query.
The query now assigns an outline color using the criteria described in the ProductSpec.
- Yellow, if a newer package is available.
- Red, if someone else locked the package,
- Green, if package is added locally.
- Blue, if package is locked by user.

The color indices still, as before, rely on the container in UEditorStyleSettings.

I've introduced a FSCCNotCurrentTag to know in the processor if something is at the latest revision as it will not be obvious for some source control systems to provide an ordering based on just FSCCRevisionId (if it's a GUID for example).

#rb ronald.koppers, zach.rammell
#rnx

[CL 32492266 by wouter burgers in 5.4 branch]
2024-03-25 19:33:31 -04:00
paul chipchase
ceaca71158 Fix assert when failing to clobber a file.
#rb juan.legaz
#jira UE-203769
#rnx

- The problem was introduced in my change CL 30208400 where I mistakenly believed that all messages should be routed through ClientUser::Message so added asserts to detect and classes derived from FP4ClientUser calling the lower level Info/Error methods. Server messages do indeed all go through ::Message but local client issues can call the lower level methods directly so my assumption was unsafe. To make matters worse the most common local error we have concerns clobbering files but I tend to run workspaces with "clobber" option rather than "noclobber" so I did not see the problem in testing.
- We once again implement ClientUser::OutputInfo and ClientUser::OutputError and store the messages in the correct array.
- The default implementation of ClientUser::HandleError calls ::OutputError so there is no point implementing this method but we also don't need to assert if it is called.

[CL 31772785 by paul chipchase in 5.4 branch]
2024-02-23 14:53:48 -05:00
paul chipchase
dd030d8c81 Fix a crash when refreshing file states in perforce and the TypedElementFramework has not been initialized.
#rb Per.Larsson
#jira UE-205251
#rnx

- The crash was in a stand alone program that loads a very limited number of plugins which caused the TypedElementFramework to remain unloaded.
- UTypedElementRegistry::GetInstance is not guaranteed to return a valid pointer so we have to check the return value.


#changelist validated
#virtualized

[CL 31251846 by paul chipchase in 5.4 branch]
2024-02-07 05:22:49 -05:00
paul chipchase
a74b51bcc4 Fix errors that were being logged incorrectly when updating changelist states for a user.
#rb Juan.Legaz
#rnx

- Updating the state of all changelists for a user currently does not take the users current workspace into account, meaning we will scan all changelists for a given user on the currently server. When we try to resolve the files in the changelist to local files for changelists not under the current workspace we will encountered perforce errors as the files are not in the current client spec view.
- To fix the immediate problem we should just remove those errors and changelists not under the current workspace will have the depot info about their files but not the local file path info, which is the current behavior but without the errors. In theory the error messages are correct but they are not that useful to the caller, especially as we do not provide context about which changelist is emitting each error.
-- Although the errors are raised inside of ::GetDepotFileToLocalFileMap we only remove this error in FPerforceGetPendingChangelistsWorker::Execute where we know we don't care about it. In some of the other places that we call ::GetDepotFileToLocalFileMap that error would indicate a proper problem so we should not change it there.

[CL 30799233 by paul chipchase in ue5-main branch]
2024-01-23 07:19:49 -05:00
steve robb
6d5b974842 Fixed up a lot of bool-taking container resize functions to take EAllowShrinking instead.
[CL 30735396 by steve robb in ue5-main branch]
2024-01-19 19:41:56 -05:00
zach rammell
04124c5d5b Add option to automatically resolve revision control state into TEDS
#rb logan.buchy ronald.koppers
#jira UE-203552

[CL 30515276 by zach rammell in ue5-main branch]
2024-01-09 15:52:58 -05:00
paul chipchase
db6655344a Return a proper error message when a user tries to submit a changelist containing files not mapped to the current stream.
#rb Juan.Legaz
#jira UE-202626

- Move info messages (warnings in this case) containing "- warning: file not mapped in stream" to be errors when submitting content."
- Cleaned up use of RemoveRedundantInfo to pass in the default parameter.

[CL 30317027 by paul chipchase in ue5-main branch]
2023-12-14 06:48:00 -05:00
paul chipchase
a05543b5ce Return files not being marked for add due to P4IGNORE as errors rather than info.
#rb Juan.Legaz
#jira UE-175581

- The command will already be marked as a failure, but as p4 returns the message about the file(s) being ignored as INFO we will not print any error messages to the user and the failure can be confusing.
- Add ::RemoveRedundantInfo to allow us to remove info messages and move them to be errors. This is basically the same logic as ::RemoveRedundantErrors but going in the opposite direction.
- Check for the info message mentioning that a file failed to add as it is ignored (ignored file can't be added) and move that message to be an error.
-- The errors will be logged by the calling code so there is no need for us to do that here. In addition if the original calling code holds on to the operation pointer it will have access to the FSourceControlResultsInfo structure containing the error message if the calling code wishes to do it's own logging.

[CL 30262250 by paul chipchase in ue5-main branch]
2023-12-12 09:20:04 -05:00
paul chipchase
82618a9ffd Capture info messages for all perforce commands, the calling code can then decide if the info is important or not.
#rb juan.legaz
#jira UE-175581

### Perforce Connection
- FP4ClientUser now takes a FSourceControlResultInfo structure to store the warning/error messages generated during a perforce command, in addition we can now store info messages.
-- In almost all cases the array that was being passed in to store the warning/error messages came from a FSourceControlResultInfo so it doesn't change the overall flow.
- Rather than override ClientUser::OutputInfo to get the info messages we have overridden FP4ClientUser::Message instead as this is the preferred way in the cpp p4 api to capturing messages.
-- One difference between ::Message and the older capturing methods is that the older methods seemed to result in a newline character at the end of the message, which we do not see with the newer capture method. As some of our result parsing code relies on this behavior FP4ClientUser::Message will append this newline character for now until the parsing code can be fixed.
- For now FP4ClientUser still overrides ::OutputInfo, ::OutputError and ::HandleError but only to add a checkNoEntry() to each one. This is so that we can confirm that there are no remaining uses of it before removing it entirely.
- All classes derived from FP4ClientUser have been updated to work with the changes. In some cases this meant changing the override of ClientUser::OutputInfo to ClientUser::Message.
-- With a little bit of work we could probably remove these derived classes now that FP4ClientUser supports capturing the info messages which would help simplify the code base however this should be done in a future work item.

### Misc
- Remove ::FPerforceSourceControlProvider::GetWorkspaceList rather than update it, as it is not used.
- Add FSourceControlResultInfo::HasErrors to check if the struct contains errors or not.
-- Did not replace existing use of FPerforceSourceControlProvider::ErrorMessages.IsEmpty() that should be done as it's own work item.

[CL 30208418 by paul chipchase in ue5-main branch]
2023-12-08 06:47:37 -05:00
paul chipchase
3cb65abf7a Fix SOURCE_CONTROL_WITH_SLATE to work properly with PerforceSourceControl module.
#rb PJ.Kack
#rnx

- Remove the slate widgets from the module if we are not compiling with slate.

[CL 29929990 by paul chipchase in ue5-main branch]
2023-11-27 03:02:45 -05:00
paul chipchase
277284a7e1 Fix an assert seen when errors are encountered while asynchronously updating the change list view window.
#rb Luc.Eygasier
#rnx

- FSourceControlAssetDataCache can launch work on the taskgraph system in the method ::FetchAssetData which in turn calls ISourceControlRevision::Get.
- The perforce implementation of this uses FMessageLog to report errors but this can only be used safely on the GameThread. When used on the taskgraph system we run the risk of either triggering an unsafe delegate assert or we end up trying to update a slate widget (if the FMessageLog window is open) which will assert when done outside of the GameThread.
- The short term fix is to use FTSMessageLog which is a quick and dirty wrapper in the perforce module that acts like FMessageLog but when called on a taskgraph thread it will just log the message rather than trying to route it to the FMessageLog system.
-- There is a work item to make FMessageLog thread safe but due to some API choices this is non-trivial.
- Note that this change does not address the original errors, but should prevent the crash.

[CL 29707502 by paul chipchase in ue5-main branch]
2023-11-14 02:44:11 -05:00
paul chipchase
be8423dcc3 Add support for EStatus::WorkspacePath with the perforce source control provider.
#rb j.baumgartner
#rnx

- The safest way to determine the client spec root is to just initialize a p4 connection and extract the info from that.

[CL 29596693 by paul chipchase in ue5-main branch]
2023-11-09 10:48:13 -05:00
paul chipchase
0743e8dd17 Fix SOURCE_CONTROL_WITH_SLATE to work properly again in the SourceControl module
#rb wouter.burgers
#rnx

### SourceControl
- Remove link to "InputCore" as it is not used
- Only include slate and rendering modules if the target we are building for uses slate.
- Define SOURCE_CONTROL_WITH_SLATE as 0 if the target we are building for does not use slate.

- When SOURCE_CONTROL_WITH_SLATE is zero the following will be applied:
-- FRevisionControlStyleManager will not be compiled as it only makes sense if slate is enabled.
-- The monitoring aspect of FSourceControlFileStatusMonitor will be disabled as we cannot be notified of user interactions.
-- FScopedSourceControlProgress will compile but essentially do nothing.
-- The ::GetIcon method of ISourceControlState will no longer be compiled as it returns a FSlateIcon by value.

[CL 29516345 by paul chipchase in ue5-main branch]
2023-11-07 06:18:43 -05:00
jeanfrancois dube
87618ccfe5 Optimize source control changelist shelved state update.
Results with a 40K actors changelist editor startup time:
  - Before: FPerforce::AddShelvedFilesToChangelist took 2:35 min
  - After: FPerforce::AddShelvedFilesToChangelist took 160.08 ms

#rb sebastien.lussier
[FYI] jeansebastien.guay

[CL 29047110 by jeanfrancois dube in ue5-main branch]
2023-10-24 11:33:28 -04:00
zach rammell
8b3fd59c2d Fix ensure firing in SCC integration
#jira UE-198002
#rb logan.buchy

[CL 28906402 by zach rammell in ue5-main branch]
2023-10-18 23:45:11 -04:00
zach rammell
aa03bf84ab Synchronizing source control state from the perforce source control provider into TEDS
#jira UE-192061
#rb ronald.koppers

[CL 28276567 by zach rammell in ue5-main branch]
2023-09-27 12:02:45 -04:00
paul chipchase
2b46e43a0f Fixed a bug where FPerforceSourceControlProvider::SwitchWorkspace was not correctly switching to the new workspace
#rb PJ.Kack
#rnx

- Bug was intorduced in CL 26952096
- EConnectionOptions::WorkspaceOptional means we should not test if a workspace is valid but if one is provided it should still be used but in the above change EnsureValidConnection was changed and this resulted in the code discarding the workspace entirely if that option was used.
- If that option is used we just pass the input workspace name (if there is one) to the output structure and trust that the caller knows what they are doing.

[CL 27953007 by paul chipchase in ue5-main branch]
2023-09-18 06:00:16 -04:00
paul chipchase
4fa806cf66 Add a new initialization path to ISourceControlProvider allowing the caller to customize the initialization logic and retrieve more info about the initialization itself.
#rb Per.Larsson

### ISourceControlProvider
- Add a new ISourceControlProvider::Init overload that returns a struct (FInitResult) and takes a bitfield of flags (EInitFlags) so that we can more easily extend the initialization in future and return things to the caller.
- If a provider does not implement the new overload we fall-back to the original. This will be removed once all providers support the new path.

### PerforceSourceControlProvider
- Support the new init options via FPerforceConnection::EnsureValidConnection and update places that call it.

### FPerforceConnection
- Update ::AutoDetectWorkspace to return errors to the caller rather than handle its own logging.
- ::TestLoginConnection and ::TestClientConnection no longer calls FPerforceSourceControlProvider::SetLastErrors, this will be done at a higher level.
- ::AutoDetectWorkspace still does its own logging which will be fixed in a future update, it does however return its errors to the caller.
- Split the implementation of ::EnsureValidConnection to a stand alone internal function, the original function now handles and consolidates error handling.
-- Changed the logic to early out of failure rather than constantly checking a boolean all the way down.
-- Tried to remove the need for FPerforceSourceControlProvider to be passed in but a few places still require it.
-- Fixed our handling of the P4PORT value so that we can at least report problems if the address uses unicode characters. I have not yet tested if we can actually connect to such an address. We no longer use the servers unicode setting to decide the port strings encoding as it is not affected by the server settings.
-- Each error encountered should now record a localized error that we expect the user to be able to react to, then an array of errors from the API itself.
-- Once the internal code has run we will do a pass on all errors (if any) and strip any whitespace at the end (p4 tends to end error messages with newline characters) and then add a final entry to the additional errors detailing the settings at the point of failure. This was mostly being done before but is now enforced for every error.
-- No longer log the ticket, although the workflow to allow the user to supply one is not common we still probably don't want to save that to log files.

[CL 26952104 by paul chipchase in ue5-main branch]
2023-08-09 07:27:34 -04:00
robert millar
769ffe7852 Alternative fix for mismatched changelist and file arrays in update operation.
Rewrite loop to be clear that the primary cursor is over changelists and the secondary cursor is over files.

#rb juan.legaz

[CL 26937944 by robert millar in ue5-main branch]
2023-08-08 19:51:36 -04:00
robert manuszewski
cfe46a88ad TObjectPtr compilation fixes ahead of enabling GC barrier
#rb trivial
[FYI] Kirill.Zorin, Johan.Torp, Zousar.Shaker

[CL 26767884 by robert manuszewski in ue5-main branch]
2023-08-02 06:51:30 -04:00
juan legaz
136802e0d5 Fixing partial targeted CL updates from perforce not being updated with their filestates due to an assumption that all CLs were always requested
#rb zack.rammel

[CL 26602159 by juan legaz in ue5-main branch]
2023-07-26 06:22:07 -04:00
paul chipchase
0f940ff4b9 Truncation warning fixes for PerforceSourceControl module
#rb trivial
#rnx

[CL 26601577 by paul chipchase in ue5-main branch]
2023-07-26 05:30:56 -04:00
robert millar
1a9b6863a8 Optimize FPerforceGetPendingChangelistsWorker when getting files for all changelists by executing a single 'opened' command and parsing the results.
Speeds up query from 20+s to around 1.5s in an example workspace with 54 changelists.

#rb brooke.hubert

[CL 26294455 by robert millar in ue5-main branch]
2023-06-28 14:57:35 -04:00