Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/Commands/MergeTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@ public static bool OpenForMerge(string repo, int toolType, string toolPath, stri
cmd.Context = repo;
cmd.RaiseError = true;

// NOTE: If no <file> names are specified, 'git mergetool' will run the merge tool program on every file with merge conflicts.
var file_arg = string.IsNullOrEmpty(file) ? "" : $"\"{file}\"";

if (toolType == 0)
{
cmd.Args = $"mergetool \"{file}\"";
cmd.Args = $"mergetool {file_arg}";
return cmd.Exec();
}

Expand All @@ -32,7 +35,7 @@ public static bool OpenForMerge(string repo, int toolType, string toolPath, stri
return false;
}

cmd.Args = $"-c mergetool.sourcegit.cmd=\"\\\"{toolPath}\\\" {supported.Cmd}\" -c mergetool.writeToTemp=true -c mergetool.keepBackup=false -c mergetool.trustExitCode=true mergetool --tool=sourcegit \"{file}\"";
cmd.Args = $"-c mergetool.sourcegit.cmd=\"\\\"{toolPath}\\\" {supported.Cmd}\" -c mergetool.writeToTemp=true -c mergetool.keepBackup=false -c mergetool.trustExitCode=true mergetool --tool=sourcegit {file_arg}";
return cmd.Exec();
}

Expand Down
2 changes: 1 addition & 1 deletion src/Models/Change.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class Change
public string OriginalPath { get; set; } = "";
public ChangeDataForAmend DataForAmend { get; set; } = null;

public bool IsConflit
public bool IsConflict
{
get
{
Expand Down
4 changes: 4 additions & 0 deletions src/Resources/Locales/en_US.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,11 @@
<x:String x:Key="Text.WorkingCopy.CommitWithAutoStage" xml:space="preserve">Stage all changes and commit</x:String>
<x:String x:Key="Text.WorkingCopy.ConfirmCommitWithFilter">You have staged {0} file(s) but only {1} file(s) displayed ({2} files are filtered out). Do you want to continue?</x:String>
<x:String x:Key="Text.WorkingCopy.Conflicts" xml:space="preserve">CONFLICTS DETECTED</x:String>
<x:String x:Key="Text.WorkingCopy.Conflicts.OpenExternalMergeTool" xml:space="preserve">OPEN EXTERNAL MERGETOOL</x:String>
<x:String x:Key="Text.WorkingCopy.Conflicts.OpenExternalMergeToolAllConflicts" xml:space="preserve">OPEN ALL CONFLICTS IN EXTERNAL MERGETOOL</x:String>
<x:String x:Key="Text.WorkingCopy.Conflicts.Resolved" xml:space="preserve">FILE CONFLICTS ARE RESOLVED</x:String>
<x:String x:Key="Text.WorkingCopy.Conflicts.UseMine" xml:space="preserve">USE MINE</x:String>
<x:String x:Key="Text.WorkingCopy.Conflicts.UseTheirs" xml:space="preserve">USE THEIRS</x:String>
<x:String x:Key="Text.WorkingCopy.IncludeUntracked" xml:space="preserve">INCLUDE UNTRACKED FILES</x:String>
<x:String x:Key="Text.WorkingCopy.NoCommitHistories" xml:space="preserve">NO RECENT INPUT MESSAGES</x:String>
<x:String x:Key="Text.WorkingCopy.NoCommitTemplates" xml:space="preserve">NO COMMIT TEMPLATES</x:String>
Expand Down
31 changes: 19 additions & 12 deletions src/ViewModels/WorkingCopy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ public void SetData(List<Models.Change> changes)
// Just force refresh selected changes.
Dispatcher.UIThread.Invoke(() =>
{
HasUnsolvedConflicts = _cached.Find(x => x.IsConflit) != null;
HasUnsolvedConflicts = _cached.Find(x => x.IsConflict) != null;

UpdateDetail();
UpdateInProgressState();
Expand Down Expand Up @@ -275,7 +275,7 @@ public void SetData(List<Models.Change> changes)
if (c.WorkTree != Models.ChangeState.None)
{
unstaged.Add(c);
hasConflict |= c.IsConflit;
hasConflict |= c.IsConflict;
}
}

Expand Down Expand Up @@ -314,6 +314,12 @@ public void SetData(List<Models.Change> changes)
});
}

