Compare commits

...

4 commits

Author SHA1 Message Date
leo
c67cdb931f
enhance: stop switching workspace when one or more tasks are running in opened pages
Some checks are pending
Continuous Integration / Build (push) Waiting to run
Continuous Integration / Prepare version string (push) Waiting to run
Continuous Integration / Package (push) Blocked by required conditions
2024-10-11 17:37:34 +08:00
leo
6ca6399bd3
enhance: re-run searching after search option changes 2024-10-11 11:29:33 +08:00
leo
b5000f920f
enhance: highlight selected search commits 2024-10-11 11:04:27 +08:00
leo
c2b17ef9d0
fix: changing the repository URL only changes the fetch URL if push URL using a different URL (#553) 2024-10-11 10:03:42 +08:00
6 changed files with 40 additions and 11 deletions

View file

@ -32,9 +32,17 @@
return Exec(); return Exec();
} }
public bool SetURL(string name, string url) public string GetURL(string name, bool isPush)
{ {
Args = $"remote set-url {name} {url}"; Args = "remote get-url" + (isPush ? " --push " : " ") + name;
var rs = ReadToEnd();
return rs.IsSuccess ? rs.StdOut.Trim() : string.Empty;
}
public bool SetURL(string name, string url, bool isPush)
{
Args = "remote set-url" + (isPush ? " --push " : " ") + $"{name} {url}";
return Exec(); return Exec();
} }
} }

View file

@ -118,11 +118,15 @@ namespace SourceGit.ViewModels
if (_remote.URL != _url) if (_remote.URL != _url)
{ {
var succ = new Commands.Remote(_repo.FullPath).SetURL(_name, _url); var succ = new Commands.Remote(_repo.FullPath).SetURL(_name, _url, false);
if (succ) if (succ)
_remote.URL = _url; _remote.URL = _url;
} }
var pushURL = new Commands.Remote(_repo.FullPath).GetURL(_name, true);
if (pushURL != _url)
new Commands.Remote(_repo.FullPath).SetURL(_name, _url, true);
SetProgressDescription("Post processing ..."); SetProgressDescription("Post processing ...");
new Commands.Config(_repo.FullPath).Set($"remote.{_name}.sshkey", _useSSH ? SSHKey : null); new Commands.Config(_repo.FullPath).Set($"remote.{_name}.sshkey", _useSSH ? SSHKey : null);

View file

@ -153,7 +153,11 @@ namespace SourceGit.ViewModels
else if (commits.Count == 1) else if (commits.Count == 1)
{ {
var commit = commits[0] as Models.Commit; var commit = commits[0] as Models.Commit;
_repo.SearchResultSelectedCommit = commit;
if (_repo.SearchResultSelectedCommit == null || _repo.SearchResultSelectedCommit.SHA != commit.SHA)
{
_repo.SearchResultSelectedCommit = _repo.SearchedCommits.Find(x => x.SHA == commit.SHA);
}
AutoSelectedCommit = commit; AutoSelectedCommit = commit;
NavigationId = _navigationId + 1; NavigationId = _navigationId + 1;

View file

@ -465,6 +465,15 @@ namespace SourceGit.ViewModels
private void SwitchWorkspace(Workspace to) private void SwitchWorkspace(Workspace to)
{ {
foreach (var one in Pages)
{
if (one.IsInProgress())
{
App.RaiseException(null, "You have unfinished task(s) in opened pages. Please wait!!!");
return;
}
}
_ignoreIndexChange = true; _ignoreIndexChange = true;
var pref = Preference.Instance; var pref = Preference.Instance;

View file

@ -213,7 +213,12 @@ namespace SourceGit.ViewModels
public bool OnlySearchCommitsInCurrentBranch public bool OnlySearchCommitsInCurrentBranch
{ {
get => _onlySearchCommitsInCurrentBranch; get => _onlySearchCommitsInCurrentBranch;
set => SetProperty(ref _onlySearchCommitsInCurrentBranch, value); set
{
if (SetProperty(ref _onlySearchCommitsInCurrentBranch, value) &&
!string.IsNullOrEmpty(_searchCommitFilter))
StartSearchCommits();
}
} }
public int SearchCommitFilterType public int SearchCommitFilterType
@ -222,7 +227,12 @@ namespace SourceGit.ViewModels
set set
{ {
if (SetProperty(ref _searchCommitFilterType, value)) if (SetProperty(ref _searchCommitFilterType, value))
{
UpdateCurrentRevisionFilesForSearchSuggestion(); UpdateCurrentRevisionFilesForSearchSuggestion();
if (!string.IsNullOrEmpty(_searchCommitFilter))
StartSearchCommits();
}
} }
} }

View file

@ -460,12 +460,6 @@
<Setter Property="Padding" Value="0"/> <Setter Property="Padding" Value="0"/>
<Setter Property="Height" Value="50"/> <Setter Property="Height" Value="50"/>
</Style> </Style>
<Style Selector="ListBoxItem:selected /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="Transparent" />
</Style>
<Style Selector="ListBoxItem:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{DynamicResource Brush.AccentHovered}" />
</Style>
</ListBox.Styles> </ListBox.Styles>
<ListBox.ItemsPanel> <ListBox.ItemsPanel>