Commit Graph

160 Commits

Author SHA1 Message Date
paul chipchase
82a27f8cf9 Fix problems setting perforce settings from the commandline introduced in CL 19318801.
#rb Sebastian.Nordgren
#rnx
#preflight 62309ccae65a7e65d686d1dc
#robomerge FNNC

- The behaviour for the settings for the default provider (that takes it's settings from the command line) should be OverrideExisting not  OverrideAll to maintain the original behaviour. This was a mistake due to misreading the original code. As it was, setting one setting via the command line would clear any previously set or saved settings.
- When parsing the cmdline we used the form "KeyName=" as the key, as FParse::Value does not strip the = automatically, but when we were looking up the values to override settings we were just using "KeyName" which would not match. The lambda ::ParseCmdLineSetting now adds = to any key passed in when parsing, so there is no longer a need for the caller to add it. This helps the keys match and work correctly.

[CL 19386795 by paul chipchase in ue5-main branch]
2022-03-15 11:32:55 -04:00
paul chipchase
14b6c6fc6a Allow the caller to decide if FUpdateStatus will check for directy paths based on the path itself (terminating in a seperator) or if the file system should be used instead.
#rb Patrick.Laflamme
#jira UE-145721
#rnx
#preflight 622f0358752729a2ad448e16

- The problem we have is if a p4 depot path is used when requesting filestates (to see if the file exists in p4 for example) it will be treated as a networkpath due to it starting with // so calling the filesystem to check if it is a directory or not can get very expensive.
- Other operations just check the end of the path for '/' or '\' which is what this operation used to do, but that was changed at some point to check the file system, presumably to fix another problem and as we don't really know how 3rd party code is using this system we cannot just change the behavior without risking breaking existing code bases.
- This fix allows the caller to opt in to the old behavior of just checking the end of the path to determine if it is a directory or not.
- This fix is not very good, future work for a better fix will be tracked in the attached jira.

[CL 19371141 by paul chipchase in ue5-main branch]
2022-03-14 05:25:55 -04:00
paul chipchase
c08d860e2e Allow additional source control providers to be created so that specialized subsystems can maintain their own separate connection without interrupting the normal editor workflows.
#rb Luc.Eygasier, Sebastien.Lussier
#rnx
#preflight 622895d331133a23da78a4ca

### Misc
- FPerforceSourceControlRevision, FPerforceConnection and FPerforceSourceControlLabel now own a reference to their FPerforceSourceControlProvider and accesses the connection settings from that rather than via the module singleton.
- FPerforceSourceControlCommand now accesses the connection settings by finding the FPerforceSourceControlProvider that the given IPerforceSourceControlWorker references.
- FPerforceSourceControlProvider now owns it's own FPerforceSourceControlSettings rather than accessing a shared one owned by the module.
- Marked a number of derived classes as final.

### FPerforceConnection
- ::EnsureValidConnection can now work without a valid client (although most commands will require a client to run, things like p4 print does not).
-- Due to this change we might not catch cases where the the system cannot connect to source control as the user is not logged in as this would get caught when we checked the workspace by calling ::TestConnection.
-- To get around this ::EnsureValidConnection will now call "p4 login -s" via the newly added TestLoginConnection.
- Renamed ::TestConnection to ::TestClientConnection as we are really testing the connection to the specified workspace.
- There does seem to be some inconsistency in the logging, depending how a perforce source control provider first creates its connection as in some cases FPerforceConnection::EnsureValidConnection gets called first and in other cases FPerforceConnection::EstablishConnection is called. We should unify these paths but this change list is already so large I am opting to postpone this to it's own work item.

### FPerforceSourceControlModule
- Removed all of the singleton style accessors so that classes inside of the module can no longer assume that there is only one FPerforceSourceControlProvider. Updated the documentation to match.
- Since there is no reason for classes in the module to need to access FPerforceSourceControlModule, ::Get has been removed
- The responsibility to register all of the worker creation delegates has been moved to IPerforceSourceControlWorker so that all source control providers can share them.
- ::GetProvider has been removed, if a class inside the module needs access to a provider then a reference to it's provider will be given to it at construction time.
- ::SetLastError, ::AccessSettings and ::SaveSettings are now called directly on FPerforceSourceControlSettings

### FPerforceSourceControlSettings
- This class now takes the name of the system that owns it as a parameter in the constructor
-- The name will be used to identify where to store the settings in the config file, unless the name is blank in which case the pre-existing default location will be used.
- This will allow for multiple source control providers to store their connection info.

### SPerforceSourceControlSettings
- Moved FGetWorkspaces from SPerforceSourceControlSettings.h to its own header file to reduce the number of places that need to include the slate headers.
- Move the fwd declares to the top of the header base don recent coding standards discussions.
- Instead of accessing the source control provider via FPerforceSourceControlModule the dialog is now given a pointer to one when constructed.
-- This pointer is assumed to always be valid and should be a reference if the slate system supported it.

### PerforceSourceControlOperations
- IPerforceSourceControlWorker now takes a reference to the owning FPerforceSourceControlProvider in it's constructor. All derived workers have been updated to this.
- Moved the registering of worker creation delegates from the module cpp to a new static method IPerforceSourceControlWorker::RegisterWorkers
-- This should make it easier to find when adding a new worker and allows source control providers to share the same map of delegates rather than duplicating it.
-- This means we also need a new static method IPerforceSourceControlWorker::CreateWorker for instantiating new workers based on the given name.

### FSourceControlInitSettings
- This is a new class that is used to set up a newly created source control provider.
- The settings are expected to be given in the same way you would override settings via the cmdline. The existing perforce cmdline code has been updated to use this class.
- This still has the downside that the calling code needs to know the type of source control provider, but I don't really see a good way around this unless we refactor the entire API to be feature based.

[CL 19318801 by paul chipchase in ue5-main branch]
2022-03-09 07:10:46 -05:00
luc eygasier
17192faa91 Modifies UpdateStatus to enforce full validation only if bForceUpdate flag is used. Ignoring files not opened/edited by default.
#jira UE-142984
#rb Matt.Johnson
#preflight 621e9446f1206ae3ea672a99


#ROBOMERGE-AUTHOR: luc.eygasier
#ROBOMERGE-SOURCE: CL 19209915 via CL 19210531 via CL 19211958 via CL 19212023 via CL 19212162
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v921-19075845)

