optimize<Stash>: new stash push implementation - untracked file will be added before stash

This commit is contained in:
leo 2021-04-30 14:21:52 +08:00
parent c25ea618d0
commit 18df69b703
8 changed files with 108 additions and 91 deletions

View file

@ -27,8 +27,14 @@
<!-- Stashes List Group -->
<Border Grid.Row="0" BorderBrush="{StaticResource Brush.Border0}" BorderThickness="0,0,0,1">
<StackPanel Orientation="Horizontal">
<Path
Margin="4,0"
Width="12" Height="12"
Fill="{StaticResource Brush.FG2}"
Data="{StaticResource Icon.Stashes}"/>
<TextBlock
Margin="6,0,0,0"
Margin="4,0,0,0"
Text="{StaticResource Text.Stashes.Stashes}"
Foreground="{StaticResource Brush.FG2}"
FontWeight="Bold"/>
@ -71,25 +77,19 @@
<!-- Change List Group -->
<Border Grid.Row="2" BorderBrush="{StaticResource Brush.Border0}" BorderThickness="0,1">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal">
<Path
Margin="4,0"
Width="12" Height="12"
Fill="{StaticResource Brush.FG2}"
Data="{StaticResource Icon.File}"/>
<TextBlock
Grid.Column="0"
Margin="6,0,0,0"
Margin="4,0,0,0"
Text="{StaticResource Text.Stashes.Changes}"
Foreground="{StaticResource Brush.FG2}"
FontWeight="Bold"/>
<TextBlock
Grid.Column="1"
Margin="0,0,4,0"
Text="{StaticResource Text.Stashes.Changes.Tip}"
Foreground="{StaticResource Brush.FG2}"
FontFamily="Consolas"
FontSize="10"/>
</Grid>
</StackPanel>
</Border>
<!-- Changed Files -->

View file

@ -306,8 +306,8 @@ namespace SourceGit.Views.Widgets {
}
private async void SaveAsPatch(string saveTo, List<Models.Change> changes) {
FileStream stream = new FileStream(saveTo, FileMode.Create);
StreamWriter writer = new StreamWriter(stream);
var stream = new FileStream(saveTo, FileMode.Create);
var writer = new StreamWriter(stream);
foreach (var c in changes) {
await Task.Run(() => new Commands.SaveChangeToStream(repo, c, writer).Exec());
@ -353,7 +353,7 @@ namespace SourceGit.Views.Widgets {
var stash = new MenuItem();
stash.Header = App.Text("FileCM.Stash");
stash.Click += (o, e) => {
new Popups.Stash(repo, files).Show();
new Popups.Stash(repo, changes).Show();
e.Handled = true;
};
@ -416,7 +416,7 @@ namespace SourceGit.Views.Widgets {
var stash = new MenuItem();
stash.Header = App.Text("FileCM.StashMulti", changes.Count);
stash.Click += (o, e) => {
new Popups.Stash(repo, files).Show();
new Popups.Stash(repo, changes).Show();
e.Handled = true;
};
@ -475,7 +475,7 @@ namespace SourceGit.Views.Widgets {
var stash = new MenuItem();
stash.Header = App.Text("FileCM.Stash");
stash.Click += (o, e) => {
new Popups.Stash(repo, files).Show();
new Popups.Stash(repo, changes).Show();
e.Handled = true;
};
@ -538,7 +538,7 @@ namespace SourceGit.Views.Widgets {
var stash = new MenuItem();
stash.Header = App.Text("FileCM.StashMulti", changes.Count);
stash.Click += (o, e) => {
new Popups.Stash(repo, files).Show();
new Popups.Stash(repo, changes).Show();
e.Handled = true;
};