1
1
using System ;
2
2
using System . Collections . Generic ;
3
3
using System . IO ;
4
+ using System . Runtime . Intrinsics . Arm ;
4
5
using System . Text ;
5
6
using System . Text . Json ;
6
7
using System . Threading ;
@@ -1463,13 +1464,6 @@ public ContextMenu CreateContextMenuForLocalBranch(Models.Branch branch)
1463
1464
}
1464
1465
1465
1466
menu . Items . Add ( push ) ;
1466
-
1467
- var compareWithBranch = CreateMenuItemToCompareBranches ( branch ) ;
1468
- if ( compareWithBranch != null )
1469
- {
1470
- menu . Items . Add ( new MenuItem ( ) { Header = "-" } ) ;
1471
- menu . Items . Add ( compareWithBranch ) ;
1472
- }
1473
1467
}
1474
1468
else
1475
1469
{
@@ -1540,6 +1534,19 @@ public ContextMenu CreateContextMenuForLocalBranch(Models.Branch branch)
1540
1534
menu . Items . Add ( merge ) ;
1541
1535
menu . Items . Add ( rebase ) ;
1542
1536
1537
+ var compareWithHead = new MenuItem ( ) ;
1538
+ compareWithHead . Header = App . Text ( "BranchCM.CompareWithHead" ) ;
1539
+ compareWithHead . Icon = App . CreateMenuIcon ( "Icons.Compare" ) ;
1540
+ compareWithHead . Click += ( _ , _ ) =>
1541
+ {
1542
+ App . OpenDialog ( new Views . BranchCompare ( )
1543
+ {
1544
+ DataContext = new BranchCompare ( _fullpath , branch , _currentBranch )
1545
+ } ) ;
1546
+ } ;
1547
+ menu . Items . Add ( new MenuItem ( ) { Header = "-" } ) ;
1548
+ menu . Items . Add ( compareWithHead ) ;
1549
+
1543
1550
if ( _localChangesCount > 0 )
1544
1551
{
1545
1552
var compareWithWorktree = new MenuItem ( ) ;
@@ -1556,18 +1563,8 @@ public ContextMenu CreateContextMenuForLocalBranch(Models.Branch branch)
1556
1563
_histories . DetailContext = new RevisionCompare ( _fullpath , target , null ) ;
1557
1564
}
1558
1565
} ;
1559
- menu . Items . Add ( new MenuItem ( ) { Header = "-" } ) ;
1560
1566
menu . Items . Add ( compareWithWorktree ) ;
1561
1567
}
1562
-
1563
- var compareWithBranch = CreateMenuItemToCompareBranches ( branch ) ;
1564
- if ( compareWithBranch != null )
1565
- {
1566
- if ( _localChangesCount == 0 )
1567
- menu . Items . Add ( new MenuItem ( ) { Header = "-" } ) ;
1568
-
1569
- menu . Items . Add ( compareWithBranch ) ;
1570
- }
1571
1568
}
1572
1569
1573
1570
var detect = Commands . GitFlow . DetectType ( _fullpath , _branches , branch . Name ) ;
@@ -1813,7 +1810,19 @@ public ContextMenu CreateContextMenuForRemoteBranch(Models.Branch branch)
1813
1810
menu . Items . Add ( new MenuItem ( ) { Header = "-" } ) ;
1814
1811
}
1815
1812
1816
- var hasCompare = false ;
1813
+ var compareWithHead = new MenuItem ( ) ;
1814
+ compareWithHead . Header = App . Text ( "BranchCM.CompareWithHead" ) ;
1815
+ compareWithHead . Icon = App . CreateMenuIcon ( "Icons.Compare" ) ;
1816
+ compareWithHead . Click += ( _ , _ ) =>
1817
+ {
1818
+ App . OpenDialog ( new Views . BranchCompare ( )
1819
+ {
1820
+ DataContext = new BranchCompare ( _fullpath , branch , _currentBranch )
1821
+ } ) ;
1822
+ } ;
1823
+ menu . Items . Add ( new MenuItem ( ) { Header = "-" } ) ;
1824
+ menu . Items . Add ( compareWithHead ) ;
1825
+
1817
1826
if ( _localChangesCount > 0 )
1818
1827
{
1819
1828
var compareWithWorktree = new MenuItem ( ) ;
@@ -1831,19 +1840,8 @@ public ContextMenu CreateContextMenuForRemoteBranch(Models.Branch branch)
1831
1840
}
1832
1841
} ;
1833
1842
menu . Items . Add ( compareWithWorktree ) ;
1834
- hasCompare = true ;
1835
1843
}
1836
1844
1837
- var compareWithBranch = CreateMenuItemToCompareBranches ( branch ) ;
1838
- if ( compareWithBranch != null )
1839
- {
1840
- menu . Items . Add ( compareWithBranch ) ;
1841
- hasCompare = true ;
1842
- }
1843
-
1844
- if ( hasCompare )
1845
- menu . Items . Add ( new MenuItem ( ) { Header = "-" } ) ;
1846
-
1847
1845
var delete = new MenuItem ( ) ;
1848
1846
delete . Header = new Views . NameHighlightedTextBlock ( "BranchCM.Delete" , name ) ;
1849
1847
delete . Icon = App . CreateMenuIcon ( "Icons.Clear" ) ;
@@ -2078,39 +2076,6 @@ public ContextMenu CreateContextMenuForWorktree(Models.Worktree worktree)
2078
2076
return menu ;
2079
2077
}
2080
2078
2081
- private MenuItem CreateMenuItemToCompareBranches ( Models . Branch branch )
2082
- {
2083
- if ( _branches . Count == 1 )
2084
- return null ;
2085
-
2086
- var compare = new MenuItem ( ) ;
2087
- compare . Header = App . Text ( "BranchCM.CompareWithBranch" ) ;
2088
- compare . Icon = App . CreateMenuIcon ( "Icons.Compare" ) ;
2089
-
2090
- foreach ( var b in _branches )
2091
- {
2092
- if ( b . FullName != branch . FullName )
2093
- {
2094
- var dup = b ;
2095
- var target = new MenuItem ( ) ;
2096
- target . Header = b . FriendlyName ;
2097
- target . Icon = App . CreateMenuIcon ( b . IsCurrent ? "Icons.Check" : "Icons.Branch" ) ;
2098
- target . Click += ( _ , e ) =>
2099
- {
2100
- App . OpenDialog ( new Views . BranchCompare ( )
2101
- {
2102
- DataContext = new BranchCompare ( _fullpath , branch , dup )
2103
- } ) ;
2104
- e . Handled = true ;
2105
- } ;
2106
-
2107
- compare . Items . Add ( target ) ;
2108
- }
2109
- }
2110
-
2111
- return compare ;
2112
- }
2113
-
2114
2079
private LauncherPage GetOwnerPage ( )
2115
2080
{
2116
2081
var launcher = App . GetLauncer ( ) ;
0 commit comments