From ebe229368ce63bf5a2522fb9b6b3dd248daedc9f Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Thu, 26 Nov 2020 05:58:11 +0200 Subject: Machine_Studio_v4.2.4 --- .../Publish/MachineStudioPublisher.cs | 83 +++++++++++++--------- .../Publish/PublishOptions.cs | 7 ++ .../MainWindow.xaml | 3 +- .../Properties/AssemblyInfo.cs | 2 +- .../Tango.MachineStudio.UI.csproj | 5 +- 5 files changed, 62 insertions(+), 38 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio') diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Publish/MachineStudioPublisher.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Publish/MachineStudioPublisher.cs index b8e82cc2b..25c81fcf4 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Publish/MachineStudioPublisher.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Publish/MachineStudioPublisher.cs @@ -165,40 +165,6 @@ namespace Tango.MachineStudio.Common.Publish throw new InvalidOperationException($"The local version '{local_version}' is not greater than the remote version '{remote_version}'."); } - if (Options.CreateTag) - { - String repoPath = Path.GetFullPath("../../../../../"); - using (GitRepositoryManager git = new GitRepositoryManager(repoPath, Options.Email, Options.PersonalAccessToken)) - { - OnPublishProgress(0, 100, "Checking repository changes..."); - 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"); - } - - 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"); - } - - String tagVersion = System.Version.Parse(GetLocalVersion()).ToString(3); - String tagName = $"Machine_Studio_v{tagVersion}"; - String tagDescription = $"Snapshot of Machine Studio v{tagVersion}"; - - git.Progress += (x, e) => - { - OnPublishProgress(e.Progress.Value, e.Progress.Maximum, $"Pushing Tag '{tagName}'..."); - }; - - OnPublishProgress(0, 100, $"Creating Tag '{tagName}'..."); - - git.CreatePushTag(tagName, tagDescription, "Roy Ben Shabat"); - } - } - OnPublishProgress(0, 100, $"Requesting version upload..."); var response = _client.UploadVersion(new UploadVersionRequest() @@ -290,6 +256,55 @@ namespace Tango.MachineStudio.Common.Publish throw new InvalidOperationException("The remote version does not seems to have been updated."); } + if (Options.CreateTag) + { + String repoPath = Path.GetFullPath("../../../../../"); + String tagVersion = System.Version.Parse(GetLocalVersion()).ToString(3); + String tagName = $"Machine_Studio_v{tagVersion}"; + + using (GitRepositoryManager git = new GitRepositoryManager(repoPath, Options.Email, Options.PersonalAccessToken)) + { + OnPublishProgress(0, 100, "Checking repository changes..."); + int changes = git.GetChanges().Count; + if (changes > 0) + { + if (Options.AutoCommitAndPush) + { + OnPublishProgress(0, 100, "Committing repository changes..."); + git.Commit(tagName); + } + 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) + { + 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"); + } + } + + git.Progress += (x, e) => + { + OnPublishProgress(e.Progress.Value, e.Progress.Maximum, $"Pushing Tag '{tagName}'..."); + }; + + OnPublishProgress(0, 100, $"Creating Tag '{tagName}'..."); + + git.CreatePushTag(tagName, Options.Comments, "Roy Ben Shabat"); + } + } + OnPublishProgress(0, 0, "Version published successfully."); } catch (Exception ex) diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Publish/PublishOptions.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Publish/PublishOptions.cs index 80ca01149..c0983eb8b 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Publish/PublishOptions.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Publish/PublishOptions.cs @@ -95,6 +95,13 @@ namespace Tango.MachineStudio.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/MachineStudio/Tango.MachineStudio.Publisher.UI/MainWindow.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/MainWindow.xaml index 39513f1ea..cd23547c2 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/MainWindow.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.UI/MainWindow.xaml @@ -7,7 +7,7 @@ xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" xmlns:web="clr-namespace:Tango.Web;assembly=Tango.Web" mc:Ignorable="d" - Title="Machine Studio Publisher" Height="600" Width="700" WindowStartupLocation="CenterScreen" WindowStyle="ToolWindow" ResizeMode="NoResize" Foreground="#202020" d:DataContext="{d:DesignInstance Type=local:MainWindowVM, IsDesignTimeCreatable=False}"> + Title="Machine Studio Publisher" Height="620" Width="700" WindowStartupLocation="CenterScreen" WindowStyle="ToolWindow" ResizeMode="NoResize" Foreground="#202020" d:DataContext="{d:DesignInstance Type=local:MainWindowVM, IsDesignTimeCreatable=False}"> @@ -82,6 +82,7 @@ Create Tag On Repository + Auto Commit & Push Personal Access Token diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs index 736c2ebca..6f104481b 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs @@ -4,5 +4,5 @@ using System.Runtime.InteropServices; [assembly: System.Windows.ThemeInfo(System.Windows.ResourceDictionaryLocation.None, System.Windows.ResourceDictionaryLocation.SourceAssembly)] [assembly: AssemblyTitle("Tango - Machine Studio")] -[assembly: AssemblyVersion("4.2.3.0")] +[assembly: AssemblyVersion("4.2.4.0")] [assembly: ComVisible(false)] \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj index 3783b54f8..7895a9355 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj @@ -669,7 +669,8 @@ copy /Y "$(SolutionDir)Referenced Assemblies\Microsoft.WITDataStore32.dll" "$(Ta if $(ConfigurationName) == Release del *.xml if $(ConfigurationName) == Release RD /S /Q "$(TargetDir)ProtoCompilers\" -if $(ConfigurationName) == Release RD /S /Q "$(TargetDir)Roslyn\" +if $(ConfigurationName) == Release RD /S /Q "$(TargetDir)Roslyn\" +if $(ConfigurationName) == Release RD /S /Q "$(TargetDir)lib\" @@ -680,7 +681,7 @@ if $(ConfigurationName) == Release RD /S /Q "$(TargetDir)Roslyn\" - + \ No newline at end of file -- cgit v1.3.1