[CL 19224112 by luc eygasier in ue5-main branch]
2022-03-02 13:11:09 -05:00
paul chipchase
bfbe90794a The source control operation FCreateWorkspace now supports setting a description.
#rb Sebastian.Nordgren
#rnx
#preflight 621896c2a77f4c4a4b9b7a86

[CL 19143635 by paul chipchase in ue5-main branch]
2022-02-25 04:17:39 -05:00
paul chipchase
96111498dc Fix a mismerge in the FCreateWorkspace command introduced in CL 18946159 that prevented the FCreateWorkspace::EType value from being used.
#rb trivial
#jira UE-143686
#rnx
#preflight 621880ee19758119df4b10aa

[CL 19143374 by paul chipchase in ue5-main branch]
2022-02-25 02:44:38 -05:00
charles lefebvre
f1d2bef52d UE: add an option to use the P4Config
#Tests: PIE, switch between 2 branches with same config file, ensure that P4Config is correctly set
[REVIEW] Patrick.Laflamme
[FYI] Brooke.Hubert, Guillaume.Morreel

#ROBOMERGE-AUTHOR: charles.lefebvre
#ROBOMERGE-SOURCE: CL 19079616 via CL 19082287 via CL 19088908 via CL 19089025 via CL 19090086
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v921-19075845)

[CL 19131863 by charles lefebvre in ue5-main branch]
2022-02-24 19:11:04 -05:00
richard malo
b3c340041b Added option to provide a different project directory to be used by source control.
#rb scott.nelson
[FYI] luc.eygasier
#preflight 62055a9369224cb0d87518ca

#ROBOMERGE-OWNER: richard.malo
#ROBOMERGE-AUTHOR: richard.malo
#ROBOMERGE-SOURCE: CL 18943053 via CL 18944261 via CL 18944332 via CL 18944374 via CL 18946678 via CL 18946778
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v917-18934589)

[CL 18946785 by richard malo in ue5-main branch]
2022-02-10 19:07:07 -05:00
Mike Beach
d1f8e0da6e Adopting some editor source control modifications from a partner stream.
* Introduces a new 'GetFileList' operation
  * Adds "keep checked out" option to other operations

#rb Luc.Eygasier
#preflight 620598920c64e1822f4849a8

