Skip to content

Commit

Permalink
Rename ChangedFiles to LocallyChangedFiles and use "undochange" & "pa…
Browse files Browse the repository at this point in the history
…rtial undo" for extra clarity
  • Loading branch information
SRombauts committed Mar 8, 2023
1 parent 35229d3 commit d067845
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ bool FPlasticRevertWorker::Execute(FPlasticSourceControlCommand& InCommand)

const TArray<FString> Files = GetFilesFromCommand(GetProvider(), InCommand);

TArray<FString> ChangedFiles;
TArray<FString> LocallyChangedFiles;
TArray<FString> CheckedOutFiles;

for (const FString& File : Files)
Expand All @@ -628,7 +628,7 @@ bool FPlasticRevertWorker::Execute(FPlasticSourceControlCommand& InCommand)

if (State->WorkspaceState == EWorkspaceState::Changed)
{
ChangedFiles.Add(State->LocalFilename);
LocallyChangedFiles.Add(State->LocalFilename);
}
else
{
Expand Down Expand Up @@ -659,9 +659,17 @@ bool FPlasticRevertWorker::Execute(FPlasticSourceControlCommand& InCommand)

InCommand.bCommandSuccessful = true;

if (ChangedFiles.Num() > 0)
if (LocallyChangedFiles.Num() > 0)
{
InCommand.bCommandSuccessful &= PlasticSourceControlUtils::RunCommand(TEXT("undo"), TArray<FString>(), ChangedFiles, InCommand.InfoMessages, InCommand.ErrorMessages);
if (-1 != InCommand.ChangesetNumber)
{
InCommand.bCommandSuccessful &= PlasticSourceControlUtils::RunCommand(TEXT("undochange"), TArray<FString>(), LocallyChangedFiles, InCommand.InfoMessages, InCommand.ErrorMessages);
}
else
{
// partial undochange doesn't exist in partial mode
InCommand.bCommandSuccessful &= PlasticSourceControlUtils::RunCommand(TEXT("partial undo"), TArray<FString>(), LocallyChangedFiles, InCommand.InfoMessages, InCommand.ErrorMessages);
}
}

if (CheckedOutFiles.Num() > 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ namespace EWorkspaceState
Unknown,
Ignored,
Controlled, // called "Pristine" in Perforce, "Unchanged" in Git, "Clean" in SVN
CheckedOut,
CheckedOut, // Checked-out, without telling if Changed or not
Added,
Moved, // Renamed
Copied,
Replaced, // Replaced / Merged
Deleted,
LocallyDeleted, // Missing
Changed, // Modified but not CheckedOut
Changed, // Locally Changed but not CheckedOut
Conflicted,
Private, // "Not Controlled"/"Not In Depot"/"Untracked"
};
Expand Down

0 comments on commit d067845

Please sign in to comment.