From 343f536115bb987cc81505de34dd7a39da6c5b79 Mon Sep 17 00:00:00 2001 From: "Joel W. Reed" Date: Fri, 4 Apr 2008 16:31:29 -0400 Subject: [PATCH] note.invalid.version.spec --- tools/opentf/Command.cs | 46 +++++++++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/tools/opentf/Command.cs b/tools/opentf/Command.cs index a6582cd..5b1e2fb 100644 --- a/tools/opentf/Command.cs +++ b/tools/opentf/Command.cs @@ -60,12 +60,12 @@ abstract class Command : CommandOptions } static Command() - { - int p = (int) Environment.OSVersion.Platform; - if (!((p == 4) || (p == 128))) runningOnUnix = false; + { + int p = (int) Environment.OSVersion.Platform; + if (!((p == 4) || (p == 128))) runningOnUnix = false; - ReadFileExcludes(); - } + ReadFileExcludes(); + } public static StringComparer PathComparer { @@ -76,11 +76,11 @@ abstract class Command : CommandOptions } public Command(Driver driver, string[] args) - { - this.driver = driver; - ProcessArgs(args); - this.arguments = RemainingArguments; - } + { + this.driver = driver; + ProcessArgs(args); + this.arguments = RemainingArguments; + } public Workspace GetWorkspaceFromServer() { @@ -95,7 +95,7 @@ abstract class Command : CommandOptions } if (String.IsNullOrEmpty(name)) - name = Settings.Current.Get("Workspace.Default"); + name = Settings.Current.Get("Workspace.Default"); if (String.IsNullOrEmpty(name)) { @@ -119,12 +119,12 @@ abstract class Command : CommandOptions if (info != null) return info; if (String.IsNullOrEmpty(OptionWorkspace)) - OptionWorkspace = Settings.Current.Get("Workspace.Default"); + OptionWorkspace = Settings.Current.Get("Workspace.Default"); if (String.IsNullOrEmpty(OptionWorkspace)) { Console.WriteLine("Unable to determine the workspace."); - Console.WriteLine(" Path: " + path); + Console.WriteLine(" Path: " + path); return null; } @@ -135,8 +135,8 @@ abstract class Command : CommandOptions if (info == null) { Console.WriteLine("Unable to determine the workspace."); - Console.WriteLine(" Workspace Name: " + OptionWorkspace); - Console.WriteLine(" Workspace Owner: " + ownerName); + Console.WriteLine(" Workspace Name: " + OptionWorkspace); + Console.WriteLine(" Workspace Owner: " + ownerName); } return info; @@ -150,8 +150,8 @@ abstract class Command : CommandOptions { Console.WriteLine(); Console.WriteLine("Hints:"); - Console.WriteLine(" Try adding /workspace:"); - Console.WriteLine(" Review command options prefixed with '/'. Invalid options are mistaken for paths."); + Console.WriteLine(" Try adding /workspace:"); + Console.WriteLine(" Review command options prefixed with '/'. Invalid options are mistaken for paths."); Environment.Exit((int)ExitCode.Failure); } @@ -161,7 +161,15 @@ abstract class Command : CommandOptions public VersionSpec VersionFromString(string version) { if (!String.IsNullOrEmpty(version)) - return VersionSpec.ParseSingleSpec(version, Driver.Username); + { + VersionSpec spec = VersionSpec.ParseSingleSpec(version, Driver.Username); + if (spec == null) + { + Console.WriteLine("Error: Invalid version specification."); + Environment.Exit((int)ExitCode.Failure); + } + return spec; + } else return VersionSpec.Latest; } @@ -247,7 +255,7 @@ abstract class Command : CommandOptions string exclusionList = Settings.Current.Get("File.Excludes"); if (String.IsNullOrEmpty(exclusionList)) return; - string separatorChar = Path.DirectorySeparatorChar.ToString(); + string separatorChar = Path.DirectorySeparatorChar.ToString(); string[] wildcards = exclusionList.Split(','); StringBuilder dirRegexs = new StringBuilder(); -- 2.11.4.GIT