[CL 18946159 by Mike Beach in ue5-main branch]
2022-02-10 18:34:05 -05:00
luc eygasier
5c80611276 Adds FSourceControlFilesDeletedDelegate. Should be broadcasted when revert/markfordelete operation could require cleanups (eg package/assets/ref deleted).
Fixes Reverting mark for add asset preventing to recreate an asset with the same name in the same editor session (Asset was still present in AssetRegistry).

#jira UE-140995, UEENGQA-62727
#rb Sebastien.Lussier
#tb Tim.Gautier
#preflight 62056230b84973a2bb61b450

#ROBOMERGE-OWNER: luc.eygasier
#ROBOMERGE-AUTHOR: luc.eygasier
#ROBOMERGE-SOURCE: CL 18943038 in //UE5/Release-5.0/... via CL 18943294 via CL 18943483
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v917-18934589)
#ROBOMERGE-CONFLICT from-shelf

[CL 18943896 by luc eygasier in ue5-main branch]
2022-02-10 17:08:14 -05:00
luc eygasier
d6b8aa4536 Adds "Delete new files on revert" option for Source Control
Prevents Uncontrolled Changelist's UpdateStatus usage to pollute the error logs.

#jira UE-140095
#rb JeanFrancois.Dube
#preflight 61f44e47801201ab3894f020

#changelist validated

#ROBOMERGE-AUTHOR: luc.eygasier
#ROBOMERGE-SOURCE: CL 18796586 in //UE5/Release-5.0/... via CL 18797752 via CL 18798475
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v908-18788545)

[CL 18798602 by luc eygasier in ue5-main branch]
2022-01-31 17:03:09 -05:00
paul chipchase
f1a757998c Submitting new or previously deleted packages via the editor to perforce should no longer log errors about 'file(s) not on client'
#rb luc.eygasier
#rnx
#jira UE-140019
#preflight 61eeaf0def289ffc6de6bad7

- In CL 18058385 -f (Force the diff) was applied to the diff command when trying to find unchanged files when submitting to perforce.
- When submitting files marked for add (either new files or files that are deleted at the head revision) using -f changed the message for the file from '- file(s) not opened for edit.' which we were removing from the error list to '- file(s) not on client.' which we were not.
- '- file(s) not on client.' has now been added to the list of errors we ignore from this specific 'p4 diff' command.

#ROBOMERGE-AUTHOR: paul.chipchase
#ROBOMERGE-SOURCE: CL 18753907 in //UE5/Release-5.0/... via CL 18753921 via CL 18756982
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v903-18687472)

[CL 18757302 by paul chipchase in ue5-main branch]
2022-01-27 14:10:52 -05:00
luc eygasier
e7cf76b86b Fixes shelved files from another branch preventing FPerforceGetPendingChangelistsWorker to complete, hence Changelist Window to refresh.
#rb Sebastien.Lussier
#jira UE-120722
#robomerge Release-5.0

#changelist validated

[CL 18432022 by luc eygasier in ue5-main branch]
2021-12-10 13:18:09 -05:00
paul chipchase
da78f85621 Allow the type to be customized when creating a workspace.
#rb PJ.Kack
#rnx
#preflight 61af08530e3f453820536d83

- Add a new type enum to FCreateWorkspace that can be used to decide on the type of client to create.
- Currently supporting types that map closely with perforce.

#ROBOMERGE-AUTHOR: paul.chipchase
#ROBOMERGE-SOURCE: CL 18392669 in //UE5/Release-5.0/... via CL 18392676
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v896-18170469)

[CL 18392677 by paul chipchase in ue5-release-engine-test branch]
2021-12-07 02:45:37 -05:00
luc eygasier
20ff9372da Fixes hash based UpdateStatus unable to detect unchanged text files because of difference in P4 server line ending.
Replaced by forcing the diff command (hence avoiding errors for files not opened in workspace)

#rb Sebastien.Lussier

#changelist validated

#ROBOMERGE-AUTHOR: luc.eygasier
#ROBOMERGE-SOURCE: CL 18058385 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v885-17909292)
#ROBOMERGE[STARSHIP]: UE5-Release-Engine-Staging Release-5.0

[CL 18058440 by luc eygasier in ue5-release-engine-test branch]
2021-11-04 11:59:09 -04:00
luc eygasier
d96ea0b872 Fix abusive external dependencies validation error:
* Fixes Source Control cache corruption when submitting a changelist
* Updates external dependencies states when validating in case cached states are not valid anymore

