11using System ;
22using System . Collections . Generic ;
33using System . IO ;
4+ using System . Runtime . Intrinsics . Arm ;
45using System . Text ;
56using System . Text . Json ;
67using System . Threading ;
@@ -1463,13 +1464,6 @@ public ContextMenu CreateContextMenuForLocalBranch(Models.Branch branch)
14631464 }
14641465
14651466 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- }
14731467 }
14741468 else
14751469 {
@@ -1540,6 +1534,19 @@ public ContextMenu CreateContextMenuForLocalBranch(Models.Branch branch)
15401534 menu . Items . Add ( merge ) ;
15411535 menu . Items . Add ( rebase ) ;
15421536
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+
15431550 if ( _localChangesCount > 0 )
15441551 {
15451552 var compareWithWorktree = new MenuItem ( ) ;
@@ -1556,18 +1563,8 @@ public ContextMenu CreateContextMenuForLocalBranch(Models.Branch branch)
15561563 _histories . DetailContext = new RevisionCompare ( _fullpath , target , null ) ;
15571564 }
15581565 } ;
1559- menu . Items . Add ( new MenuItem ( ) { Header = "-" } ) ;
15601566 menu . Items . Add ( compareWithWorktree ) ;
15611567 }
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- }
15711568 }
15721569
15731570 var detect = Commands . GitFlow . DetectType ( _fullpath , _branches , branch . Name ) ;
@@ -1813,7 +1810,19 @@ public ContextMenu CreateContextMenuForRemoteBranch(Models.Branch branch)
18131810 menu . Items . Add ( new MenuItem ( ) { Header = "-" } ) ;
18141811 }
18151812
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+
18171826 if ( _localChangesCount > 0 )
18181827 {
18191828 var compareWithWorktree = new MenuItem ( ) ;
@@ -1831,19 +1840,8 @@ public ContextMenu CreateContextMenuForRemoteBranch(Models.Branch branch)
18311840 }
18321841 } ;
18331842 menu . Items . Add ( compareWithWorktree ) ;
1834- hasCompare = true ;
18351843 }
18361844
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-
18471845 var delete = new MenuItem ( ) ;
18481846 delete . Header = new Views . NameHighlightedTextBlock ( "BranchCM.Delete" , name ) ;
18491847 delete . Icon = App . CreateMenuIcon ( "Icons.Clear" ) ;
@@ -2078,39 +2076,6 @@ public ContextMenu CreateContextMenuForWorktree(Models.Worktree worktree)
20782076 return menu ;
20792077 }
20802078
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-
21142079 private LauncherPage GetOwnerPage ( )
21152080 {
21162081 var launcher = App . GetLauncer ( ) ;
0 commit comments