Skip to content

Commit

Permalink
sync details to stdout
Browse files Browse the repository at this point in the history
  • Loading branch information
jessk-msft committed Aug 19, 2024
1 parent 41c64f3 commit 5b9e3cd
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions source/P4VFS.Console/P4VFS.Notes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Version [1.28.0.0]
* Fixing bug causing some perforce sync errors not to be shown when doing a quite
single mode sync, such as 'populate', or 'sync -q -m Single'
* Update to P4API 2024.1 and OpenSSL 3.3.1. UnitTest now uses p4d.exe/p4.exe 2024.1
* Virtual sync details at the start of sync operation now write to StdOut instead of StdErr

Version [1.27.1.0]
* Now also ignoring specdef tag from P4API results, similar to P4API.NET
Expand Down
6 changes: 3 additions & 3 deletions source/P4VFS.Core/Source/DepotOperations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ DepotOperations::SyncVirtual(
}
}

depotClient->Log(LogChannel::Warning, StringInfo::Join(DepotStringArray{ "Virtual Sync:", ToString(syncOptions.m_Files), DepotSyncFlags::ToString(syncOptions.m_SyncFlags), DepotFlushType::ToString(syncOptions.m_FlushType), revision->ToString() }, " "));
depotClient->Log(LogChannel::Info, StringInfo::Join(DepotStringArray{ "Virtual Sync:", ToString(syncOptions.m_Files), DepotSyncFlags::ToString(syncOptions.m_SyncFlags), DepotFlushType::ToString(syncOptions.m_FlushType), revision->ToString() }, " "));
depotClient->Log(LogChannel::Info, StringInfo::Format("Started at [%s] version [%s]", DepotDateTime::Now().ToDisplayString().c_str(), CSTR_WTOA(FileSystem::GetModuleVersion())));
if (depotClient->IsFaulted())
{
Expand Down Expand Up @@ -797,10 +797,10 @@ DepotOperations::SyncCommand(
log = depotClient->Log();
}

LogDeviceFilter errorLog(log, LogChannel::Error);
LogDeviceFilter quietLog(log, syncFlags & DepotSyncFlags::Flush ? LogChannel::Error : LogChannel::Warning);
if (syncFlags & DepotSyncFlags::Quiet)
{
log = &errorLog;
log = &quietLog;
}

auto reportError = [&](const DepotString& context) -> void
Expand Down
2 changes: 1 addition & 1 deletion source/P4VFS.UnitTest/Source/UnitTestCommon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1507,7 +1507,7 @@ public void SyncEmptyFileSpecTest()
DepotSyncResult syncResult = depotClient.Sync("//...", null, DepotSyncFlags.Flush|DepotSyncFlags.Quiet);
Assert(syncResult != null && syncResult.Modifications != null);
Assert((syncResult.Status == DepotSyncStatus.Success && syncResult.Modifications.Length > clientFileCount) ||
(syncResult.Status == DepotSyncStatus.Warning && syncResult.Modifications.Length == 1 && syncResult.Modifications[0].SyncActionType == DepotSyncActionType.UpToDate));
(syncResult.Status == DepotSyncStatus.Success && syncResult.Modifications.Length == 1 && syncResult.Modifications[0].SyncActionType == DepotSyncActionType.UpToDate));

syncResult = depotClient.Sync("//...");
Assert(syncResult?.Status == DepotSyncStatus.Success);
Expand Down
3 changes: 2 additions & 1 deletion source/P4VFS.UnitTest/Source/UnitTestWorkflow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,8 @@ public void SyncStatusTest()
{
var AssertFileSyncStatus = new Action<string,string,bool>((string depotSpec, string syncOption, bool valid) =>
{
int exitCode = ProcessInfo.ExecuteWait(P4vfsExe, String.Format("{0} sync {1} {2}", ClientConfig, syncOption, depotSpec), echo:true, log:true);
ProcessInfo.ExecuteResultOutput syncOutput = ProcessInfo.ExecuteWaitOutput(P4vfsExe, String.Format("{0} sync {1} {2}", ClientConfig, syncOption, depotSpec), echo:true, log:true);
int exitCode = syncOutput.ExitCode == 0 && syncOutput.HasStdErr == false ? 0 : 1;
Assert((valid == true && exitCode == 0) || (valid == false && exitCode != 0));
ProcessInfo.ExecuteResultOutput flushOutput = ProcessInfo.ExecuteWaitOutput(P4Exe, String.Format("{0} flush -f {1}", ClientConfig, depotSpec), echo:true);
exitCode = (exitCode == 0 && flushOutput.HasStdErr == false) ? 0 : 1;
Expand Down

0 comments on commit 5b9e3cd

Please sign in to comment.