#jira UE-132868
#rb Sebastien.Lussier

#changelist validated

#ROBOMERGE-AUTHOR: luc.eygasier
#ROBOMERGE-SOURCE: CL 18033926 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v885-17909292)
#ROBOMERGE[STARSHIP]: UE5-Release-Engine-Staging Release-5.0

[CL 18033936 by luc eygasier in ue5-release-engine-test branch]
2021-11-03 10:43:41 -04:00
paul chipchase
56dfafbb35 Only log why a potential workspace was rejected for consideration to when verbose logging for 'LogSourceControl is enabled
#rb Sebastien.Lussier
#rnx
#preflight 61432653b5a4fa00015cd3a7

- Due to mirage, the build machines can now end up initializing the perforce source control module and have access to many hundreds of potential workspaces. Logging each rejected workspace not only fills the log with spam, but can take several seconds (7 or more in tests) to complete, which is a waste of time.
- Changed the log item to verbose, rather than remove it so that people trying to debug a problem will still have access to the info if they need it.
- Technically for Mirage the build machines don't need a workspace as they will only ever be using p4 print, but our current architecture does not really allow for this (ideally Mirage would be creating/requesting it's own instance of the PerforceSourceControlProvider which we could make sure did not attempt to find a workspace) but changing the logging verbosity will serve for now.

#ROBOMERGE-AUTHOR: paul.chipchase
#ROBOMERGE-SOURCE: CL 17548648 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v870-17433530)

[CL 17548659 by paul chipchase in ue5-release-engine-test branch]
2021-09-17 03:11:13 -04:00
luc eygasier
10d4800ede Rework Source Control Changelist Window?s Asset beautification:
* Adds Source Control Asset Data cache. Preventing Source Control Changelist Window to rebuild AssetData from scratch when UI refresh takes place
* Modifies Source Control beautification to async process, preventing crowded changelists to block the workflow. The filenames are now beautified when available.
* Parallelize AssetData information retrieval from SourceControl
* Updates message displayed when refreshing window's items

#rb Sebastien.Lussier, JeanFrancois.Dube
#jira UETOOL-3522

#changelist validated

#ROBOMERGE-SOURCE: CL 17375288 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v865-17346139)

[CL 17375337 by luc eygasier in ue5-release-engine-test branch]
2021-08-31 15:14:29 -04:00
paul chipchase
dbe106b375 CIS: Add file missing from CL 17350788
#rb Sebastien.Lussier
#rnx
#preflight 611e457e2c1f1c0001292a29

#ROBOMERGE-SOURCE: CL 17351233 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v865-17346139)

[CL 17351247 by paul chipchase in ue5-release-engine-test branch]
2021-08-30 09:04:52 -04:00
paul chipchase
16cd15b8ed The ability to create, delete and switch workspaces via the SourceControl API. Currently this is only implemented for the perforce source control plugin.
#rb Sebastien.Lussier
#rnx
#preflight 611e457e2c1f1c0001292a29

### ISourceControlProvider / PerforceSourceControlProvider
- Add new method ::SwitchWorkspace allowing the caller to switch the current workspace.
    - Currently only implemented for perforce.
    - Calling this will cause the provider to close and then re-open it's connection and so will invalidate any existing established connection or cached states. Due to this the method will fail if there are outstanding commands being processed.
    - It is intended that this is only used for short periods of time, in order to submit or access files from locations that the user chosen workspace might be able to access.
    - The new workspace will not be saved to the source control settings. Although this could occur later if done.

### SourceControlOperations
- Add new operation **FCreateWorkspace**.
    - Currently only implemented for perforce.
    - The name and the root of the workspace (filepath on the client machine) must be provided in the constructor.
    - Additional mappings can be provided by calling **AddNativeClientViewMapping** which expects the mapping to be in the native format of the target source control system. At some point in the future we may add a more generic, target agnostic, format.
- Add new operation **FDeleteWorkspace**.
    - Currently only implemented for perforce.
   - Deletes the workspace of the given name although the workspace must be in a state where it can be deleted (no files open for add/edit/delete etc) or the operation will fail.

### PerforceConnection
- Add a new method ::CreateWorkspace for creating workspaces
- Add a new extended client 'FP4CommandWithStdInputClientUser'
    - We should really extend FP4ClientUser to be able to take overridden stdinput instead  but that would mean adding yet another input parameter. I'd rather keep the code separate for now and then merge them together in a future refactor where the many input parameters of ::RunCommand is replaces with a struct with TOptional members.
