Skip to content

Commit 38a3894

Browse files
committed
ux: remove Reset to Parent Revision context menu entry for selected file in FILES page (#2060)
Since the file in `Parent Revision` may not be modified, and user can not notice this (also can not see the differences between current and prev revision) in `FILES` page, the `Reset to Parent Revision` should not be available here. Signed-off-by: leo <longshuang@msn.cn>
1 parent b29e96b commit 38a3894

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

src/Views/RevisionFileTreeView.axaml.cs

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -613,19 +613,7 @@ private ContextMenu CreateRevisionFileContextMenu(ViewModels.Repository repo, Vi
613613
ev.Handled = true;
614614
};
615615

616-
var change = vm.Changes.Find(x => x.Path == file.Path) ?? new Models.Change() { Index = Models.ChangeState.None, Path = file.Path };
617-
var resetToFirstParent = new MenuItem();
618-
resetToFirstParent.Header = App.Text("ChangeCM.CheckoutFirstParentRevision");
619-
resetToFirstParent.Icon = App.CreateMenuIcon("Icons.File.Checkout");
620-
resetToFirstParent.IsEnabled = commit.Parents.Count > 0;
621-
resetToFirstParent.Click += async (_, ev) =>
622-
{
623-
await vm.ResetToParentRevisionAsync(change);
624-
ev.Handled = true;
625-
};
626-
627616
menu.Items.Add(resetToThisRevision);
628-
menu.Items.Add(resetToFirstParent);
629617
menu.Items.Add(new MenuItem() { Header = "-" });
630618

631619
if (repo.Remotes.Count > 0 && File.Exists(fullPath) && repo.IsLFSEnabled())
@@ -641,7 +629,7 @@ private ContextMenu CreateRevisionFileContextMenu(ViewModels.Repository repo, Vi
641629
{
642630
lfsLock.Click += async (_, e) =>
643631
{
644-
await repo.LockLFSFileAsync(repo.Remotes[0].Name, change.Path);
632+
await repo.LockLFSFileAsync(repo.Remotes[0].Name, file.Path);
645633
e.Handled = true;
646634
};
647635
}
@@ -654,7 +642,7 @@ private ContextMenu CreateRevisionFileContextMenu(ViewModels.Repository repo, Vi
654642
lockRemote.Header = remoteName;
655643
lockRemote.Click += async (_, e) =>
656644
{
657-
await repo.LockLFSFileAsync(remoteName, change.Path);
645+
await repo.LockLFSFileAsync(remoteName, file.Path);
658646
e.Handled = true;
659647
};
660648
lfsLock.Items.Add(lockRemote);
@@ -669,7 +657,7 @@ private ContextMenu CreateRevisionFileContextMenu(ViewModels.Repository repo, Vi
669657
{
670658
lfsUnlock.Click += async (_, e) =>
671659
{
672-
await repo.UnlockLFSFileAsync(repo.Remotes[0].Name, change.Path, false, true);
660+
await repo.UnlockLFSFileAsync(repo.Remotes[0].Name, file.Path, false, true);
673661
e.Handled = true;
674662
};
675663
}
@@ -682,7 +670,7 @@ private ContextMenu CreateRevisionFileContextMenu(ViewModels.Repository repo, Vi
682670
unlockRemote.Header = remoteName;
683671
unlockRemote.Click += async (_, e) =>
684672
{
685-
await repo.UnlockLFSFileAsync(remoteName, change.Path, false, true);
673+
await repo.UnlockLFSFileAsync(remoteName, file.Path, false, true);
686674
e.Handled = true;
687675
};
688676
lfsUnlock.Items.Add(unlockRemote);

0 commit comments

Comments
 (0)