diff --git a/src/Resources/Locales/en_US.xaml b/src/Resources/Locales/en_US.xaml
index d58c3d29..05eae298 100644
--- a/src/Resources/Locales/en_US.xaml
+++ b/src/Resources/Locales/en_US.xaml
@@ -39,7 +39,8 @@
Error All
Similar to 'error', but shows more
- Archive
+ Archive ...
+ Archive
Revision :
Save Archive To :
Select archive file path
@@ -190,7 +191,6 @@
Cherry-Pick This Commit
Revert Commit
Save as Patch ...
- Archive ...
Copy Commit SHA
Copy Commit Info
diff --git a/src/Resources/Locales/zh_CN.xaml b/src/Resources/Locales/zh_CN.xaml
index 5a133e17..fe7e8b2a 100644
--- a/src/Resources/Locales/zh_CN.xaml
+++ b/src/Resources/Locales/zh_CN.xaml
@@ -39,7 +39,8 @@
更多错误
与【错误】级别相似,但输出内容更多
- 存档
+ 存档 ...
+ 存档
指定的提交:
存档文件路径:
选择存档文件的存放路径
@@ -190,7 +191,6 @@
挑选此提交
回滚此提交
另存为补丁 ...
- 存档 ...
复制提交指纹
复制提交信息
diff --git a/src/Views/Popups/Archive.xaml b/src/Views/Popups/Archive.xaml
index 99e29e2d..4671e33f 100644
--- a/src/Views/Popups/Archive.xaml
+++ b/src/Views/Popups/Archive.xaml
@@ -29,7 +29,7 @@
Grid.Row="0" Grid.Column="1"
Orientation="Horizontal"
VerticalAlignment="Center">
-
+
diff --git a/src/Views/Popups/Archive.xaml.cs b/src/Views/Popups/Archive.xaml.cs
index ff0f2a1a..f027c277 100644
--- a/src/Views/Popups/Archive.xaml.cs
+++ b/src/Views/Popups/Archive.xaml.cs
@@ -1,7 +1,9 @@
using Microsoft.Win32;
+using System.IO;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
+using System.Windows.Media;
namespace SourceGit.Views.Popups {
@@ -12,19 +14,43 @@ namespace SourceGit.Views.Popups {
private string repo;
private string revision;
- public string SaveTo { get; set; } = "archive.zip";
+ public string SaveTo { get; set; }
+
+ public Archive(string repo, Models.Branch branch) {
+ this.repo = repo;
+ this.revision = branch.Head;
+ this.SaveTo = $"archive-{Path.GetFileNameWithoutExtension(branch.Name)}.zip";
+
+ InitializeComponent();
+
+ iconBased.Data = FindResource("Icon.Branch") as Geometry;
+ txtBased.Text = branch.IsLocal ? branch.Name : $"{branch.Remote}/{branch.Name}";
+ }
public Archive(string repo, Models.Commit revision) {
this.repo = repo;
this.revision = revision.SHA;
+ this.SaveTo = $"archive-{revision.ShortSHA}.zip";
InitializeComponent();
+ iconBased.Data = FindResource("Icon.Commit") as Geometry;
txtBased.Text = $"{revision.ShortSHA} {revision.Subject}";
}
+ public Archive(string repo, Models.Tag tag) {
+ this.repo = repo;
+ this.revision = tag.SHA;
+ this.SaveTo = $"archive-{tag.Name}.zip";
+
+ InitializeComponent();
+
+ iconBased.Data = FindResource("Icon.Tag") as Geometry;
+ txtBased.Text = tag.Name;
+ }
+
public override string GetTitle() {
- return App.Text("Archive");
+ return App.Text("Archive.Title");
}
public override Task Start() {
diff --git a/src/Views/Widgets/Dashboard.xaml.cs b/src/Views/Widgets/Dashboard.xaml.cs
index 38c0d2cb..c8648f4a 100644
--- a/src/Views/Widgets/Dashboard.xaml.cs
+++ b/src/Views/Widgets/Dashboard.xaml.cs
@@ -623,9 +623,17 @@ namespace SourceGit.Views.Widgets {
}
menu.Items.Add(tracking);
- menu.Items.Add(new Separator());
}
+ var archive = new MenuItem();
+ archive.Header = App.Text("Archive");
+ archive.Click += (o, e) => {
+ new Popups.Archive(repo.Path, branch).Show();
+ e.Handled = true;
+ };
+ menu.Items.Add(archive);
+ menu.Items.Add(new Separator());
+
var copy = new MenuItem();
copy.Header = App.Text("BranchCM.CopyName");
copy.Click += (o, e) => {
@@ -741,6 +749,13 @@ namespace SourceGit.Views.Widgets {
e.Handled = true;
};
+ var archive = new MenuItem();
+ archive.Header = App.Text("Archive");
+ archive.Click += (o, e) => {
+ new Popups.Archive(repo.Path, branch).Show();
+ e.Handled = true;
+ };
+
var copy = new MenuItem();
copy.Header = App.Text("BranchCM.CopyName");
copy.Click += (o, e) => {
@@ -752,6 +767,8 @@ namespace SourceGit.Views.Widgets {
menu.Items.Add(new Separator());
menu.Items.Add(createBranch);
menu.Items.Add(createTag);
+ menu.Items.Add(new Separator());
+ menu.Items.Add(archive);
menu.Items.Add(new Separator());
menu.Items.Add(copy);
}
@@ -798,6 +815,13 @@ namespace SourceGit.Views.Widgets {
ev.Handled = true;
};
+ var archive = new MenuItem();
+ archive.Header = App.Text("Archive");
+ archive.Click += (o, e) => {
+ new Popups.Archive(repo.Path, tag).Show();
+ e.Handled = true;
+ };
+
var copy = new MenuItem();
copy.Header = App.Text("TagCM.Copy");
copy.Click += (o, ev) => {
@@ -810,6 +834,8 @@ namespace SourceGit.Views.Widgets {
menu.Items.Add(new Separator());
menu.Items.Add(pushTag);
menu.Items.Add(deleteTag);
+ menu.Items.Add(new Separator());
+ menu.Items.Add(archive);
menu.Items.Add(new Separator());
menu.Items.Add(copy);
menu.IsOpen = true;
diff --git a/src/Views/Widgets/Histories.xaml.cs b/src/Views/Widgets/Histories.xaml.cs
index b8cb9bff..73f6a126 100644
--- a/src/Views/Widgets/Histories.xaml.cs
+++ b/src/Views/Widgets/Histories.xaml.cs
@@ -350,7 +350,7 @@ namespace SourceGit.Views.Widgets {
menu.Items.Add(saveToPatch);
var archive = new MenuItem();
- archive.Header = App.Text("CommitCM.Archive");
+ archive.Header = App.Text("Archive");
archive.Click += (o, e) => {
new Popups.Archive(repo.Path, commit).Show();
e.Handled = true;