mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-25 21:07:20 -08:00
Compare commits
10 commits
807cec8a30
...
6e69c0567a
Author | SHA1 | Date | |
---|---|---|---|
|
6e69c0567a | ||
|
7d857a49f7 | ||
|
938876e924 | ||
|
e65ac18afc | ||
|
f028513d49 | ||
|
4cb9dbfd14 | ||
|
4aad6a7f86 | ||
|
db8ee3410b | ||
|
dfc03d7a8f | ||
|
400aaacf18 |
10 changed files with 129 additions and 93 deletions
|
@ -206,6 +206,9 @@ dotnet_diagnostic.CA1854.severity = warning
|
|||
#CA2211:Non-constant fields should not be visible
|
||||
dotnet_diagnostic.CA2211.severity = error
|
||||
|
||||
# IDE0005: remove used namespace using
|
||||
dotnet_diagnostic.IDE0005.severity = error
|
||||
|
||||
# Wrapping preferences
|
||||
csharp_wrap_before_ternary_opsigns = false
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
## How to build this project manually
|
||||
|
||||
1. Make sure [.NET SDK 8](https://dotnet.microsoft.com/en-us/download) is installed on your machine.
|
||||
1. Make sure [.NET SDK 9](https://dotnet.microsoft.com/en-us/download) is installed on your machine.
|
||||
2. Clone this project
|
||||
3. Run the follow command under the project root dir
|
||||
```sh
|
||||
|
|
|
@ -164,12 +164,7 @@ namespace SourceGit
|
|||
var resDic = new ResourceDictionary();
|
||||
var overrides = JsonSerializer.Deserialize(File.ReadAllText(themeOverridesFile), JsonCodeGen.Default.ThemeOverrides);
|
||||
foreach (var kv in overrides.BasicColors)
|
||||
{
|
||||
if (kv.Key.Equals("SystemAccentColor", StringComparison.Ordinal))
|
||||
resDic["SystemAccentColor"] = kv.Value;
|
||||
else
|
||||
resDic[$"Color.{kv.Key}"] = kv.Value;
|
||||
}
|
||||
resDic[$"Color.{kv.Key}"] = kv.Value;
|
||||
|
||||
if (overrides.GraphColors.Count > 0)
|
||||
Models.CommitGraph.SetPens(overrides.GraphColors, overrides.GraphPenThickness);
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace SourceGit.Commands
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SourceGit.ViewModels
|
||||
|
|
|
@ -813,6 +813,8 @@ namespace SourceGit.ViewModels
|
|||
submenu.Icon = App.CreateMenuIcon("Icons.Branch");
|
||||
submenu.Header = current.Name;
|
||||
|
||||
FillBranchVisibilityMenu(submenu, current);
|
||||
|
||||
if (!string.IsNullOrEmpty(current.Upstream))
|
||||
{
|
||||
var upstream = current.Upstream.Substring(13);
|
||||
|
@ -852,6 +854,17 @@ namespace SourceGit.ViewModels
|
|||
e.Handled = true;
|
||||
};
|
||||
submenu.Items.Add(push);
|
||||
|
||||
var rename = new MenuItem();
|
||||
rename.Header = new Views.NameHighlightedTextBlock("BranchCM.Rename", current.Name);
|
||||
rename.Icon = App.CreateMenuIcon("Icons.Rename");
|
||||
rename.Click += (_, e) =>
|
||||
{
|
||||
if (PopupHost.CanCreatePopup())
|
||||
PopupHost.ShowPopup(new RenameBranch(_repo, current));
|
||||
e.Handled = true;
|
||||
};
|
||||
submenu.Items.Add(rename);
|
||||
submenu.Items.Add(new MenuItem() { Header = "-" });
|
||||
|
||||
var detect = Commands.GitFlow.DetectType(_repo.FullPath, _repo.Branches, current.Name);
|
||||
|
@ -870,18 +883,15 @@ namespace SourceGit.ViewModels
|
|||
submenu.Items.Add(new MenuItem() { Header = "-" });
|
||||
}
|
||||
|
||||
FillBranchVisibilityMenu(submenu, current);
|
||||
|
||||
var rename = new MenuItem();
|
||||
rename.Header = new Views.NameHighlightedTextBlock("BranchCM.Rename", current.Name);
|
||||
rename.Icon = App.CreateMenuIcon("Icons.Rename");
|
||||
rename.Click += (_, e) =>
|
||||
var copy = new MenuItem();
|
||||
copy.Header = App.Text("BranchCM.CopyName");
|
||||
copy.Icon = App.CreateMenuIcon("Icons.Copy");
|
||||
copy.Click += (_, e) =>
|
||||
{
|
||||
if (PopupHost.CanCreatePopup())
|
||||
PopupHost.ShowPopup(new RenameBranch(_repo, current));
|
||||
App.CopyText(current.Name);
|
||||
e.Handled = true;
|
||||
};
|
||||
submenu.Items.Add(rename);
|
||||
submenu.Items.Add(copy);
|
||||
|
||||
menu.Items.Add(submenu);
|
||||
}
|
||||
|
@ -892,6 +902,8 @@ namespace SourceGit.ViewModels
|
|||
submenu.Icon = App.CreateMenuIcon("Icons.Branch");
|
||||
submenu.Header = branch.Name;
|
||||
|
||||
FillBranchVisibilityMenu(submenu, branch);
|
||||
|
||||
var checkout = new MenuItem();
|
||||
checkout.Header = new Views.NameHighlightedTextBlock("BranchCM.Checkout", branch.Name);
|
||||
checkout.Icon = App.CreateMenuIcon("Icons.Check");
|
||||
|
@ -913,25 +925,6 @@ namespace SourceGit.ViewModels
|
|||
e.Handled = true;
|
||||
};
|
||||
submenu.Items.Add(merge);
|
||||
submenu.Items.Add(new MenuItem() { Header = "-" });
|
||||
|
||||
var detect = Commands.GitFlow.DetectType(_repo.FullPath, _repo.Branches, branch.Name);
|
||||
if (detect.IsGitFlowBranch)
|
||||
{
|
||||
var finish = new MenuItem();
|
||||
finish.Header = new Views.NameHighlightedTextBlock("BranchCM.Finish", branch.Name);
|
||||
finish.Icon = App.CreateMenuIcon("Icons.GitFlow");
|
||||
finish.Click += (_, e) =>
|
||||
{
|
||||
if (PopupHost.CanCreatePopup())
|
||||
PopupHost.ShowPopup(new GitFlowFinish(_repo, branch, detect.Type, detect.Prefix));
|
||||
e.Handled = true;
|
||||
};
|
||||
submenu.Items.Add(finish);
|
||||
submenu.Items.Add(new MenuItem() { Header = "-" });
|
||||
}
|
||||
|
||||
FillBranchVisibilityMenu(submenu, branch);
|
||||
|
||||
var rename = new MenuItem();
|
||||
rename.Header = new Views.NameHighlightedTextBlock("BranchCM.Rename", branch.Name);
|
||||
|
@ -954,6 +947,33 @@ namespace SourceGit.ViewModels
|
|||
e.Handled = true;
|
||||
};
|
||||
submenu.Items.Add(delete);
|
||||
submenu.Items.Add(new MenuItem() { Header = "-" });
|
||||
|
||||
var detect = Commands.GitFlow.DetectType(_repo.FullPath, _repo.Branches, branch.Name);
|
||||
if (detect.IsGitFlowBranch)
|
||||
{
|
||||
var finish = new MenuItem();
|
||||
finish.Header = new Views.NameHighlightedTextBlock("BranchCM.Finish", branch.Name);
|
||||
finish.Icon = App.CreateMenuIcon("Icons.GitFlow");
|
||||
finish.Click += (_, e) =>
|
||||
{
|
||||
if (PopupHost.CanCreatePopup())
|
||||
PopupHost.ShowPopup(new GitFlowFinish(_repo, branch, detect.Type, detect.Prefix));
|
||||
e.Handled = true;
|
||||
};
|
||||
submenu.Items.Add(finish);
|
||||
submenu.Items.Add(new MenuItem() { Header = "-" });
|
||||
}
|
||||
|
||||
var copy = new MenuItem();
|
||||
copy.Header = App.Text("BranchCM.CopyName");
|
||||
copy.Icon = App.CreateMenuIcon("Icons.Copy");
|
||||
copy.Click += (_, e) =>
|
||||
{
|
||||
App.CopyText(branch.Name);
|
||||
e.Handled = true;
|
||||
};
|
||||
submenu.Items.Add(copy);
|
||||
|
||||
menu.Items.Add(submenu);
|
||||
}
|
||||
|
@ -966,6 +986,8 @@ namespace SourceGit.ViewModels
|
|||
submenu.Icon = App.CreateMenuIcon("Icons.Branch");
|
||||
submenu.Header = name;
|
||||
|
||||
FillBranchVisibilityMenu(submenu, branch);
|
||||
|
||||
var checkout = new MenuItem();
|
||||
checkout.Header = new Views.NameHighlightedTextBlock("BranchCM.Checkout", name);
|
||||
checkout.Icon = App.CreateMenuIcon("Icons.Check");
|
||||
|
@ -988,9 +1010,6 @@ namespace SourceGit.ViewModels
|
|||
};
|
||||
|
||||
submenu.Items.Add(merge);
|
||||
submenu.Items.Add(new MenuItem() { Header = "-" });
|
||||
|
||||
FillBranchVisibilityMenu(submenu, branch);
|
||||
|
||||
var delete = new MenuItem();
|
||||
delete.Header = new Views.NameHighlightedTextBlock("BranchCM.Delete", name);
|
||||
|
@ -1002,6 +1021,17 @@ namespace SourceGit.ViewModels
|
|||
e.Handled = true;
|
||||
};
|
||||
submenu.Items.Add(delete);
|
||||
submenu.Items.Add(new MenuItem() { Header = "-" });
|
||||
|
||||
var copy = new MenuItem();
|
||||
copy.Header = App.Text("BranchCM.CopyName");
|
||||
copy.Icon = App.CreateMenuIcon("Icons.Copy");
|
||||
copy.Click += (_, e) =>
|
||||
{
|
||||
App.CopyText(name);
|
||||
e.Handled = true;
|
||||
};
|
||||
submenu.Items.Add(copy);
|
||||
|
||||
menu.Items.Add(submenu);
|
||||
}
|
||||
|
@ -1013,6 +1043,8 @@ namespace SourceGit.ViewModels
|
|||
submenu.Icon = App.CreateMenuIcon("Icons.Tag");
|
||||
submenu.MinWidth = 200;
|
||||
|
||||
FillTagVisibilityMenu(submenu, tag);
|
||||
|
||||
var push = new MenuItem();
|
||||
push.Header = new Views.NameHighlightedTextBlock("TagCM.Push", tag.Name);
|
||||
push.Icon = App.CreateMenuIcon("Icons.Push");
|
||||
|
@ -1036,9 +1068,6 @@ namespace SourceGit.ViewModels
|
|||
e.Handled = true;
|
||||
};
|
||||
submenu.Items.Add(merge);
|
||||
submenu.Items.Add(new MenuItem() { Header = "-" });
|
||||
|
||||
FillTagVisibilityMenu(submenu, tag);
|
||||
|
||||
var delete = new MenuItem();
|
||||
delete.Header = new Views.NameHighlightedTextBlock("TagCM.Delete", tag.Name);
|
||||
|
@ -1050,6 +1079,17 @@ namespace SourceGit.ViewModels
|
|||
e.Handled = true;
|
||||
};
|
||||
submenu.Items.Add(delete);
|
||||
submenu.Items.Add(new MenuItem() { Header = "-" });
|
||||
|
||||
var copy = new MenuItem();
|
||||
copy.Header = App.Text("TagCM.Copy");
|
||||
copy.Icon = App.CreateMenuIcon("Icons.Copy");
|
||||
copy.Click += (_, e) =>
|
||||
{
|
||||
App.CopyText(tag.Name);
|
||||
e.Handled = true;
|
||||
};
|
||||
submenu.Items.Add(copy);
|
||||
|
||||
menu.Items.Add(submenu);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using Avalonia.Collections;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
|
|
|
@ -296,7 +296,8 @@ namespace SourceGit.Views
|
|||
if (currentParent is { DataContext: ViewModels.CommitDetail currentDetail } &&
|
||||
currentDetail.Commit.SHA == lastDetailCommit)
|
||||
{
|
||||
_inlineCommits.Add(sha, c);
|
||||
if (!_inlineCommits.ContainsKey(sha))
|
||||
_inlineCommits.Add(sha, c);
|
||||
|
||||
// Make sure user still hovers the target SHA.
|
||||
if (_lastHover == link && c != null)
|
||||
|
|
|
@ -65,6 +65,7 @@
|
|||
<Setter Property="Margin" Value="0"/>
|
||||
<Setter Property="Padding" Value="0"/>
|
||||
<Setter Property="Height" Value="28"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
|
||||
</Style>
|
||||
</ListBox.Styles>
|
||||
|
||||
|
@ -76,13 +77,16 @@
|
|||
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate DataType="vm:InteractiveRebaseItem">
|
||||
<Grid ColumnDefinitions="16,110,*,40,100,96,156,32,32">
|
||||
<Grid ColumnDefinitions="16,110,*,456" Margin="8,0" ClipToBounds="True">
|
||||
<!-- Drag & Drop Anchor -->
|
||||
<Border Grid.Column="0" Background="Transparent"
|
||||
Margin="4,0,0,0"
|
||||
Loaded="OnSetupRowHeaderDragDrop"
|
||||
PointerPressed="OnRowHeaderPointerPressed">
|
||||
<Path Width="14" Height="14" Data="{StaticResource Icons.Move}" Fill="{DynamicResource Brush.FG2}"/>
|
||||
<Path Width="14" Height="14"
|
||||
Data="{StaticResource Icons.Move}"
|
||||
Fill="{DynamicResource Brush.FG2}"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
|
||||
<!-- Action -->
|
||||
|
@ -170,8 +174,8 @@
|
|||
</Button>
|
||||
|
||||
<!-- Subject -->
|
||||
<StackPanel Grid.Column="2" Orientation="Horizontal" ClipToBounds="True">
|
||||
<Button Classes="icon_button" IsVisible="{Binding Action, Converter={x:Static c:InteractiveRebaseActionConverters.CanEditMessage}}">
|
||||
<Grid Grid.Column="2" ColumnDefinitions="Auto,*" ClipToBounds="True">
|
||||
<Button Grid.Column="0" Classes="icon_button" Margin="0,0,8,0" IsVisible="{Binding Action, Converter={x:Static c:InteractiveRebaseActionConverters.CanEditMessage}}">
|
||||
<Button.Flyout>
|
||||
<Flyout Placement="BottomEdgeAlignedLeft">
|
||||
<Panel Width="600" Height="120">
|
||||
|
@ -181,39 +185,47 @@
|
|||
</Button.Flyout>
|
||||
<Path Width="14" Height="14" Margin="0,4,0,0" Data="{StaticResource Icons.Edit}"/>
|
||||
</Button>
|
||||
<TextBlock Classes="primary" Text="{Binding Subject}" Margin="8,0,0,0"/>
|
||||
</StackPanel>
|
||||
<TextBlock Grid.Column="1" Classes="primary" Margin="0,0,4,0" Text="{Binding Subject}"/>
|
||||
</Grid>
|
||||
|
||||
<!-- Avatar -->
|
||||
<v:Avatar Grid.Column="3"
|
||||
Width="16" Height="16"
|
||||
Margin="16,0,8,0"
|
||||
VerticalAlignment="Center"
|
||||
IsHitTestVisible="False"
|
||||
User="{Binding Commit.Author}"/>
|
||||
<Grid Grid.Column="3" ColumnDefinitions="32,108,96,156,32,32" IsHitTestVisible="False" ClipToBounds="True">
|
||||
<!-- Author Avatar -->
|
||||
<v:Avatar Grid.Column="0"
|
||||
Width="16" Height="16"
|
||||
Margin="8,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
User="{Binding Commit.Author}"/>
|
||||
|
||||
<!-- Author -->
|
||||
<Border Grid.Column="4" ClipToBounds="True">
|
||||
<TextBlock Classes="primary" Text="{Binding Commit.Author.Name}" HorizontalAlignment="Left"/>
|
||||
</Border>
|
||||
|
||||
<!-- Commit SHA -->
|
||||
<TextBlock Grid.Column="5" Classes="primary"
|
||||
Text="{Binding Commit.SHA, Converter={x:Static c:StringConverters.ToShortSHA}}"
|
||||
Margin="12,0"/>
|
||||
<!-- Author Name -->
|
||||
<TextBlock Grid.Column="1"
|
||||
Classes="primary"
|
||||
MaxWidth="90"
|
||||
Margin="6,0,12,0"
|
||||
Text="{Binding Commit.Author.Name}"
|
||||
HorizontalAlignment="Left"/>
|
||||
|
||||
<!-- Commit Time -->
|
||||
<TextBlock Grid.Column="6" Classes="primary" Text="{Binding Commit.CommitterTimeStr}" Margin="8,0"/>
|
||||
<!-- Commit SHA -->
|
||||
<Border Grid.Column="2" ClipToBounds="True">
|
||||
<TextBlock Classes="primary"
|
||||
Text="{Binding Commit.SHA, Converter={x:Static c:StringConverters.ToShortSHA}}"
|
||||
HorizontalAlignment="Center"/>
|
||||
</Border>
|
||||
|
||||
<!-- MoveUp Button -->
|
||||
<Button Grid.Column="7" Classes="icon_button" Click="OnMoveItemUp" ToolTip.Tip="Alt+Up">
|
||||
<Path Width="14" Height="14" Margin="0,4,0,0" Data="{StaticResource Icons.Up}"/>
|
||||
</Button>
|
||||
|
||||
<!-- MoveDown Button -->
|
||||
<Button Grid.Column="8" Classes="icon_button" Click="OnMoveItemDown" ToolTip.Tip="Alt+Down">
|
||||
<Path Width="14" Height="14" Margin="0,4,0,0" Data="{StaticResource Icons.Down}"/>
|
||||
</Button>
|
||||
<!-- Commit Time -->
|
||||
<Border Grid.Column="3" ClipToBounds="True">
|
||||
<TextBlock Classes="primary" Text="{Binding Commit.CommitterTimeStr}" Margin="8,0"/>
|
||||
</Border>
|
||||
|
||||
<!-- MoveUp Button -->
|
||||
<Button Grid.Column="4" Classes="icon_button" Click="OnMoveItemUp" ToolTip.Tip="Alt+Up">
|
||||
<Path Width="14" Height="14" Margin="0,4,0,0" Data="{StaticResource Icons.Up}"/>
|
||||
</Button>
|
||||
|
||||
<!-- MoveDown Button -->
|
||||
<Button Grid.Column="5" Classes="icon_button" Click="OnMoveItemDown" ToolTip.Tip="Alt+Down">
|
||||
<Path Width="14" Height="14" Margin="0,4,0,0" Data="{StaticResource Icons.Down}"/>
|
||||
</Button>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
|
|
|
@ -50,9 +50,6 @@ namespace SourceGit.Views
|
|||
if (launcher is not null && DataContext is ViewModels.Repository repo)
|
||||
{
|
||||
var startDirectly = launcher.HasKeyModifier(KeyModifiers.Control);
|
||||
if (!startDirectly && OperatingSystem.IsMacOS())
|
||||
startDirectly = launcher.HasKeyModifier(KeyModifiers.Meta);
|
||||
|
||||
launcher.ClearKeyModifier();
|
||||
repo.Fetch(startDirectly);
|
||||
e.Handled = true;
|
||||
|
@ -65,9 +62,6 @@ namespace SourceGit.Views
|
|||
if (launcher is not null && DataContext is ViewModels.Repository repo)
|
||||
{
|
||||
var startDirectly = launcher.HasKeyModifier(KeyModifiers.Control);
|
||||
if (!startDirectly && OperatingSystem.IsMacOS())
|
||||
startDirectly = launcher.HasKeyModifier(KeyModifiers.Meta);
|
||||
|
||||
launcher.ClearKeyModifier();
|
||||
repo.Pull(startDirectly);
|
||||
e.Handled = true;
|
||||
|
@ -80,9 +74,6 @@ namespace SourceGit.Views
|
|||
if (launcher is not null && DataContext is ViewModels.Repository repo)
|
||||
{
|
||||
var startDirectly = launcher.HasKeyModifier(KeyModifiers.Control);
|
||||
if (!startDirectly && OperatingSystem.IsMacOS())
|
||||
startDirectly = launcher.HasKeyModifier(KeyModifiers.Meta);
|
||||
|
||||
launcher.ClearKeyModifier();
|
||||
repo.Push(startDirectly);
|
||||
e.Handled = true;
|
||||
|
@ -95,9 +86,6 @@ namespace SourceGit.Views
|
|||
if (launcher is not null && DataContext is ViewModels.Repository repo)
|
||||
{
|
||||
var startDirectly = launcher.HasKeyModifier(KeyModifiers.Control);
|
||||
if (!startDirectly && OperatingSystem.IsMacOS())
|
||||
startDirectly = launcher.HasKeyModifier(KeyModifiers.Meta);
|
||||
|
||||
launcher.ClearKeyModifier();
|
||||
repo.StashAll(startDirectly);
|
||||
e.Handled = true;
|
||||
|
|
Loading…
Reference in a new issue