diff --git a/NetRevisionTool/Program.cs b/NetRevisionTool/Program.cs
index a090b11..c88fdd8 100644
--- a/NetRevisionTool/Program.cs
+++ b/NetRevisionTool/Program.cs
@@ -313,6 +313,9 @@ private static void MainWrapper()
/// 0 (trace message), 1 (success), 2 (warning), 3 (error), 4 (raw output).
public static void ShowDebugMessage(string text, int severity = 0)
{
+ if (text == null)
+ return;
+
if (showDebugOutput)
{
var color = Console.ForegroundColor;
@@ -407,7 +410,7 @@ private static RevisionData ProcessDirectory(string path, bool scanRoot, string
ShowDebugMessage("Root directory will be scanned.", 0);
path = rootPath;
}
- data = provider.ProcessDirectory(path);
+ data = provider.ProcessDirectory(path, rootPath);
break;
}
}
diff --git a/NetRevisionTool/Properties/AssemblyInfo.cs b/NetRevisionTool/Properties/AssemblyInfo.cs
index 7016827..47fc291 100644
--- a/NetRevisionTool/Properties/AssemblyInfo.cs
+++ b/NetRevisionTool/Properties/AssemblyInfo.cs
@@ -8,10 +8,10 @@
[assembly: AssemblyCompany("unclassified software development")]
// Assembly identity version. Must be a dotted-numeric version.
-[assembly: AssemblyVersion("2.6.2")]
+[assembly: AssemblyVersion("2.6.3")]
// Repeat for Win32 file version resource because the assembly version is expanded to 4 parts.
-[assembly: AssemblyFileVersion("2.6.2")]
+[assembly: AssemblyFileVersion("2.6.3")]
// Indicate the build configuration
#if DEBUG
diff --git a/NetRevisionTool/RevisionData.cs b/NetRevisionTool/RevisionData.cs
index 2cea16c..228dbf7 100644
--- a/NetRevisionTool/RevisionData.cs
+++ b/NetRevisionTool/RevisionData.cs
@@ -87,6 +87,11 @@ internal class RevisionData
///
public int CommitsAfterTag { get; set; }
+ ///
+ /// The name of the parent containing repository folder, this is usually the same as the name of the hosted repo.
+ ///
+ public string RepoRootFolder { get; set; }
+
#endregion Revision data properties
#region Operations
diff --git a/NetRevisionTool/RevisionFormat.cs b/NetRevisionTool/RevisionFormat.cs
index d9fe7ea..aef52e7 100644
--- a/NetRevisionTool/RevisionFormat.cs
+++ b/NetRevisionTool/RevisionFormat.cs
@@ -81,6 +81,9 @@ public string Resolve(string format)
format = format.Replace("{amail}", RevisionData.AuthorEMail);
format = format.Replace("{mname}", Environment.MachineName);
+ if (RevisionData.RepoRootFolder != String.Empty)
+ format = format.Replace("{repodir}", RevisionData.RepoRootFolder);
+
if (!string.IsNullOrEmpty(RevisionData.Branch))
{
format = format.Replace("{branch}", RevisionData.Branch);
@@ -167,7 +170,12 @@ private string FormatTimeScheme(Match match)
case SchemeType.Readable:
if (data.Utc)
{
- time = time.UtcDateTime;
+ // This code is specific to Arizona - it gets MST then uses that to get MST with daylight saving disabled.
+ // SEE: https://stackoverflow.com/questions/12266948/remove-dst-from-datetime
+ var zone = TimeZoneInfo.FindSystemTimeZoneById("Mountain Standard Time");
+ var newzone = TimeZoneInfo.CreateCustomTimeZone(zone.Id, zone.BaseUtcOffset, zone.DisplayName, zone.StandardName, "", null, true);
+ time = time.UtcDateTime;
+ time = TimeZoneInfo.ConvertTimeFromUtc(time.DateTime, newzone);
}
return time.ToString(data.TimeFormat, CultureInfo.InvariantCulture);
@@ -185,16 +193,16 @@ private string FormatTimeScheme(Match match)
return scheme;
}
- #endregion Format resolving
+ #endregion Format resolving
- #region Scheme parsing
+ #region Scheme parsing
- ///
- /// Parses a version scheme specification.
- ///
- /// The version scheme specification to parse.
- /// The parsed scheme data.
- private static SchemeData ParseScheme(string scheme)
+ ///
+ /// Parses a version scheme specification.
+ ///
+ /// The version scheme specification to parse.
+ /// The parsed scheme data.
+ private static SchemeData ParseScheme(string scheme)
{
SchemeData data = new SchemeData();
diff --git a/NetRevisionTool/VcsProviders/GitProvider.cs b/NetRevisionTool/VcsProviders/GitProvider.cs
index 3ba34cb..e48d3d8 100644
--- a/NetRevisionTool/VcsProviders/GitProvider.cs
+++ b/NetRevisionTool/VcsProviders/GitProvider.cs
@@ -69,12 +69,20 @@ public bool CheckDirectory(string path, out string rootPath)
return false;
}
- public RevisionData ProcessDirectory(string path)
+ public RevisionData ProcessDirectory(string path, string repoRoot)
{
- // Initialise data
- RevisionData data = new RevisionData
- {
- VcsProvider = this
+ string repositoryRoot = "";
+
+ if (String.IsNullOrWhiteSpace(repoRoot) == false)
+ {
+ repositoryRoot = Path.GetFileName(repoRoot);
+ }
+
+ // Initialise data
+ RevisionData data = new RevisionData
+ {
+ VcsProvider = this,
+ RepoRootFolder = repositoryRoot
};
// Queries the commit hash and time from the latest log entry
@@ -140,13 +148,20 @@ public RevisionData ProcessDirectory(string path)
line = null;
while (!p.StandardOutput.EndOfStream)
{
- line = p.StandardOutput.ReadLine();
+ string templine = p.StandardOutput.ReadLine();
+
+ // Do not consider this line if it contans any of the file names that can, conceivably appear in the status due to the tool itself.
+
+ if (!(templine.Contains("AssemblyInfo.cs") || templine.Contains("AssemblyInfo.vb") || templine.Contains("AssemblyInfo.bak")))
+ line = templine;
+
Program.ShowDebugMessage(line, 4);
}
if (!p.WaitForExit(1000))
{
p.Kill();
}
+
data.IsModified = !string.IsNullOrEmpty(line);
// Query the current branch
diff --git a/NetRevisionTool/VcsProviders/IVcsProvider.cs b/NetRevisionTool/VcsProviders/IVcsProvider.cs
index a18168c..34336a9 100644
--- a/NetRevisionTool/VcsProviders/IVcsProvider.cs
+++ b/NetRevisionTool/VcsProviders/IVcsProvider.cs
@@ -34,6 +34,6 @@ internal interface IVcsProvider
///
/// The directory to process.
/// The data about the revision found in the directory.
- RevisionData ProcessDirectory(string path);
+ RevisionData ProcessDirectory(string path, string repoRoot);
}
}
diff --git a/NetRevisionTool/VcsProviders/SubversionProvider.cs b/NetRevisionTool/VcsProviders/SubversionProvider.cs
index 4778481..77d9029 100644
--- a/NetRevisionTool/VcsProviders/SubversionProvider.cs
+++ b/NetRevisionTool/VcsProviders/SubversionProvider.cs
@@ -79,12 +79,13 @@ public bool CheckDirectory(string path, out string rootPath)
return false;
}
- public RevisionData ProcessDirectory(string path)
+ public RevisionData ProcessDirectory(string path, string repoRoot)
{
- // Initialise data
- RevisionData data = new RevisionData
- {
- VcsProvider = this
+ // Initialise data
+ RevisionData data = new RevisionData
+ {
+ VcsProvider = this,
+ RepoRootFolder = "" // Not yet implemneted as it is in GitProvider.
};
// svn assumes case-sensitive path names on Windows, which is... bad.