public void OpenExternalMergeToolAllConflicts()
{
// No <file> arg, mergetool runs on all files with merge conflicts!
UseExternalMergeTool(null);
}

public void OpenAssumeUnchanged()
{
App.OpenDialog(new Views.AssumeUnchangedManager()
Expand Down Expand Up @@ -373,7 +379,7 @@ public async void UseTheirs(List<Models.Change> changes)

foreach (var change in changes)
{
if (!change.IsConflit)
if (!change.IsConflict)
continue;

if (change.WorkTree == Models.ChangeState.Deleted)
Expand Down Expand Up @@ -413,7 +419,7 @@ public async void UseMine(List<Models.Change> changes)

foreach (var change in changes)
{
if (!change.IsConflit)
if (!change.IsConflict)
continue;

if (change.Index == Models.ChangeState.Deleted)
Expand Down Expand Up @@ -448,7 +454,8 @@ public async void UseExternalMergeTool(Models.Change change)
{
var toolType = Preferences.Instance.ExternalMergeToolType;
var toolPath = Preferences.Instance.ExternalMergeToolPath;
await Task.Run(() => Commands.MergeTool.OpenForMerge(_repo.FullPath, toolType, toolPath, change.Path));
var file = change?.Path; // NOTE: With no <file> arg, mergetool runs on on every file with merge conflicts!
await Task.Run(() => Commands.MergeTool.OpenForMerge(_repo.FullPath, toolType, toolPath, file));
}

public void ContinueMerge()
Expand Down Expand Up @@ -585,7 +592,7 @@ public ContextMenu CreateContextMenuForUnstagedChanges()
menu.Items.Add(openWith);
menu.Items.Add(new MenuItem() { Header = "-" });

if (change.IsConflit)
if (change.IsConflict)
{
var useTheirs = new MenuItem();
useTheirs.Icon = App.CreateMenuIcon("Icons.Incoming");
Expand Down Expand Up @@ -924,20 +931,20 @@ public ContextMenu CreateContextMenuForUnstagedChanges()
else
{
var hasConflicts = false;
var hasNoneConflicts = false;
var hasNonConflicts = false;
foreach (var change in _selectedUnstaged)
{
if (change.IsConflit)
if (change.IsConflict)
hasConflicts = true;
else
hasNoneConflicts = true;
hasNonConflicts = true;
}

if (hasConflicts)
{
if (hasNoneConflicts)
if (hasNonConflicts)
{
App.RaiseException(_repo.FullPath, "You have selected both non-conflict changes with conflicts!");
App.RaiseException(_repo.FullPath, "Selection contains both conflict and non-conflict changes!");
return null;
}

Expand Down Expand Up @@ -1644,7 +1651,7 @@ private void SetDetail(Models.Change change, bool isUnstaged)

if (change == null)
DetailContext = null;
else if (change.IsConflit && isUnstaged)
else if (change.IsConflict && isUnstaged)
DetailContext = new Conflict(_repo, this, change);
else
DetailContext = new DiffContext(_repo.FullPath, new Models.DiffOption(change, isUnstaged), _detailContext as DiffContext);
Expand Down
4 changes: 2 additions & 2 deletions src/Views/ChangeStatusIcon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public override void Render(DrawingContext context)
string indicator;
if (IsUnstagedChange)
{
if (Change.IsConflit)
if (Change.IsConflict)
{
background = Brushes.OrangeRed;
indicator = "!";
Expand Down Expand Up @@ -139,7 +139,7 @@ protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs chang
}

if (isUnstaged)
ToolTip.SetTip(this, c.IsConflit ? "Conflict" : TIPS[(int)c.WorkTree]);
ToolTip.SetTip(this, c.IsConflict ? "Conflict" : TIPS[(int)c.WorkTree]);
else
ToolTip.SetTip(this, TIPS[(int)c.Index]);

Expand Down
6 changes: 3 additions & 3 deletions src/Views/Conflict.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@
</Border>

<StackPanel Margin="0,8,0,0" Orientation="Horizontal" HorizontalAlignment="Center">
<Button Classes="flat" Content="USE THEIRS" Command="{Binding UseTheirs}"/>
<Button Classes="flat" Margin="8,0,0,0" Content="USE MINE" Command="{Binding UseMine}"/>
<Button Classes="flat" Margin="8,0,0,0" Content="OPEN EXTERNAL MERGETOOL" Command="{Binding OpenExternalMergeTool}"/>
<Button Classes="flat" Margin="0,0,0,0" Content="{DynamicResource Text.WorkingCopy.Conflicts.UseTheirs}" Command="{Binding UseTheirs}"/>
<Button Classes="flat" Margin="8,0,0,0" Content="{DynamicResource Text.WorkingCopy.Conflicts.UseMine}" Command="{Binding UseMine}"/>
<Button Classes="flat" Margin="8,0,0,0" Content="{DynamicResource Text.WorkingCopy.Conflicts.OpenExternalMergeTool}" Command="{Binding OpenExternalMergeTool}"/>
</StackPanel>
</StackPanel>

Expand Down
19 changes: 14 additions & 5 deletions src/Views/WorkingCopy.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,26 +61,35 @@
<Grid Grid.Row="1" RowDefinitions="28,*">
<!-- Unstaged Toolbar -->
<Border Grid.Row="0" BorderThickness="0,0,0,1" BorderBrush="{DynamicResource Brush.Border0}">
<Grid ColumnDefinitions="Auto,Auto,Auto,Auto,*,Auto,Auto,Auto,Auto,Auto">
<Grid ColumnDefinitions="Auto,Auto,Auto,Auto,*,Auto,Auto,Auto,Auto,Auto,Auto">
<Path Grid.Column="0" Margin="8,0,0,0" Width="14" Height="14" Fill="{DynamicResource Brush.FG2}" Data="{StaticResource Icons.Changes}"/>
<TextBlock Grid.Column="1" Text="{DynamicResource Text.WorkingCopy.Unstaged}" Foreground="{DynamicResource Brush.FG2}" FontWeight="Bold" Margin="4,0,0,0"/>
<TextBlock Grid.Column="2" FontWeight="Bold" Foreground="{DynamicResource Brush.FG2}" Text="{Binding Unstaged, Converter={x:Static c:ListConverters.ToCount}}"/>
<v:LoadingIcon Grid.Column="3" Width="14" Height="14" Margin="8,0,0,0" IsVisible="{Binding IsStaging}"/>

<Button Grid.Column="5"
Classes="icon_button"
Width="26" Height="14"
Padding="0"
IsVisible="{Binding HasUnsolvedConflicts}"
ToolTip.Tip="{DynamicResource Text.WorkingCopy.Conflicts.OpenExternalMergeToolAllConflicts}"
Command="{Binding OpenExternalMergeToolAllConflicts}">
<Path Width="14" Height="14" Data="{StaticResource Icons.Conflict}"/>
</Button>
<Button Grid.Column="6"
Classes="icon_button"
Width="26" Height="14"
Padding="0"
ToolTip.Tip="{DynamicResource Text.WorkingCopy.Unstaged.ViewAssumeUnchaged}"
Command="{Binding OpenAssumeUnchanged}">
<Path Width="14" Height="14" Data="{StaticResource Icons.File.Ignore}"/>
</Button>
<ToggleButton Grid.Column="6"
<ToggleButton Grid.Column="7"
Classes="toggle_untracked"
Width="26" Height="14"
ToolTip.Tip="{DynamicResource Text.WorkingCopy.IncludeUntracked}"
IsChecked="{Binding IncludeUntracked, Mode=TwoWay}"/>
<Button Grid.Column="7"
<Button Grid.Column="8"
Classes="icon_button"
Width="26" Height="14"
Padding="0"
Expand All @@ -93,15 +102,15 @@
</ToolTip.Tip>
<Path Width="14" Height="14" Margin="0,6,0,0" Data="{StaticResource Icons.Down}"/>
</Button>
<Button Grid.Column="8"
<Button Grid.Column="9"
Classes="icon_button"
Width="26" Height="14"
Padding="0"
ToolTip.Tip="{DynamicResource Text.WorkingCopy.Unstaged.StageAll}"
Command="{Binding StageAll}">
<Path Width="14" Height="14" Data="{StaticResource Icons.DoubleDown}"/>
</Button>
<v:ChangeViewModeSwitcher Grid.Column="9"
<v:ChangeViewModeSwitcher Grid.Column="10"
Width="26" Height="14"
Margin="0,1,0,0"
ViewMode="{Binding Source={x:Static vm:Preferences.Instance}, Path=UnstagedChangeViewMode, Mode=TwoWay}"/>
Expand Down