From ab09d7fbef132e95c2182f4c9abece25329d35df Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 25 Nov 2020 01:21:31 +0200 Subject: Pre Tag 'PPC_v1.2.5' commit. --- .../PPC/Tango.PPC.Common/Publish/PPCPublisher.cs | 28 +++++++++++++++++----- .../PPC/Tango.PPC.Common/Publish/PublishOptions.cs | 8 +++++++ .../PPC/Tango.PPC.Publisher.UI/MainWindow.xaml | 3 ++- .../Visual_Studio/PPC/Tango.PPC.UI/app.manifest | 2 +- 4 files changed, 33 insertions(+), 8 deletions(-) (limited to 'Software/Visual_Studio/PPC') diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Publish/PPCPublisher.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Publish/PPCPublisher.cs index c77fb32f0..62c4420d9 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Publish/PPCPublisher.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Publish/PPCPublisher.cs @@ -183,6 +183,10 @@ namespace Tango.PPC.Common.Publish if (Options.CreateTag) { + String tagVersion = System.Version.Parse(GetLocalVersion()).ToString(3); + String tagName = $"PPC_v{tagVersion}"; + String tagDescription = $"Snapshot of PPC v{tagVersion}"; + String repoPath = Path.GetFullPath("../../../../../"); using (GitRepositoryManager git = new GitRepositoryManager(repoPath, Options.Email, Options.PersonalAccessToken)) { @@ -190,20 +194,32 @@ namespace Tango.PPC.Common.Publish int changes = git.GetChanges().Count; if (changes > 0) { - throw new InvalidOperationException($"There are {changes} uncommitted changes on the repository. Please commit and push all changes before creating the Tag"); + if (Options.AutoCommitAndPush) + { + OnPublishProgress(0, 100, "Committing repository changes..."); + git.Commit($"Pre Tag '{tagName}' commit."); + } + else + { + throw new InvalidOperationException($"There are {changes} uncommitted changes on the repository. Please commit and push all changes before creating the Tag"); + } } OnPublishProgress(0, 100, "Checking outgoing commits..."); int commits = git.GetOutgoingCommits().Count; if (commits > 0) { - throw new InvalidOperationException($"There are {commits} outgoing commits on the repository. Please push all commits before creating the Tag"); + if (Options.AutoCommitAndPush) + { + OnPublishProgress(0, 100, "Pushing repository changes..."); + git.Push(); + } + else + { + throw new InvalidOperationException($"There are {commits} outgoing commits on the repository. Please push all commits before creating the Tag"); + } } - String tagVersion = System.Version.Parse(GetLocalVersion()).ToString(3); - String tagName = $"PPC_v{tagVersion}"; - String tagDescription = $"Snapshot of PPC v{tagVersion}"; - git.Progress += (x, e) => { OnPublishProgress(e.Progress.Value, e.Progress.Maximum, $"Pushing Tag '{tagName}'..."); diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Publish/PublishOptions.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Publish/PublishOptions.cs index 8279aef46..399a19f0d 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Publish/PublishOptions.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Publish/PublishOptions.cs @@ -120,6 +120,14 @@ namespace Tango.PPC.Common.Publish set { _createTag = value; RaisePropertyChangedAuto(); } } + private bool _autoCommitAndSync; + public bool AutoCommitAndPush + { + get { return _autoCommitAndSync; } + set { _autoCommitAndSync = value; RaisePropertyChangedAuto(); } + } + + public PublishOptions() { BasePath = AppDomain.CurrentDomain.BaseDirectory + "..\\"; diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Publisher.UI/MainWindow.xaml b/Software/Visual_Studio/PPC/Tango.PPC.Publisher.UI/MainWindow.xaml index 017c34625..e772a4b87 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Publisher.UI/MainWindow.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.Publisher.UI/MainWindow.xaml @@ -10,7 +10,7 @@ xmlns:web="clr-namespace:Tango.Web;assembly=Tango.Web" xmlns:local="clr-namespace:Tango.PPC.Publisher.UI" mc:Ignorable="d" - Title="Tango PPC Publisher" Height="2000" Width="500" d:DataContext="{d:DesignInstance Type=local:MainWindowVM, IsDesignTimeCreatable=False}"> + Title="Tango PPC Publisher" Height="1000" Width="500" d:DataContext="{d:DesignInstance Type=local:MainWindowVM, IsDesignTimeCreatable=False}" WindowStartupLocation="CenterScreen"> @@ -134,6 +134,7 @@ Create Tag On Repository + Auto Commit & Push Personal Access Token diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest index efc5f8179..d72e75011 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest @@ -16,7 +16,7 @@ Remove this element if your application requires this virtualization for backwards compatibility. --> - + -- cgit v1.3.1