diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2020-11-26 05:58:11 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2020-11-26 05:58:11 +0200 |
| commit | ebe229368ce63bf5a2522fb9b6b3dd248daedc9f (patch) | |
| tree | 6865868dcc29790ece43ece44dba15ee4fdc1c24 /Software/Visual_Studio/MachineStudio | |
| parent | b330818812cdfbcbfb9e85380e5cc9e392473d94 (diff) | |
| download | Tango-ebe229368ce63bf5a2522fb9b6b3dd248daedc9f.tar.gz Tango-ebe229368ce63bf5a2522fb9b6b3dd248daedc9f.zip | |
Machine_Studio_v4.2.4
Diffstat (limited to 'Software/Visual_Studio/MachineStudio')
5 files changed, 62 insertions, 38 deletions
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}"> <Window.Resources> <converters:EnumToItemsSourceConverter x:Key="EnumToItemsSourceConverter" /> @@ -82,6 +82,7 @@ <StackPanel Margin="0 20 0 0"> <CheckBox x:Name="chkCreateTag" IsChecked="{Binding Options.CreateTag}">Create Tag On Repository</CheckBox> + <CheckBox Margin="0 5 0 0" IsChecked="{Binding Options.AutoCommitAndPush}">Auto Commit & Push</CheckBox> <TextBlock Margin="0 10 0 0">Personal Access Token</TextBlock> <TextBox BorderThickness="0 0 0 1" IsEnabled="{Binding ElementName=chkCreateTag,Path=IsChecked}" Margin="0 5 0 0" Text="{Binding Options.PersonalAccessToken}"></TextBox> </StackPanel> 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\"</PostBuildEvent> +if $(ConfigurationName) == Release RD /S /Q "$(TargetDir)Roslyn\" +if $(ConfigurationName) == Release RD /S /Q "$(TargetDir)lib\"</PostBuildEvent> </PropertyGroup> <Import Project="..\..\packages\System.Data.SQLite.Core.1.0.108.0\build\net46\System.Data.SQLite.Core.targets" Condition="Exists('..\..\packages\System.Data.SQLite.Core.1.0.108.0\build\net46\System.Data.SQLite.Core.targets')" /> <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> @@ -680,7 +681,7 @@ if $(ConfigurationName) == Release RD /S /Q "$(TargetDir)Roslyn\"</PostBuildEven </Target> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_BuildVersioningStyle="None.None.Increment.DeltaBaseYearDayOfYear" BuildVersion_UpdateFileVersion="True" BuildVersion_DetectChanges="True" BuildVersion_UseGlobalSettings="False" /> + <UserProperties BuildVersion_UseGlobalSettings="False" BuildVersion_DetectChanges="True" BuildVersion_UpdateFileVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.DeltaBaseYearDayOfYear" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_StartDate="2000/1/1" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file |