- Added a ::GetUser method, which returns the user of the current connection without the caller needing to know if the connection is in unicode format or not.

#ROBOMERGE-SOURCE: CL 17350788 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v865-17346139)

[CL 17350796 by paul chipchase in ue5-release-engine-test branch]
2021-08-30 08:07:59 -04:00
luc eygasier
023de629a0 Adds "LastSynced" flag to Perforce Sync operation, allowing to force sync (ie revert) to the last synced version of an asset.
Modifies Revert operation on Uncontrolled assets to force sync to last synced version instead of head revision.

#rb Sebastien.Lussier

#changelist validated

#ROBOMERGE-SOURCE: CL 16943684 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v838-16927207)

[CL 16943688 by luc eygasier in ue5-release-engine-test branch]
2021-07-23 20:22:17 -04:00
paul chipchase
5c51f3f814 Improve error handling and logging in the file and jupiter Mirage backends.
#rb Per.Larsson
#rnx
#preflight 60f9212d1f926d0001d41223

* VirtualizationJupiterBackend
- When pulling a payload we should assume that a 400 error response when trying to GET the payload header means that the payload is not in Jupiter.
-- Not being able to find the payload should not log an error, instead we can make a note of it in the verbose log (similar to the file system backend)

* VirtualizationFileBackend
- Moved the formatting of system errors to it's own function.
- Log the system error when failing to write a payload during a push as well as a pull.
- We now check that the FileArchive wrote correctly to disk and delete the output file and fail the push if it did not.
-- A future piece of work will change the logic to write to a tmp file at the root of the file store and them move the file to the final location to cut down on the potential of leaving corrupted files around (similar to the process when we save packages)

* Perforce
- The FDownloadFile command now takes an optional parameter EVerbosity that can allow the caller to choose the level of logging output that the command will generate.
- The source control backend for Mirage now opts to supress the logging of the full perforce command when we are pulling payloads as we can generate many hundreds or thousands of requests and the info is not useful to users.
-- We continue to log the command when validating the depot as this is the most likely command to fail so having the info in the log may prove useful.

#ROBOMERGE-SOURCE: CL 16921815 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v836-16769935)

[CL 16921818 by paul chipchase in ue5-release-engine-test branch]
2021-07-22 05:45:28 -04:00
rtjonnyr
1b1a82bb50 Unshelved from pending changelist '16239478':
PR #7989: Fixed issue where file history was truncated for moved files (Contributed by rtjonnyr)

#jira UE-115245
#rb Sebastien.Lussier
#github
#preflight 60d23e9aa8190400014cad5d

#ROBOMERGE-SOURCE: CL 16749525 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v835-16672529)

[CL 16749537 by rtjonnyr in ue5-release-engine-test branch]
2021-06-22 17:25:10 -04:00
luc eygasier
87c6e2529b Update contextual menu in Changelist window to support Uncontrolled Changelists
* Update MarkForAdd operation to operate on a specified changelist
* Adds Force option in sync operation to be able to revert uncontrolled files
* Adds the resulting new changelist to FNewChangelist operation
* Adds support for "mark for add" files when moving from UCL to C
* Adds support for reverting Uncontrolled Changelist, Uncontrolled Changelist files, or mixes of controlled/uncontrolled files
* Adds support of "Move files to..." contextual action for Uncontrolled files and to Uncontrolled Changelists

#rb Sebastien.Lussier

#changelist validated

#ROBOMERGE-SOURCE: CL 16662633 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v834-16658389)

[CL 16662640 by luc eygasier in ue5-release-engine-test branch]
2021-06-14 15:25:40 -04:00
luc eygasier
8a36dd39f0 Adds automatic discovery of potentially modified files out of SourceControl.
* Adds reconcile contextual actions to manually trigger the verification process
* Loads UncontrolledChangelists module along UnrealEd to be able to hook loaded/saved files sooner
* Adds CPU Trace for FPerforceUpdateStatusWorker::Execute and ParseUpdateStatusResults
* Changes FPerforceCheckOutWorker to update Changelist State if checked out directly to a CL
* Changes FPerforceRevertWorker to update Changelist State after revert

#rb Sebastien.Lussier

#changelist validated

[CL 16477108 by luc eygasier in ue5-main branch]
2021-05-26 18:15:46 -04:00