Skip to content

Commit b74d49d

Browse files
committed
Added -diag switch which disables cache, dumps the graph and logs everything out.
1 parent 067d3c4 commit b74d49d

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

src/GitVersionExe/ArgumentParser.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,16 @@ public static Arguments ParseArguments(List<string> commandLineArguments)
150150
}
151151

152152

153+
if (name.IsSwitch("diag"))
154+
{
155+
if (value == null || value.IsTrue())
156+
{
157+
arguments.Diag = true;
158+
}
159+
continue;
160+
}
161+
162+
153163
if (name.IsSwitch("updateAssemblyInfo"))
154164
{
155165
if (value.IsTrue())

src/GitVersionExe/Arguments.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public Arguments()
2525
public string DynamicRepositoryLocation;
2626

2727
public bool Init;
28+
public bool Diag;
2829

2930
public bool IsHelp;
3031
public string LogFilePath;

src/GitVersionExe/Program.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,19 @@ static int VerifyArgumentsAndRun()
6262
HelpWriter.Write();
6363
return 0;
6464
}
65+
if (arguments.Diag)
66+
{
67+
arguments.NoCache = true;
68+
arguments.Output = OutputType.BuildServer;
69+
}
6570

6671
ConfigureLogging(arguments);
72+
73+
if (arguments.Diag)
74+
{
75+
Logger.WriteInfo("Dumping commit graph: ");
76+
GitTools.LibGitExtensions.DumpGraph(arguments.TargetPath, Logger.WriteInfo, 100);
77+
}
6778
if (!Directory.Exists(arguments.TargetPath))
6879
{
6980
Logger.WriteWarning(string.Format("The working directory '{0}' does not exist.", arguments.TargetPath));
@@ -124,7 +135,7 @@ static int VerifyArgumentsAndRun()
124135
return 0;
125136
}
126137

127-
private static void VerifyConfiguration(Arguments arguments, IFileSystem fileSystem)
138+
static void VerifyConfiguration(Arguments arguments, IFileSystem fileSystem)
128139
{
129140
var gitPreparer = new GitPreparer(arguments.TargetUrl, arguments.DynamicRepositoryLocation, arguments.Authentication, arguments.NoFetch, arguments.TargetPath);
130141
ConfigurationProvider.Verify(gitPreparer, fileSystem);
@@ -179,7 +190,7 @@ static void ConfigureLogging(Arguments arguments)
179190

180191
static void WriteLogEntry(Arguments arguments, string s)
181192
{
182-
var contents = string.Format("{0}\t\t{1}\r\n", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), s);
193+
var contents = string.Format("{0:yyyy-MM-dd HH:mm:ss}\t\t{1}\r\n", DateTime.Now, s);
183194
File.AppendAllText(arguments.LogFilePath, contents);
184195
}
185196

0 commit comments

Comments
 (0)