mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-06-26 21:04:59 +00:00
Merge branch 'sourcegit-scm:develop' into develop
This commit is contained in:
commit
ec09bff89a
16 changed files with 64 additions and 30 deletions
|
@ -110,6 +110,10 @@ This app supports open repository in external tools listed in the table below.
|
|||
| Color.BadgeFG | Badge foreground color |
|
||||
| Color.Conflict | Conflict panel background color |
|
||||
| Color.ConflictForeground | Conflict panel foreground color |
|
||||
| Color.DecoratorIconBG | Background color for commit ref icon |
|
||||
| Color.DecoratorIcon | Foreground color for commit ref icon |
|
||||
| Color.DecoratorBranch | Background color for commit branch ref name |
|
||||
| Color.DecoratorTag | Background color for commit tag ref name |
|
||||
| Color.Border0 | Border color used in some controls, like Window, Tab, Toolbar, etc. |
|
||||
| Color.Border1 | Border color used in inputs, like TextBox, ComboBox, etc. |
|
||||
| Color.Border2 | Border color used in visual lines, like seperators, Rectange, etc. |
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace SourceGit.Commands
|
|||
{
|
||||
public class Fetch : Command
|
||||
{
|
||||
public Fetch(string repo, string remote, bool prune, Action<string> outputHandler)
|
||||
public Fetch(string repo, string remote, bool prune, bool noTags, Action<string> outputHandler)
|
||||
{
|
||||
_outputHandler = outputHandler;
|
||||
WorkingDirectory = repo;
|
||||
|
@ -24,9 +24,15 @@ namespace SourceGit.Commands
|
|||
Args = "-c credential.helper=manager ";
|
||||
}
|
||||
|
||||
Args += "fetch --force --progress --verbose ";
|
||||
Args += "fetch --progress --verbose ";
|
||||
if (prune)
|
||||
Args += "--prune ";
|
||||
|
||||
if (noTags)
|
||||
Args += "--no-tags ";
|
||||
else
|
||||
Args += "--force ";
|
||||
|
||||
Args += remote;
|
||||
|
||||
AutoFetch.MarkFetched(repo);
|
||||
|
@ -132,7 +138,7 @@ namespace SourceGit.Commands
|
|||
{
|
||||
var job = new Job
|
||||
{
|
||||
Cmd = new Fetch(repo, "--all", true, null) { RaiseError = false },
|
||||
Cmd = new Fetch(repo, "--all", true, false, null) { RaiseError = false },
|
||||
NextRunTimepoint = DateTime.Now.AddMinutes(Convert.ToDouble(Interval)),
|
||||
};
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ namespace SourceGit.Commands
|
|||
{
|
||||
public class Pull : Command
|
||||
{
|
||||
public Pull(string repo, string remote, string branch, bool useRebase, Action<string> outputHandler)
|
||||
public Pull(string repo, string remote, string branch, bool useRebase, bool noTags, Action<string> outputHandler)
|
||||
{
|
||||
_outputHandler = outputHandler;
|
||||
WorkingDirectory = repo;
|
||||
|
@ -24,6 +24,9 @@ namespace SourceGit.Commands
|
|||
Args += "pull --verbose --progress --tags ";
|
||||
if (useRebase)
|
||||
Args += "--rebase ";
|
||||
if (noTags)
|
||||
Args += "--no-tags ";
|
||||
|
||||
Args += $"{remote} {branch}";
|
||||
}
|
||||
|
||||
|
|
|
@ -11,8 +11,8 @@ namespace SourceGit.Converters
|
|||
new FuncValueConverter<Models.DecoratorType, IBrush>(v =>
|
||||
{
|
||||
if (v == Models.DecoratorType.Tag)
|
||||
return Models.DecoratorResources.Backgrounds[0];
|
||||
return Models.DecoratorResources.Backgrounds[1];
|
||||
return Application.Current.FindResource("Brush.DecoratorTag") as IBrush;
|
||||
return Application.Current.FindResource("Brush.DecoratorBranch") as IBrush;
|
||||
});
|
||||
|
||||
public static readonly FuncValueConverter<Models.DecoratorType, StreamGeometry> ToIcon =
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
using Avalonia.Media;
|
||||
|
||||
namespace SourceGit.Models
|
||||
namespace SourceGit.Models
|
||||
{
|
||||
public enum DecoratorType
|
||||
{
|
||||
|
@ -17,12 +15,4 @@ namespace SourceGit.Models
|
|||
public DecoratorType Type { get; set; } = DecoratorType.None;
|
||||
public string Name { get; set; } = "";
|
||||
}
|
||||
|
||||
public static class DecoratorResources
|
||||
{
|
||||
public static readonly IBrush[] Backgrounds = [
|
||||
new SolidColorBrush(0xFF02C302),
|
||||
new SolidColorBrush(0xFFFFB835),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -200,6 +200,7 @@
|
|||
<x:String x:Key="Text.FastForwardWithoutCheck" xml:space="preserve">Fast-Forward (without checkout)</x:String>
|
||||
<x:String x:Key="Text.Fetch" xml:space="preserve">Fetch</x:String>
|
||||
<x:String x:Key="Text.Fetch.AllRemotes" xml:space="preserve">Fetch all remotes</x:String>
|
||||
<x:String x:Key="Text.Fetch.NoTags" xml:space="preserve">Fetch without tags</x:String>
|
||||
<x:String x:Key="Text.Fetch.Prune" xml:space="preserve">Prune remote dead branches</x:String>
|
||||
<x:String x:Key="Text.Fetch.Remote" xml:space="preserve">Remote:</x:String>
|
||||
<x:String x:Key="Text.Fetch.Title" xml:space="preserve">Fetch Remote Changes</x:String>
|
||||
|
@ -386,6 +387,7 @@
|
|||
<x:String x:Key="Text.Pull.LocalChanges.Discard" xml:space="preserve">Discard</x:String>
|
||||
<x:String x:Key="Text.Pull.LocalChanges.DoNothing" xml:space="preserve">Do Nothing</x:String>
|
||||
<x:String x:Key="Text.Pull.LocalChanges.StashAndReply" xml:space="preserve">Stash & Reapply</x:String>
|
||||
<x:String x:Key="Text.Pull.NoTags" xml:space="preserve">Fetch without tags</x:String>
|
||||
<x:String x:Key="Text.Pull.Remote" xml:space="preserve">Remote:</x:String>
|
||||
<x:String x:Key="Text.Pull.Title" xml:space="preserve">Pull (Fetch & Merge)</x:String>
|
||||
<x:String x:Key="Text.Pull.UseRebase" xml:space="preserve">Use rebase instead of merge</x:String>
|
||||
|
|
|
@ -203,6 +203,7 @@
|
|||
<x:String x:Key="Text.FastForwardWithoutCheck" xml:space="preserve">快进(fast-forward,无需checkout)</x:String>
|
||||
<x:String x:Key="Text.Fetch" xml:space="preserve">拉取(fetch)</x:String>
|
||||
<x:String x:Key="Text.Fetch.AllRemotes" xml:space="preserve">拉取所有的远程仓库</x:String>
|
||||
<x:String x:Key="Text.Fetch.NoTags" xml:space="preserve">不拉取远程标签</x:String>
|
||||
<x:String x:Key="Text.Fetch.Prune" xml:space="preserve">自动清理远程已删除分支</x:String>
|
||||
<x:String x:Key="Text.Fetch.Remote" xml:space="preserve">远程仓库 :</x:String>
|
||||
<x:String x:Key="Text.Fetch.Title" xml:space="preserve">拉取远程仓库内容</x:String>
|
||||
|
@ -389,6 +390,7 @@
|
|||
<x:String x:Key="Text.Pull.LocalChanges.Discard" xml:space="preserve">丢弃更改</x:String>
|
||||
<x:String x:Key="Text.Pull.LocalChanges.DoNothing" xml:space="preserve">不做处理</x:String>
|
||||
<x:String x:Key="Text.Pull.LocalChanges.StashAndReply" xml:space="preserve">贮藏并自动恢复</x:String>
|
||||
<x:String x:Key="Text.Pull.NoTags" xml:space="preserve">不拉取远程标签</x:String>
|
||||
<x:String x:Key="Text.Pull.Remote" xml:space="preserve">远程 :</x:String>
|
||||
<x:String x:Key="Text.Pull.Title" xml:space="preserve">拉回(拉取并合并)</x:String>
|
||||
<x:String x:Key="Text.Pull.UseRebase" xml:space="preserve">使用变基方式合并分支</x:String>
|
||||
|
|
|
@ -203,6 +203,7 @@
|
|||
<x:String x:Key="Text.FastForwardWithoutCheck" xml:space="preserve">快進(fast-forward,無需checkout)</x:String>
|
||||
<x:String x:Key="Text.Fetch" xml:space="preserve">拉取(fetch)</x:String>
|
||||
<x:String x:Key="Text.Fetch.AllRemotes" xml:space="preserve">拉取所有的遠端倉庫</x:String>
|
||||
<x:String x:Key="Text.Fetch.NoTags" xml:space="preserve">不拉取遠端標籤</x:String>
|
||||
<x:String x:Key="Text.Fetch.Prune" xml:space="preserve">自動清理遠端已刪除分支</x:String>
|
||||
<x:String x:Key="Text.Fetch.Remote" xml:space="preserve">遠端倉庫 :</x:String>
|
||||
<x:String x:Key="Text.Fetch.Title" xml:space="preserve">拉取遠端倉庫內容</x:String>
|
||||
|
@ -389,6 +390,7 @@
|
|||
<x:String x:Key="Text.Pull.LocalChanges.Discard" xml:space="preserve">丟棄更改</x:String>
|
||||
<x:String x:Key="Text.Pull.LocalChanges.DoNothing" xml:space="preserve">不做處理</x:String>
|
||||
<x:String x:Key="Text.Pull.LocalChanges.StashAndReply" xml:space="preserve">儲藏並自動恢復</x:String>
|
||||
<x:String x:Key="Text.Pull.NoTags" xml:space="preserve">不拉取遠端標籤</x:String>
|
||||
<x:String x:Key="Text.Pull.Remote" xml:space="preserve">遠端 :</x:String>
|
||||
<x:String x:Key="Text.Pull.Title" xml:space="preserve">拉回(拉取併合並)</x:String>
|
||||
<x:String x:Key="Text.Pull.UseRebase" xml:space="preserve">使用變基方式合併分支</x:String>
|
||||
|
|
|
@ -13,8 +13,10 @@
|
|||
<Color x:Key="Color.Contents">#FFFAFAFA</Color>
|
||||
<Color x:Key="Color.Badge">#FFB0CEE8</Color>
|
||||
<Color x:Key="Color.BadgeFG">#FF1F1F1F</Color>
|
||||
<Color x:Key="Color.Decorator">#FF6F6F6F</Color>
|
||||
<Color x:Key="Color.DecoratorIconBG">#FF6F6F6F</Color>
|
||||
<Color x:Key="Color.DecoratorIcon">#FFF8F8F8</Color>
|
||||
<Color x:Key="Color.DecoratorBranch">#FFFFB835</Color>
|
||||
<Color x:Key="Color.DecoratorTag">#FF02C302</Color>
|
||||
<Color x:Key="Color.Conflict">#FF836C2E</Color>
|
||||
<Color x:Key="Color.ConflictForeground">#FFFFFFFF</Color>
|
||||
<Color x:Key="Color.Border0">#FFCFCFCF</Color>
|
||||
|
@ -43,8 +45,10 @@
|
|||
<Color x:Key="Color.Contents">#FF1B1B1B</Color>
|
||||
<Color x:Key="Color.Badge">#FF8F8F8F</Color>
|
||||
<Color x:Key="Color.BadgeFG">#FFDDDDDD</Color>
|
||||
<Color x:Key="Color.Decorator">#FF505050</Color>
|
||||
<Color x:Key="Color.DecoratorIconBG">#FF505050</Color>
|
||||
<Color x:Key="Color.DecoratorIcon">#FFF8F8F8</Color>
|
||||
<Color x:Key="Color.DecoratorBranch">#FFFFB835</Color>
|
||||
<Color x:Key="Color.DecoratorTag">#FF02C302</Color>
|
||||
<Color x:Key="Color.Conflict">#FFFAFAD2</Color>
|
||||
<Color x:Key="Color.ConflictForeground">#FF252525</Color>
|
||||
<Color x:Key="Color.Border0">#FF181818</Color>
|
||||
|
@ -73,8 +77,10 @@
|
|||
<SolidColorBrush x:Key="Brush.Contents" Color="{DynamicResource Color.Contents}"/>
|
||||
<SolidColorBrush x:Key="Brush.Badge" Color="{DynamicResource Color.Badge}"/>
|
||||
<SolidColorBrush x:Key="Brush.BadgeFG" Color="{DynamicResource Color.BadgeFG}"/>
|
||||
<SolidColorBrush x:Key="Brush.Decorator" Color="{DynamicResource Color.Decorator}"/>
|
||||
<SolidColorBrush x:Key="Brush.DecoratorIconBG" Color="{DynamicResource Color.DecoratorIconBG}"/>
|
||||
<SolidColorBrush x:Key="Brush.DecoratorIcon" Color="{DynamicResource Color.DecoratorIcon}"/>
|
||||
<SolidColorBrush x:Key="Brush.DecoratorBranch" Color="{DynamicResource Color.DecoratorBranch}"/>
|
||||
<SolidColorBrush x:Key="Brush.DecoratorTag" Color="{DynamicResource Color.DecoratorTag}"/>
|
||||
<SolidColorBrush x:Key="Brush.Conflict" Color="{DynamicResource Color.Conflict}"/>
|
||||
<SolidColorBrush x:Key="Brush.ConflictForeground" Color="{DynamicResource Color.ConflictForeground}"/>
|
||||
<SolidColorBrush x:Key="Brush.Border0" Color="{DynamicResource Color.Border0}"/>
|
||||
|
|
|
@ -100,7 +100,7 @@ namespace SourceGit.ViewModels
|
|||
{
|
||||
SetProgressDescription("Fetching from added remote ...");
|
||||
new Commands.Config(_repo.FullPath).Set($"remote.{_name}.sshkey", _useSSH ? SSHKey : null);
|
||||
new Commands.Fetch(_repo.FullPath, _name, true, SetProgressDescription).Exec();
|
||||
new Commands.Fetch(_repo.FullPath, _name, true, false, SetProgressDescription).Exec();
|
||||
}
|
||||
CallUIThread(() =>
|
||||
{
|
||||
|
|
|
@ -26,14 +26,19 @@ namespace SourceGit.ViewModels
|
|||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
} = true;
|
||||
|
||||
public bool NoTags
|
||||
{
|
||||
get;
|
||||
set;
|
||||
} = false;
|
||||
|
||||
public Fetch(Repository repo, Models.Remote preferedRemote = null)
|
||||
{
|
||||
_repo = repo;
|
||||
_fetchAllRemotes = preferedRemote == null;
|
||||
SelectedRemote = preferedRemote != null ? preferedRemote : _repo.Remotes[0];
|
||||
Prune = true;
|
||||
View = new Views.Fetch() { DataContext = this };
|
||||
}
|
||||
|
||||
|
@ -47,13 +52,13 @@ namespace SourceGit.ViewModels
|
|||
foreach (var remote in _repo.Remotes)
|
||||
{
|
||||
SetProgressDescription($"Fetching remote: {remote.Name}");
|
||||
new Commands.Fetch(_repo.FullPath, remote.Name, Prune, SetProgressDescription).Exec();
|
||||
new Commands.Fetch(_repo.FullPath, remote.Name, Prune, NoTags, SetProgressDescription).Exec();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SetProgressDescription($"Fetching remote: {SelectedRemote.Name}");
|
||||
new Commands.Fetch(_repo.FullPath, SelectedRemote.Name, Prune, SetProgressDescription).Exec();
|
||||
new Commands.Fetch(_repo.FullPath, SelectedRemote.Name, Prune, NoTags, SetProgressDescription).Exec();
|
||||
}
|
||||
|
||||
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
||||
|
|
|
@ -59,6 +59,12 @@ namespace SourceGit.ViewModels
|
|||
set => _repo.Settings.PreferRebaseInsteadOfMerge = value;
|
||||
}
|
||||
|
||||
public bool NoTags
|
||||
{
|
||||
get;
|
||||
set;
|
||||
} = false;
|
||||
|
||||
public Pull(Repository repo, Models.Branch specifiedRemoteBranch)
|
||||
{
|
||||
_repo = repo;
|
||||
|
@ -145,7 +151,7 @@ namespace SourceGit.ViewModels
|
|||
}
|
||||
|
||||
SetProgressDescription($"Pull {_selectedRemote.Name}/{_selectedBranch.Name}...");
|
||||
var rs = new Commands.Pull(_repo.FullPath, _selectedRemote.Name, _selectedBranch.Name, UseRebase, SetProgressDescription).Exec();
|
||||
var rs = new Commands.Pull(_repo.FullPath, _selectedRemote.Name, _selectedBranch.Name, UseRebase, NoTags, SetProgressDescription).Exec();
|
||||
if (rs && needPopStash)
|
||||
{
|
||||
SetProgressDescription("Re-apply local changes...");
|
||||
|
|
|
@ -90,7 +90,7 @@
|
|||
<DataTemplate DataType="{x:Type m:Decorator}">
|
||||
<Border Height="16" Margin="0,0,6,0" CornerRadius="2" ClipToBounds="True">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Border Background="{DynamicResource Brush.Decorator}" Width="16">
|
||||
<Border Background="{DynamicResource Brush.DecoratorIconBG}" Width="16">
|
||||
<Path Width="8" Height="8" Data="{Binding Type, Converter={x:Static c:DecoratorTypeConverters.ToIcon}}" Fill="{DynamicResource Brush.DecoratorIcon}"/>
|
||||
</Border>
|
||||
<Border Background="{Binding Type, Converter={x:Static c:DecoratorTypeConverters.ToBackground}}">
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<TextBlock FontSize="18"
|
||||
Classes="bold"
|
||||
Text="{DynamicResource Text.Fetch.Title}"/>
|
||||
<Grid Margin="0,16,0,0" RowDefinitions="32,32,32" ColumnDefinitions="120,*">
|
||||
<Grid Margin="0,16,0,0" RowDefinitions="32,32,32,32" ColumnDefinitions="120,*">
|
||||
<TextBlock Grid.Column="0"
|
||||
HorizontalAlignment="Right" VerticalAlignment="Center"
|
||||
Margin="0,0,8,0"
|
||||
|
@ -38,6 +38,10 @@
|
|||
IsChecked="{Binding FetchAllRemotes, Mode=TwoWay}"/>
|
||||
|
||||
<CheckBox Grid.Row="2" Grid.Column="1"
|
||||
Content="{DynamicResource Text.Fetch.NoTags}"
|
||||
IsChecked="{Binding NoTags, Mode=TwoWay}"/>
|
||||
|
||||
<CheckBox Grid.Row="3" Grid.Column="1"
|
||||
Content="{DynamicResource Text.Fetch.Prune}"
|
||||
IsChecked="{Binding Prune, Mode=TwoWay}"/>
|
||||
</Grid>
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
<DataTemplate DataType="{x:Type m:Decorator}">
|
||||
<Border Height="16" Margin="0,0,4,0" CornerRadius="2" ClipToBounds="True">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Border Background="{DynamicResource Brush.Decorator}" Width="16">
|
||||
<Border Background="{DynamicResource Brush.DecoratorIconBG}" Width="16">
|
||||
<Path Width="8" Height="8"
|
||||
Stretch="Uniform"
|
||||
Data="{Binding Type, Converter={x:Static c:DecoratorTypeConverters.ToIcon}}"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<TextBlock FontSize="18"
|
||||
Classes="bold"
|
||||
Text="{DynamicResource Text.Pull.Title}"/>
|
||||
<Grid Margin="0,16,0,0" RowDefinitions="32,32,32,32,32" ColumnDefinitions="140,*">
|
||||
<Grid Margin="0,16,0,0" RowDefinitions="32,32,32,32,32,32" ColumnDefinitions="140,*">
|
||||
<TextBlock Grid.Column="0"
|
||||
HorizontalAlignment="Right" VerticalAlignment="Center"
|
||||
Margin="0,0,8,0"
|
||||
|
@ -86,6 +86,10 @@
|
|||
</StackPanel>
|
||||
|
||||
<CheckBox Grid.Row="4" Grid.Column="1"
|
||||
Content="{DynamicResource Text.Pull.NoTags}"
|
||||
IsChecked="{Binding NoTags, Mode=TwoWay}"/>
|
||||
|
||||
<CheckBox Grid.Row="5" Grid.Column="1"
|
||||
Content="{DynamicResource Text.Pull.UseRebase}"
|
||||
IsChecked="{Binding UseRebase, Mode=TwoWay}"/>
|
||||
</Grid>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue