From 20c81edffc16a0e694205dc1eb6002fa359b4639 Mon Sep 17 00:00:00 2001 From: NinjaPewPew Date: Tue, 28 Jan 2020 20:17:21 +0100 Subject: [PATCH 01/12] Resolves #45 - Revision head now uses the local time. --- CVS History Viewer/MainWindow.xaml.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CVS History Viewer/MainWindow.xaml.cs b/CVS History Viewer/MainWindow.xaml.cs index 86fe38b..227558c 100644 --- a/CVS History Viewer/MainWindow.xaml.cs +++ b/CVS History Viewer/MainWindow.xaml.cs @@ -486,7 +486,7 @@ private void Commits_SelectionChanged(object sender, SelectionChangedEventArgs e this.uiCommitHASH.Text = oCommit.sHASH + $" [{oCommit.sShortHASH}]"; this.uiCommitAuthor.Text = oCommit.sAuthor; - this.uiCommitDate.Text = oCommit.dDate.ToLongDateString() + " " + oCommit.dDate.ToLongTimeString(); + this.uiCommitDate.Text = oCommit.dLocalDate.ToLongDateString() + " " + oCommit.dLocalDate.ToLongTimeString(); this.uiCommitDescription.Text = oCommit.sDescription; this.uiCommitRevisions.Items.Clear(); From 709e7a1ebbb46ddf3930c92bfc15eea764aba671 Mon Sep 17 00:00:00 2001 From: NinjaPewPew Date: Tue, 28 Jan 2020 20:52:56 +0100 Subject: [PATCH 02/12] Resolves #47 - File name and path are now converted to lower letters before they are compared. --- CVS History Viewer/MainWindow.xaml.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CVS History Viewer/MainWindow.xaml.cs b/CVS History Viewer/MainWindow.xaml.cs index 227558c..e026dd9 100644 --- a/CVS History Viewer/MainWindow.xaml.cs +++ b/CVS History Viewer/MainWindow.xaml.cs @@ -177,7 +177,7 @@ private void UpdateCommits_BackgroundWorker_DoWork(object sender, DoWorkEventArg bool bFound = false; for(int i = cTempFileList.Count - 1; i >= 0; i--) { - if (cTempFileList[i].sName == oFileInfo.Name && cTempFileList[i].sPath == oFileInfo.DirectoryName) + if (cTempFileList[i].sName.ToLower() == oFileInfo.Name.ToLower() && cTempFileList[i].sPath.ToLower() == oFileInfo.DirectoryName.ToLower()) { bFound = true; From 3afbe840d4684aacf0c42ce74da43fb570a6c057 Mon Sep 17 00:00:00 2001 From: NinjaPewPew Date: Tue, 28 Jan 2020 20:53:15 +0100 Subject: [PATCH 03/12] Random stuff --- CVS History Viewer.sln | 4 ++-- CVS History Viewer/MainWindow.xaml.cs | 24 +++++++++++------------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/CVS History Viewer.sln b/CVS History Viewer.sln index 7db84a2..66f8a1c 100644 --- a/CVS History Viewer.sln +++ b/CVS History Viewer.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.28307.168 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29613.14 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CVS History Viewer", "CVS History Viewer\CVS History Viewer.csproj", "{8F95ECA1-9EB2-4D79-B596-5EEBE5F1A1A2}" EndProject diff --git a/CVS History Viewer/MainWindow.xaml.cs b/CVS History Viewer/MainWindow.xaml.cs index e026dd9..1f02bbb 100644 --- a/CVS History Viewer/MainWindow.xaml.cs +++ b/CVS History Viewer/MainWindow.xaml.cs @@ -19,25 +19,24 @@ namespace CVS_History_Viewer /// public partial class MainWindow : Window { - private string sAppDataPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\CVS History Viewer"; - private string sSyntaxPath = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location) + "\\Resources\\Syntax"; + private readonly string sAppDataPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\CVS History Viewer"; + private readonly string sSyntaxPath = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location) + "\\Resources\\Syntax"; - private Database oDatabase; - private Settings oSettings; - private BackgroundStuff oBackgroundStuff; - private SyntaxHighlighting oSyntaxHighlighting; + private readonly Database oDatabase; + private readonly Settings oSettings; + private readonly BackgroundStuff oBackgroundStuff; + private readonly SyntaxHighlighting oSyntaxHighlighting; - private BackgroundWorker oUpdateCommitsWorker; + private readonly BackgroundWorker oUpdateCommitsWorker; + + private readonly Dictionary PreviousRevisionSelection = new Dictionary(); + + private readonly DispatcherTimer oDiffFetchDelay = new DispatcherTimer(); private List cFiles = new List(); private List cTags = new List(); private List cCommitTags = new List(); private List cCommits = new List(); - private List cDummy = new List(); - - private Dictionary PreviousRevisionSelection = new Dictionary(); - - private DispatcherTimer oDiffFetchDelay = new DispatcherTimer(); private bool bIssueOnLoad = true; @@ -612,7 +611,6 @@ private void CommitRevisions_SelectionChanged(object sender, SelectionChangedEve return; } - Revision oRevision = (Revision)((ListBoxItem)this.uiCommitRevisions.SelectedItem).Tag; Commit oCommit = (Commit)this.uiCommits.SelectedItem; if (this.PreviousRevisionSelection.ContainsKey(oCommit.sHASH)) From 77558d0047c291c0d146ddd53a6cb2d1dc1ee7af Mon Sep 17 00:00:00 2001 From: NinjaPewPew Date: Wed, 29 Jan 2020 21:51:15 +0100 Subject: [PATCH 04/12] Resolves #9 - Revision list entries now have a context menu for more interaction options. --- CVS History Viewer/MainWindow.xaml | 9 +++ CVS History Viewer/MainWindow.xaml.cs | 28 +++++++- .../Resources/Classes/CVSCalls.cs | 27 ++++++++ .../Resources/Styles/RedWhite.xaml | 68 +++++++++++++++++++ 4 files changed, 131 insertions(+), 1 deletion(-) diff --git a/CVS History Viewer/MainWindow.xaml b/CVS History Viewer/MainWindow.xaml index 7e14443..c14308a 100644 --- a/CVS History Viewer/MainWindow.xaml +++ b/CVS History Viewer/MainWindow.xaml @@ -6,6 +6,15 @@ xmlns:local="clr-namespace:CVS_History_Viewer" mc:Ignorable="d" Title="CVS History Viewer" Name="MWindow" Height="800" Width="1280" Loaded="Window_Loaded" ContentRendered="Window_ContentRendered" Style="{StaticResource CustomChrome}" WindowStartupLocation="CenterScreen" Icon="Resources/Images/icon.ico"> + + + + + + + + + diff --git a/CVS History Viewer/MainWindow.xaml.cs b/CVS History Viewer/MainWindow.xaml.cs index 1f02bbb..f602b90 100644 --- a/CVS History Viewer/MainWindow.xaml.cs +++ b/CVS History Viewer/MainWindow.xaml.cs @@ -510,7 +510,9 @@ private void Commits_SelectionChanged(object sender, SelectionChangedEventArgs e oItem.Content = $" {oRevision.oFile.sName } {oRevision.sRevision}"; oItem.Tag = oRevision; oItem.ToolTip = oRevision.oFile.sPath + "\\" + oRevision.oFile.sName; - + oItem.ContextMenu = (ContextMenu)FindResource("RevisionContextMenu"); + oItem.ContextMenu.Tag = oRevision; + this.uiCommitRevisions.Items.Add(oItem); } @@ -740,6 +742,30 @@ private void LoadDiffView(Revision oRevision) this.uiDiffLoading.Visibility = Visibility.Collapsed; } + + private void MenuItem_ShowInExplorerClick(object sender, RoutedEventArgs e) + { + CVSFile oFile = ((Revision)((ContextMenu)((MenuItem)sender).Parent).Tag).oFile; + if (System.IO.File.Exists(oFile.sPath + "\\" + oFile.sName)) + { + System.Diagnostics.Process.Start("explorer.exe", $"/select, \"{oFile.sPath}\\{oFile.sName}\""); + } + } + + private void MenuItem_OpenCurrentRevisionClick(object sender, RoutedEventArgs e) + { + CVSFile oFile = ((Revision)((ContextMenu)((MenuItem)sender).Parent).Tag).oFile; + if (System.IO.File.Exists(oFile.sPath + "\\" + oFile.sName)) + { + System.Diagnostics.Process.Start(oFile.sPath + "\\" + oFile.sName); + } + } + + private void MenuItem_OpenSelectedRevisionClick(object sender, RoutedEventArgs e) + { + string newFile = CVSCalls.OutputRevisionToFile((Revision)((ContextMenu)((MenuItem)sender).Parent).Tag); + System.Diagnostics.Process.Start(newFile); + } } class UpdateProgress diff --git a/CVS History Viewer/Resources/Classes/CVSCalls.cs b/CVS History Viewer/Resources/Classes/CVSCalls.cs index d902a84..3416cc2 100644 --- a/CVS History Viewer/Resources/Classes/CVSCalls.cs +++ b/CVS History Viewer/Resources/Classes/CVSCalls.cs @@ -505,5 +505,32 @@ private static DiffBlock AddWhitespace(DiffBlock oDiffBlock, List cWhite return oDiffBlock; } + + /// + /// Outputs the given Revision to a randomly generated temp file and returns the full path to this file. + /// + /// Revision to be outputted + /// Full path to the newly created file + public static string OutputRevisionToFile(Revision oRevision) + { + string randomFile = Path.GetTempFileName(); + string targetExtension = Path.GetExtension(oRevision.oFile.sName); + + File.Move(randomFile, randomFile += targetExtension); + + + if (oRevision.sState != "dead") + { + CVSCalls.RunCommand(oRevision.oFile.sPath, $"cvs co -r {oRevision.sRevision} -p \"{oRevision.oFile.sCVSPath}/{oRevision.oFile.sName}\" >> \"{randomFile}\""); + } + else + { + int iPrevRevision = int.Parse(oRevision.sRevision.Substring(oRevision.sRevision.LastIndexOf('.') + 1)) - 1; + string sPrevRevision = oRevision.sRevision.Substring(0, oRevision.sRevision.LastIndexOf('.') + 1) + iPrevRevision.ToString(); + CVSCalls.RunCommand(oRevision.oFile.sPath, $"cvs co -r {sPrevRevision} -p \"{oRevision.oFile.sCVSPath}/{oRevision.oFile.sName}\" >> \"{randomFile}\""); + } + + return randomFile; + } } } diff --git a/CVS History Viewer/Resources/Styles/RedWhite.xaml b/CVS History Viewer/Resources/Styles/RedWhite.xaml index 1c865ae..6127da5 100644 --- a/CVS History Viewer/Resources/Styles/RedWhite.xaml +++ b/CVS History Viewer/Resources/Styles/RedWhite.xaml @@ -9,6 +9,7 @@ #FFBD627D + #000000 + + + + + + + + \ No newline at end of file From 46b22e7d96cf7823c26c9806b9e831975dcb9d86 Mon Sep 17 00:00:00 2001 From: NinjaPewPew Date: Wed, 29 Jan 2020 22:03:50 +0100 Subject: [PATCH 05/12] Changelog updated --- changelog.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/changelog.md b/changelog.md index 6c5a155..6993c45 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,12 @@ # CVS History Viewer Changelog +# v1.2.0 (Unreleased) +### New Features +* (#9) Revision list entries now have a context menu that allows more ways of interacting with the revision. +### Bugfix +* (#45) Commit time in revision head area now shows local time instead of UTC. +* (#47) Changes in file path/name capitalization now no longer causes the file to be added as a new file. + # v1.1.1 (Released 2019/10/21) ### Bugfix * (#43) Fixed a crash that would appear when the app tries to merge 2 or more diff blocks. From df020047603b40194b4ed21d7f2f1ff3b9bcb644 Mon Sep 17 00:00:00 2001 From: NinjaPewPew Date: Fri, 31 Jan 2020 22:01:38 +0100 Subject: [PATCH 06/12] Resolves #42 - CVS is now called directly. --- .../Resources/Classes/CVSCalls.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/CVS History Viewer/Resources/Classes/CVSCalls.cs b/CVS History Viewer/Resources/Classes/CVSCalls.cs index 3416cc2..fa4b821 100644 --- a/CVS History Viewer/Resources/Classes/CVSCalls.cs +++ b/CVS History Viewer/Resources/Classes/CVSCalls.cs @@ -20,8 +20,8 @@ private static List RunCommand(string sPath, string sCommand) System.Diagnostics.Process oProcess = new System.Diagnostics.Process(); - oProcess.StartInfo.FileName = "cmd.exe"; - oProcess.StartInfo.Arguments = "/C " + sCommand; + oProcess.StartInfo.FileName = "cvs.exe"; + oProcess.StartInfo.Arguments = sCommand; oProcess.StartInfo.UseShellExecute = false; oProcess.StartInfo.RedirectStandardOutput = true; oProcess.StartInfo.WorkingDirectory = sPath; @@ -62,7 +62,7 @@ public static List GetCommits(CVSFile oFile, List cTags) return cCommits; } - List cLines = CVSCalls.RunCommand(oFile.sPath, $"cvs log \"{oFile.sName}\""); + List cLines = CVSCalls.RunCommand(oFile.sPath, $"log \"{oFile.sName}\""); //If output is just 5 line, it probably means the file is not known in cvs (yet) or some other error. if (cLines.Count <= 5) @@ -310,8 +310,8 @@ private static Revision GetDiffPrevious(Revision oRevision, int iWhitespace) int iPrevRevision = int.Parse(oRevision.sRevision.Substring(oRevision.sRevision.LastIndexOf('.') + 1)) - 1; string sPrevRevision = oRevision.sRevision.Substring(0, oRevision.sRevision.LastIndexOf('.') + 1) + iPrevRevision.ToString(); - List cWhitespace = CVSCalls.RunCommand(oRevision.oFile.sPath, $"cvs co -r {oRevision.sRevision} -p \"{oRevision.oFile.sCVSPath}/{oRevision.oFile.sName}\""); - List cLines = CVSCalls.RunCommand(oRevision.oFile.sPath, $"cvs diff -r {oRevision.sRevision} -r {sPrevRevision} \"{oRevision.oFile.sName}\""); + List cWhitespace = CVSCalls.RunCommand(oRevision.oFile.sPath, $"co -r {oRevision.sRevision} -p \"{oRevision.oFile.sCVSPath}/{oRevision.oFile.sName}\""); + List cLines = CVSCalls.RunCommand(oRevision.oFile.sPath, $"diff -r {oRevision.sRevision} -r {sPrevRevision} \"{oRevision.oFile.sName}\""); DiffBlock oDiffBlock = new DiffBlock(); string sBlockKind = ""; @@ -423,13 +423,13 @@ private static Revision GetBaseVersion(Revision oRevision) if (oRevision.sState != "dead") { - cLines = CVSCalls.RunCommand(oRevision.oFile.sPath, $"cvs co -r {oRevision.sRevision} -p \"{oRevision.oFile.sCVSPath}/{oRevision.oFile.sName}\""); + cLines = CVSCalls.RunCommand(oRevision.oFile.sPath, $"co -r {oRevision.sRevision} -p \"{oRevision.oFile.sCVSPath}/{oRevision.oFile.sName}\""); } else { int iPrevRevision = int.Parse(oRevision.sRevision.Substring(oRevision.sRevision.LastIndexOf('.') + 1)) - 1; string sPrevRevision = oRevision.sRevision.Substring(0, oRevision.sRevision.LastIndexOf('.') + 1) + iPrevRevision.ToString(); - cLines = CVSCalls.RunCommand(oRevision.oFile.sPath, $"cvs co -r {sPrevRevision} -p \"{oRevision.oFile.sCVSPath}/{oRevision.oFile.sName}\""); + cLines = CVSCalls.RunCommand(oRevision.oFile.sPath, $"co -r {sPrevRevision} -p \"{oRevision.oFile.sCVSPath}/{oRevision.oFile.sName}\""); } DiffBlock oDiffBlock = new DiffBlock(); @@ -521,13 +521,13 @@ public static string OutputRevisionToFile(Revision oRevision) if (oRevision.sState != "dead") { - CVSCalls.RunCommand(oRevision.oFile.sPath, $"cvs co -r {oRevision.sRevision} -p \"{oRevision.oFile.sCVSPath}/{oRevision.oFile.sName}\" >> \"{randomFile}\""); + CVSCalls.RunCommand(oRevision.oFile.sPath, $"co -r {oRevision.sRevision} -p \"{oRevision.oFile.sCVSPath}/{oRevision.oFile.sName}\" >> \"{randomFile}\""); } else { int iPrevRevision = int.Parse(oRevision.sRevision.Substring(oRevision.sRevision.LastIndexOf('.') + 1)) - 1; string sPrevRevision = oRevision.sRevision.Substring(0, oRevision.sRevision.LastIndexOf('.') + 1) + iPrevRevision.ToString(); - CVSCalls.RunCommand(oRevision.oFile.sPath, $"cvs co -r {sPrevRevision} -p \"{oRevision.oFile.sCVSPath}/{oRevision.oFile.sName}\" >> \"{randomFile}\""); + CVSCalls.RunCommand(oRevision.oFile.sPath, $"co -r {sPrevRevision} -p \"{oRevision.oFile.sCVSPath}/{oRevision.oFile.sName}\" >> \"{randomFile}\""); } return randomFile; From 2f00427ce58c291a26132470f14de92358cb908a Mon Sep 17 00:00:00 2001 From: NinjaPewPew Date: Fri, 31 Jan 2020 22:05:04 +0100 Subject: [PATCH 07/12] Changelog updated --- changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.md b/changelog.md index 6993c45..50fa1b1 100644 --- a/changelog.md +++ b/changelog.md @@ -4,6 +4,7 @@ ### New Features * (#9) Revision list entries now have a context menu that allows more ways of interacting with the revision. ### Bugfix +* (#42) Fixed issue that prevented correct scans when using a directory referenced by UNC-paths. * (#45) Commit time in revision head area now shows local time instead of UTC. * (#47) Changes in file path/name capitalization now no longer causes the file to be added as a new file. From dbffdca0f6464b75875403077260d34da2ef2cef Mon Sep 17 00:00:00 2001 From: NinjaPewPew Date: Mon, 4 May 2020 21:19:44 +0200 Subject: [PATCH 08/12] Resolves #48 - Settings UI --- CVS History Viewer/CVS History Viewer.csproj | 7 +++ CVS History Viewer/MainWindow.xaml | 1 + CVS History Viewer/MainWindow.xaml.cs | 7 ++- .../Resources/Classes/Settings.cs | 24 ++++++--- .../Resources/Styles/RedWhite.xaml | 40 +++++++++++++++ .../Resources/Windows/SettingsUI.xaml | 38 ++++++++++++++ .../Resources/Windows/SettingsUI.xaml.cs | 49 +++++++++++++++++++ changelog.md | 1 + 8 files changed, 160 insertions(+), 7 deletions(-) create mode 100644 CVS History Viewer/Resources/Windows/SettingsUI.xaml create mode 100644 CVS History Viewer/Resources/Windows/SettingsUI.xaml.cs diff --git a/CVS History Viewer/CVS History Viewer.csproj b/CVS History Viewer/CVS History Viewer.csproj index dc07a7e..66b59da 100644 --- a/CVS History Viewer/CVS History Viewer.csproj +++ b/CVS History Viewer/CVS History Viewer.csproj @@ -92,6 +92,9 @@ CrashReport.xaml + + SettingsUI.xaml + MSBuild:Compile Designer @@ -112,6 +115,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + diff --git a/CVS History Viewer/MainWindow.xaml b/CVS History Viewer/MainWindow.xaml index c14308a..de14e47 100644 --- a/CVS History Viewer/MainWindow.xaml +++ b/CVS History Viewer/MainWindow.xaml @@ -30,6 +30,7 @@