Skip to content

Commit

Permalink
Merge pull request #1747: UpgradeVerb: write deprecation notice
Browse files Browse the repository at this point in the history
We removed the old upgrader in #1746 but delayed creating its replacement.

The plan was to use `winget upgrade`, but it is only experimental right now. Further, we would need to use `winget list` to determine if we needed `winget install` instead, and `winget list` is also experimental. The tool needs to mature more before we can create a dependency on it.

Instead, warn a user that tries to upgrade with `gvfs upgrade` that this CLI is no longer supported and instead point them to the repository's README which can help with the latest update.
  • Loading branch information
derrickstolee authored Jul 14, 2021
2 parents 07e8cb4 + 55a11c7 commit 4305fa4
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 120 deletions.
44 changes: 0 additions & 44 deletions GVFS/GVFS.UnitTests/Windows/Mock/MockProcessLauncher.cs

This file was deleted.

77 changes: 1 addition & 76 deletions GVFS/GVFS/CommandLine/UpgradeVerb.cs
Original file line number Diff line number Diff line change
@@ -1,41 +1,15 @@
using CommandLine;
using GVFS.Common;
using GVFS.Common.FileSystem;
using GVFS.Common.Tracing;
using System;
using System.Diagnostics;
using System.IO;

namespace GVFS.CommandLine
{
[Verb(UpgradeVerbName, HelpText = "Checks for new GVFS release, downloads and installs it when available.")]
public class UpgradeVerb : GVFSVerb.ForNoEnlistment
{
private const string UpgradeVerbName = "upgrade";
private const string DryRunOption = "--dry-run";
private const string NoVerifyOption = "--no-verify";
private const string ConfirmOption = "--confirm";

private ITracer tracer;
private PhysicalFileSystem fileSystem;
private ProcessLauncher processLauncher;

public UpgradeVerb(
ITracer tracer,
PhysicalFileSystem fileSystem,
ProcessLauncher processWrapper,
TextWriter output)
{
this.tracer = tracer;
this.fileSystem = fileSystem;
this.processLauncher = processWrapper;
this.Output = output;
}

public UpgradeVerb()
{
this.fileSystem = new PhysicalFileSystem();
this.processLauncher = new ProcessLauncher();
this.Output = Console.Out;
}

Expand Down Expand Up @@ -67,56 +41,7 @@ protected override string VerbName

public override void Execute()
{
this.ReportErrorAndExit(this.tracer, ReturnCode.GenericError, "failed to upgrade");
}

public class ProcessLauncher
{
public ProcessLauncher()
{
this.Process = new Process();
}

public Process Process { get; private set; }

public virtual bool HasExited
{
get { return this.Process.HasExited; }
}

public virtual int ExitCode
{
get { return this.Process.ExitCode; }
}

public virtual void WaitForExit()
{
this.Process.WaitForExit();
}

public virtual bool TryStart(string path, string args, bool useShellExecute, out Exception exception)
{
this.Process.StartInfo = new ProcessStartInfo(path)
{
UseShellExecute = useShellExecute,
WorkingDirectory = Environment.SystemDirectory,
WindowStyle = ProcessWindowStyle.Normal,
Arguments = args
};

exception = null;

try
{
return this.Process.Start();
}
catch (Exception ex)
{
exception = ex;
}

return false;
}
Console.Error.WriteLine("'gvfs upgrade' is no longer supported. Visit https://github.com/microsoft/vfsforgit for the latest install/upgrade instructions.");
}
}
}

0 comments on commit 4305fa4

Please sign in to comment.