mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-20 19:55:00 +00:00
enhance: record more git command logs
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
d254b557a9
commit
75b4a4b294
9 changed files with 107 additions and 50 deletions
|
@ -36,9 +36,9 @@ namespace SourceGit.Commands
|
||||||
return content.Contains("git lfs pre-push");
|
return content.Contains("git lfs pre-push");
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Install()
|
public bool Install(Models.ICommandLog log)
|
||||||
{
|
{
|
||||||
return new SubCmd(_repo, "lfs install --local", null).Exec();
|
return new SubCmd(_repo, "lfs install --local", log).Exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Track(string pattern, bool isFilenameMode, Models.ICommandLog log)
|
public bool Track(string pattern, bool isFilenameMode, Models.ICommandLog log)
|
||||||
|
@ -93,21 +93,21 @@ namespace SourceGit.Commands
|
||||||
return locks;
|
return locks;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Lock(string remote, string file)
|
public bool Lock(string remote, string file, Models.ICommandLog log)
|
||||||
{
|
{
|
||||||
return new SubCmd(_repo, $"lfs lock --remote={remote} \"{file}\"", null).Exec();
|
return new SubCmd(_repo, $"lfs lock --remote={remote} \"{file}\"", log).Exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Unlock(string remote, string file, bool force)
|
public bool Unlock(string remote, string file, bool force, Models.ICommandLog log)
|
||||||
{
|
{
|
||||||
var opt = force ? "-f" : "";
|
var opt = force ? "-f" : "";
|
||||||
return new SubCmd(_repo, $"lfs unlock --remote={remote} {opt} \"{file}\"", null).Exec();
|
return new SubCmd(_repo, $"lfs unlock --remote={remote} {opt} \"{file}\"", log).Exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Unlock(string remote, long id, bool force)
|
public bool Unlock(string remote, long id, bool force, Models.ICommandLog log)
|
||||||
{
|
{
|
||||||
var opt = force ? "-f" : "";
|
var opt = force ? "-f" : "";
|
||||||
return new SubCmd(_repo, $"lfs unlock --remote={remote} {opt} --id={id}", null).Exec();
|
return new SubCmd(_repo, $"lfs unlock --remote={remote} {opt} --id={id}", log).Exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly string _repo;
|
private readonly string _repo;
|
||||||
|
|
|
@ -9,14 +9,14 @@ namespace SourceGit.ViewModels
|
||||||
{
|
{
|
||||||
public AvaloniaList<string> Files { get; private set; }
|
public AvaloniaList<string> Files { get; private set; }
|
||||||
|
|
||||||
public AssumeUnchangedManager(string repo)
|
public AssumeUnchangedManager(Repository repo)
|
||||||
{
|
{
|
||||||
_repo = repo;
|
_repo = repo;
|
||||||
Files = new AvaloniaList<string>();
|
Files = new AvaloniaList<string>();
|
||||||
|
|
||||||
Task.Run(() =>
|
Task.Run(() =>
|
||||||
{
|
{
|
||||||
var collect = new Commands.QueryAssumeUnchangedFiles(_repo).Result();
|
var collect = new Commands.QueryAssumeUnchangedFiles(_repo.FullPath).Result();
|
||||||
Dispatcher.UIThread.Invoke(() => Files.AddRange(collect));
|
Dispatcher.UIThread.Invoke(() => Files.AddRange(collect));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -25,11 +25,13 @@ namespace SourceGit.ViewModels
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(file))
|
if (!string.IsNullOrEmpty(file))
|
||||||
{
|
{
|
||||||
new Commands.AssumeUnchanged(_repo, file, false).Exec();
|
var log = _repo.CreateLog("Remove Assue Unchanged File");
|
||||||
|
new Commands.AssumeUnchanged(_repo.FullPath, file, false).Use(log).Exec();
|
||||||
|
log.Complete();
|
||||||
Files.Remove(file);
|
Files.Remove(file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly string _repo;
|
private readonly Repository _repo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -391,7 +391,9 @@ namespace SourceGit.ViewModels
|
||||||
resetToThisRevision.Icon = App.CreateMenuIcon("Icons.File.Checkout");
|
resetToThisRevision.Icon = App.CreateMenuIcon("Icons.File.Checkout");
|
||||||
resetToThisRevision.Click += (_, ev) =>
|
resetToThisRevision.Click += (_, ev) =>
|
||||||
{
|
{
|
||||||
new Commands.Checkout(_repo.FullPath).FileWithRevision(change.Path, $"{_commit.SHA}");
|
var log = _repo.CreateLog($"Reset File to '{_commit.SHA}'");
|
||||||
|
new Commands.Checkout(_repo.FullPath).Use(log).FileWithRevision(change.Path, $"{_commit.SHA}");
|
||||||
|
log.Complete();
|
||||||
ev.Handled = true;
|
ev.Handled = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -401,10 +403,12 @@ namespace SourceGit.ViewModels
|
||||||
resetToFirstParent.IsEnabled = _commit.Parents.Count > 0;
|
resetToFirstParent.IsEnabled = _commit.Parents.Count > 0;
|
||||||
resetToFirstParent.Click += (_, ev) =>
|
resetToFirstParent.Click += (_, ev) =>
|
||||||
{
|
{
|
||||||
|
var log = _repo.CreateLog($"Reset File to '{_commit.SHA}~1'");
|
||||||
if (change.Index == Models.ChangeState.Renamed)
|
if (change.Index == Models.ChangeState.Renamed)
|
||||||
new Commands.Checkout(_repo.FullPath).FileWithRevision(change.OriginalPath, $"{_commit.SHA}~1");
|
new Commands.Checkout(_repo.FullPath).Use(log).FileWithRevision(change.OriginalPath, $"{_commit.SHA}~1");
|
||||||
|
|
||||||
new Commands.Checkout(_repo.FullPath).FileWithRevision(change.Path, $"{_commit.SHA}~1");
|
new Commands.Checkout(_repo.FullPath).Use(log).FileWithRevision(change.Path, $"{_commit.SHA}~1");
|
||||||
|
log.Complete();
|
||||||
ev.Handled = true;
|
ev.Handled = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -530,7 +534,9 @@ namespace SourceGit.ViewModels
|
||||||
resetToThisRevision.IsEnabled = File.Exists(fullPath);
|
resetToThisRevision.IsEnabled = File.Exists(fullPath);
|
||||||
resetToThisRevision.Click += (_, ev) =>
|
resetToThisRevision.Click += (_, ev) =>
|
||||||
{
|
{
|
||||||
new Commands.Checkout(_repo.FullPath).FileWithRevision(file.Path, $"{_commit.SHA}");
|
var log = _repo.CreateLog($"Reset File to '{_commit.SHA}'");
|
||||||
|
new Commands.Checkout(_repo.FullPath).Use(log).FileWithRevision(file.Path, $"{_commit.SHA}");
|
||||||
|
log.Complete();
|
||||||
ev.Handled = true;
|
ev.Handled = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -542,7 +548,9 @@ namespace SourceGit.ViewModels
|
||||||
resetToFirstParent.IsEnabled = _commit.Parents.Count > 0 && fileIndex != Models.ChangeState.Renamed;
|
resetToFirstParent.IsEnabled = _commit.Parents.Count > 0 && fileIndex != Models.ChangeState.Renamed;
|
||||||
resetToFirstParent.Click += (_, ev) =>
|
resetToFirstParent.Click += (_, ev) =>
|
||||||
{
|
{
|
||||||
new Commands.Checkout(_repo.FullPath).FileWithRevision(file.Path, $"{_commit.SHA}~1");
|
var log = _repo.CreateLog($"Reset File to '{_commit.SHA}~1'");
|
||||||
|
new Commands.Checkout(_repo.FullPath).Use(log).FileWithRevision(file.Path, $"{_commit.SHA}~1");
|
||||||
|
log.Complete();
|
||||||
ev.Handled = true;
|
ev.Handled = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -737,10 +745,12 @@ namespace SourceGit.ViewModels
|
||||||
{
|
{
|
||||||
lfsLock.Click += async (_, e) =>
|
lfsLock.Click += async (_, e) =>
|
||||||
{
|
{
|
||||||
var succ = await Task.Run(() => new Commands.LFS(_repo.FullPath).Lock(_repo.Remotes[0].Name, path));
|
var log = _repo.CreateLog("Lock LFS file");
|
||||||
|
var succ = await Task.Run(() => new Commands.LFS(_repo.FullPath).Lock(_repo.Remotes[0].Name, path, log));
|
||||||
if (succ)
|
if (succ)
|
||||||
App.SendNotification(_repo.FullPath, $"Lock file \"{path}\" successfully!");
|
App.SendNotification(_repo.FullPath, $"Lock file \"{path}\" successfully!");
|
||||||
|
|
||||||
|
log.Complete();
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -753,10 +763,12 @@ namespace SourceGit.ViewModels
|
||||||
lockRemote.Header = remoteName;
|
lockRemote.Header = remoteName;
|
||||||
lockRemote.Click += async (_, e) =>
|
lockRemote.Click += async (_, e) =>
|
||||||
{
|
{
|
||||||
var succ = await Task.Run(() => new Commands.LFS(_repo.FullPath).Lock(remoteName, path));
|
var log = _repo.CreateLog("Lock LFS file");
|
||||||
|
var succ = await Task.Run(() => new Commands.LFS(_repo.FullPath).Lock(remoteName, path, log));
|
||||||
if (succ)
|
if (succ)
|
||||||
App.SendNotification(_repo.FullPath, $"Lock file \"{path}\" successfully!");
|
App.SendNotification(_repo.FullPath, $"Lock file \"{path}\" successfully!");
|
||||||
|
|
||||||
|
log.Complete();
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
};
|
};
|
||||||
lfsLock.Items.Add(lockRemote);
|
lfsLock.Items.Add(lockRemote);
|
||||||
|
@ -772,10 +784,12 @@ namespace SourceGit.ViewModels
|
||||||
{
|
{
|
||||||
lfsUnlock.Click += async (_, e) =>
|
lfsUnlock.Click += async (_, e) =>
|
||||||
{
|
{
|
||||||
var succ = await Task.Run(() => new Commands.LFS(_repo.FullPath).Unlock(_repo.Remotes[0].Name, path, false));
|
var log = _repo.CreateLog("Unlock LFS file");
|
||||||
|
var succ = await Task.Run(() => new Commands.LFS(_repo.FullPath).Unlock(_repo.Remotes[0].Name, path, false, log));
|
||||||
if (succ)
|
if (succ)
|
||||||
App.SendNotification(_repo.FullPath, $"Unlock file \"{path}\" successfully!");
|
App.SendNotification(_repo.FullPath, $"Unlock file \"{path}\" successfully!");
|
||||||
|
|
||||||
|
log.Complete();
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -788,10 +802,12 @@ namespace SourceGit.ViewModels
|
||||||
unlockRemote.Header = remoteName;
|
unlockRemote.Header = remoteName;
|
||||||
unlockRemote.Click += async (_, e) =>
|
unlockRemote.Click += async (_, e) =>
|
||||||
{
|
{
|
||||||
var succ = await Task.Run(() => new Commands.LFS(_repo.FullPath).Unlock(remoteName, path, false));
|
var log = _repo.CreateLog("Unlock LFS file");
|
||||||
|
var succ = await Task.Run(() => new Commands.LFS(_repo.FullPath).Unlock(remoteName, path, false, log));
|
||||||
if (succ)
|
if (succ)
|
||||||
App.SendNotification(_repo.FullPath, $"Unlock file \"{path}\" successfully!");
|
App.SendNotification(_repo.FullPath, $"Unlock file \"{path}\" successfully!");
|
||||||
|
|
||||||
|
log.Complete();
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
};
|
};
|
||||||
lfsUnlock.Items.Add(unlockRemote);
|
lfsUnlock.Items.Add(unlockRemote);
|
||||||
|
|
|
@ -297,12 +297,14 @@ namespace SourceGit.ViewModels
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var options = new FolderPickerOpenOptions() { AllowMultiple = false };
|
var options = new FolderPickerOpenOptions() { AllowMultiple = false };
|
||||||
|
var log = null as CommandLog;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var picker = await storageProvider.OpenFolderPickerAsync(options);
|
var picker = await storageProvider.OpenFolderPickerAsync(options);
|
||||||
if (picker.Count == 1)
|
if (picker.Count == 1)
|
||||||
{
|
{
|
||||||
var log = _repo.CreateLog("Save as Patch");
|
log = _repo.CreateLog("Save as Patch");
|
||||||
|
|
||||||
var succ = false;
|
var succ = false;
|
||||||
for (var i = 0; i < selected.Count; i++)
|
for (var i = 0; i < selected.Count; i++)
|
||||||
{
|
{
|
||||||
|
@ -314,8 +316,6 @@ namespace SourceGit.ViewModels
|
||||||
|
|
||||||
if (succ)
|
if (succ)
|
||||||
App.SendNotification(_repo.FullPath, App.Text("SaveAsPatchSuccess"));
|
App.SendNotification(_repo.FullPath, App.Text("SaveAsPatchSuccess"));
|
||||||
|
|
||||||
log.Complete();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
|
@ -323,6 +323,7 @@ namespace SourceGit.ViewModels
|
||||||
App.RaiseException(_repo.FullPath, $"Failed to save as patch: {exception.Message}");
|
App.RaiseException(_repo.FullPath, $"Failed to save as patch: {exception.Message}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log?.Complete();
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
};
|
};
|
||||||
multipleMenu.Items.Add(saveToPatchMultiple);
|
multipleMenu.Items.Add(saveToPatchMultiple);
|
||||||
|
@ -658,13 +659,16 @@ namespace SourceGit.ViewModels
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var options = new FolderPickerOpenOptions() { AllowMultiple = false };
|
var options = new FolderPickerOpenOptions() { AllowMultiple = false };
|
||||||
|
var log = null as CommandLog;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var selected = await storageProvider.OpenFolderPickerAsync(options);
|
var selected = await storageProvider.OpenFolderPickerAsync(options);
|
||||||
if (selected.Count == 1)
|
if (selected.Count == 1)
|
||||||
{
|
{
|
||||||
|
log = _repo.CreateLog("Save as Patch");
|
||||||
|
|
||||||
var saveTo = GetPatchFileName(selected[0].Path.LocalPath, commit);
|
var saveTo = GetPatchFileName(selected[0].Path.LocalPath, commit);
|
||||||
var succ = new Commands.FormatPatch(_repo.FullPath, commit.SHA, saveTo).Exec();
|
var succ = new Commands.FormatPatch(_repo.FullPath, commit.SHA, saveTo).Use(log).Exec();
|
||||||
if (succ)
|
if (succ)
|
||||||
App.SendNotification(_repo.FullPath, App.Text("SaveAsPatchSuccess"));
|
App.SendNotification(_repo.FullPath, App.Text("SaveAsPatchSuccess"));
|
||||||
}
|
}
|
||||||
|
@ -674,6 +678,7 @@ namespace SourceGit.ViewModels
|
||||||
App.RaiseException(_repo.FullPath, $"Failed to save as patch: {exception.Message}");
|
App.RaiseException(_repo.FullPath, $"Failed to save as patch: {exception.Message}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log?.Complete();
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
};
|
};
|
||||||
menu.Items.Add(saveToPatch);
|
menu.Items.Add(saveToPatch);
|
||||||
|
|
|
@ -174,12 +174,14 @@ namespace SourceGit.ViewModels
|
||||||
}
|
}
|
||||||
File.WriteAllText(saveFile, JsonSerializer.Serialize(collection, JsonCodeGen.Default.InteractiveRebaseJobCollection));
|
File.WriteAllText(saveFile, JsonSerializer.Serialize(collection, JsonCodeGen.Default.InteractiveRebaseJobCollection));
|
||||||
|
|
||||||
|
var log = _repo.CreateLog("Interactive Rebase");
|
||||||
return Task.Run(() =>
|
return Task.Run(() =>
|
||||||
{
|
{
|
||||||
var succ = new Commands.InteractiveRebase(_repo.FullPath, On.SHA).Exec();
|
var succ = new Commands.InteractiveRebase(_repo.FullPath, On.SHA).Use(log).Exec();
|
||||||
if (succ)
|
if (succ)
|
||||||
File.Delete(saveFile);
|
File.Delete(saveFile);
|
||||||
|
|
||||||
|
log.Complete();
|
||||||
Dispatcher.UIThread.Invoke(() => _repo.SetWatcherEnabled(true));
|
Dispatcher.UIThread.Invoke(() => _repo.SetWatcherEnabled(true));
|
||||||
return succ;
|
return succ;
|
||||||
});
|
});
|
||||||
|
|
|
@ -37,17 +37,17 @@ namespace SourceGit.ViewModels
|
||||||
private set => SetProperty(ref _visibleLocks, value);
|
private set => SetProperty(ref _visibleLocks, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public LFSLocks(string repo, string remote)
|
public LFSLocks(Repository repo, string remote)
|
||||||
{
|
{
|
||||||
_repo = repo;
|
_repo = repo;
|
||||||
_remote = remote;
|
_remote = remote;
|
||||||
_userName = new Commands.Config(repo).Get("user.name");
|
_userName = new Commands.Config(repo.FullPath).Get("user.name");
|
||||||
|
|
||||||
HasValidUserName = !string.IsNullOrEmpty(_userName);
|
HasValidUserName = !string.IsNullOrEmpty(_userName);
|
||||||
|
|
||||||
Task.Run(() =>
|
Task.Run(() =>
|
||||||
{
|
{
|
||||||
_cachedLocks = new Commands.LFS(_repo).Locks(_remote);
|
_cachedLocks = new Commands.LFS(_repo.FullPath).Locks(_remote);
|
||||||
Dispatcher.UIThread.Invoke(() =>
|
Dispatcher.UIThread.Invoke(() =>
|
||||||
{
|
{
|
||||||
UpdateVisibleLocks();
|
UpdateVisibleLocks();
|
||||||
|
@ -62,9 +62,13 @@ namespace SourceGit.ViewModels
|
||||||
return;
|
return;
|
||||||
|
|
||||||
IsLoading = true;
|
IsLoading = true;
|
||||||
|
|
||||||
|
var log = _repo.CreateLog("Unlock LFS File");
|
||||||
Task.Run(() =>
|
Task.Run(() =>
|
||||||
{
|
{
|
||||||
var succ = new Commands.LFS(_repo).Unlock(_remote, lfsLock.ID, force);
|
var succ = new Commands.LFS(_repo.FullPath).Unlock(_remote, lfsLock.ID, force, log);
|
||||||
|
log.Complete();
|
||||||
|
|
||||||
Dispatcher.UIThread.Invoke(() =>
|
Dispatcher.UIThread.Invoke(() =>
|
||||||
{
|
{
|
||||||
if (succ)
|
if (succ)
|
||||||
|
@ -99,7 +103,7 @@ namespace SourceGit.ViewModels
|
||||||
VisibleLocks = visible;
|
VisibleLocks = visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
private string _repo;
|
private Repository _repo;
|
||||||
private string _remote;
|
private string _remote;
|
||||||
private bool _isLoading = true;
|
private bool _isLoading = true;
|
||||||
private List<Models.LFSLock> _cachedLocks = [];
|
private List<Models.LFSLock> _cachedLocks = [];
|
||||||
|
|
|
@ -1405,7 +1405,7 @@ namespace SourceGit.ViewModels
|
||||||
{
|
{
|
||||||
locks.Click += (_, e) =>
|
locks.Click += (_, e) =>
|
||||||
{
|
{
|
||||||
var dialog = new Views.LFSLocks() { DataContext = new LFSLocks(_fullpath, _remotes[0].Name) };
|
var dialog = new Views.LFSLocks() { DataContext = new LFSLocks(this, _remotes[0].Name) };
|
||||||
App.OpenDialog(dialog);
|
App.OpenDialog(dialog);
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
};
|
};
|
||||||
|
@ -1419,7 +1419,7 @@ namespace SourceGit.ViewModels
|
||||||
lockRemote.Header = remoteName;
|
lockRemote.Header = remoteName;
|
||||||
lockRemote.Click += (_, e) =>
|
lockRemote.Click += (_, e) =>
|
||||||
{
|
{
|
||||||
var dialog = new Views.LFSLocks() { DataContext = new LFSLocks(_fullpath, remoteName) };
|
var dialog = new Views.LFSLocks() { DataContext = new LFSLocks(this, remoteName) };
|
||||||
App.OpenDialog(dialog);
|
App.OpenDialog(dialog);
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
};
|
};
|
||||||
|
@ -1437,10 +1437,12 @@ namespace SourceGit.ViewModels
|
||||||
install.Icon = App.CreateMenuIcon("Icons.Init");
|
install.Icon = App.CreateMenuIcon("Icons.Init");
|
||||||
install.Click += (_, e) =>
|
install.Click += (_, e) =>
|
||||||
{
|
{
|
||||||
var succ = new Commands.LFS(_fullpath).Install();
|
var log = CreateLog("Install LFS");
|
||||||
|
var succ = new Commands.LFS(_fullpath).Install(log);
|
||||||
if (succ)
|
if (succ)
|
||||||
App.SendNotification(_fullpath, $"LFS enabled successfully!");
|
App.SendNotification(_fullpath, $"LFS enabled successfully!");
|
||||||
|
|
||||||
|
log.Complete();
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
};
|
};
|
||||||
menu.Items.Add(install);
|
menu.Items.Add(install);
|
||||||
|
@ -2249,9 +2251,11 @@ namespace SourceGit.ViewModels
|
||||||
unlock.Click += (_, ev) =>
|
unlock.Click += (_, ev) =>
|
||||||
{
|
{
|
||||||
SetWatcherEnabled(false);
|
SetWatcherEnabled(false);
|
||||||
var succ = new Commands.Worktree(_fullpath).Unlock(worktree.FullPath);
|
var log = CreateLog("Unlock Worktree");
|
||||||
|
var succ = new Commands.Worktree(_fullpath).Use(log).Unlock(worktree.FullPath);
|
||||||
if (succ)
|
if (succ)
|
||||||
worktree.IsLocked = false;
|
worktree.IsLocked = false;
|
||||||
|
log.Complete();
|
||||||
SetWatcherEnabled(true);
|
SetWatcherEnabled(true);
|
||||||
ev.Handled = true;
|
ev.Handled = true;
|
||||||
};
|
};
|
||||||
|
@ -2265,9 +2269,11 @@ namespace SourceGit.ViewModels
|
||||||
loc.Click += (_, ev) =>
|
loc.Click += (_, ev) =>
|
||||||
{
|
{
|
||||||
SetWatcherEnabled(false);
|
SetWatcherEnabled(false);
|
||||||
var succ = new Commands.Worktree(_fullpath).Lock(worktree.FullPath);
|
var log = CreateLog("Lock Worktree");
|
||||||
|
var succ = new Commands.Worktree(_fullpath).Use(log).Lock(worktree.FullPath);
|
||||||
if (succ)
|
if (succ)
|
||||||
worktree.IsLocked = true;
|
worktree.IsLocked = true;
|
||||||
|
log.Complete();
|
||||||
SetWatcherEnabled(true);
|
SetWatcherEnabled(true);
|
||||||
ev.Handled = true;
|
ev.Handled = true;
|
||||||
};
|
};
|
||||||
|
|
|
@ -238,7 +238,9 @@ namespace SourceGit.ViewModels
|
||||||
resetToThisRevision.Icon = App.CreateMenuIcon("Icons.File.Checkout");
|
resetToThisRevision.Icon = App.CreateMenuIcon("Icons.File.Checkout");
|
||||||
resetToThisRevision.Click += (_, ev) =>
|
resetToThisRevision.Click += (_, ev) =>
|
||||||
{
|
{
|
||||||
new Commands.Checkout(_repo.FullPath).FileWithRevision(change.Path, $"{_selectedStash.SHA}");
|
var log = _repo.CreateLog($"Reset File to '{_selectedStash.SHA}'");
|
||||||
|
new Commands.Checkout(_repo.FullPath).Use(log).FileWithRevision(change.Path, $"{_selectedStash.SHA}");
|
||||||
|
log.Complete();
|
||||||
ev.Handled = true;
|
ev.Handled = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -325,7 +325,7 @@ namespace SourceGit.ViewModels
|
||||||
{
|
{
|
||||||
App.OpenDialog(new Views.AssumeUnchangedManager()
|
App.OpenDialog(new Views.AssumeUnchangedManager()
|
||||||
{
|
{
|
||||||
DataContext = new AssumeUnchangedManager(_repo.FullPath)
|
DataContext = new AssumeUnchangedManager(_repo)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -377,6 +377,7 @@ namespace SourceGit.ViewModels
|
||||||
|
|
||||||
var files = new List<string>();
|
var files = new List<string>();
|
||||||
var needStage = new List<string>();
|
var needStage = new List<string>();
|
||||||
|
var log = _repo.CreateLog("Use Theirs");
|
||||||
|
|
||||||
foreach (var change in changes)
|
foreach (var change in changes)
|
||||||
{
|
{
|
||||||
|
@ -399,14 +400,15 @@ namespace SourceGit.ViewModels
|
||||||
|
|
||||||
if (files.Count > 0)
|
if (files.Count > 0)
|
||||||
{
|
{
|
||||||
var succ = await Task.Run(() => new Commands.Checkout(_repo.FullPath).UseTheirs(files));
|
var succ = await Task.Run(() => new Commands.Checkout(_repo.FullPath).Use(log).UseTheirs(files));
|
||||||
if (succ)
|
if (succ)
|
||||||
needStage.AddRange(files);
|
needStage.AddRange(files);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (needStage.Count > 0)
|
if (needStage.Count > 0)
|
||||||
await Task.Run(() => new Commands.Add(_repo.FullPath, needStage).Exec());
|
await Task.Run(() => new Commands.Add(_repo.FullPath, needStage).Use(log).Exec());
|
||||||
|
|
||||||
|
log.Complete();
|
||||||
_repo.MarkWorkingCopyDirtyManually();
|
_repo.MarkWorkingCopyDirtyManually();
|
||||||
_repo.SetWatcherEnabled(true);
|
_repo.SetWatcherEnabled(true);
|
||||||
}
|
}
|
||||||
|
@ -417,6 +419,7 @@ namespace SourceGit.ViewModels
|
||||||
|
|
||||||
var files = new List<string>();
|
var files = new List<string>();
|
||||||
var needStage = new List<string>();
|
var needStage = new List<string>();
|
||||||
|
var log = _repo.CreateLog("Use Mine");
|
||||||
|
|
||||||
foreach (var change in changes)
|
foreach (var change in changes)
|
||||||
{
|
{
|
||||||
|
@ -439,14 +442,15 @@ namespace SourceGit.ViewModels
|
||||||
|
|
||||||
if (files.Count > 0)
|
if (files.Count > 0)
|
||||||
{
|
{
|
||||||
var succ = await Task.Run(() => new Commands.Checkout(_repo.FullPath).UseMine(files));
|
var succ = await Task.Run(() => new Commands.Checkout(_repo.FullPath).Use(log).UseMine(files));
|
||||||
if (succ)
|
if (succ)
|
||||||
needStage.AddRange(files);
|
needStage.AddRange(files);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (needStage.Count > 0)
|
if (needStage.Count > 0)
|
||||||
await Task.Run(() => new Commands.Add(_repo.FullPath, needStage).Exec());
|
await Task.Run(() => new Commands.Add(_repo.FullPath, needStage).Use(log).Exec());
|
||||||
|
|
||||||
|
log.Complete();
|
||||||
_repo.MarkWorkingCopyDirtyManually();
|
_repo.MarkWorkingCopyDirtyManually();
|
||||||
_repo.SetWatcherEnabled(true);
|
_repo.SetWatcherEnabled(true);
|
||||||
}
|
}
|
||||||
|
@ -845,10 +849,12 @@ namespace SourceGit.ViewModels
|
||||||
{
|
{
|
||||||
lfsLock.Click += async (_, e) =>
|
lfsLock.Click += async (_, e) =>
|
||||||
{
|
{
|
||||||
var succ = await Task.Run(() => new Commands.LFS(_repo.FullPath).Lock(_repo.Remotes[0].Name, change.Path));
|
var log = _repo.CreateLog("Lock LFS File");
|
||||||
|
var succ = await Task.Run(() => new Commands.LFS(_repo.FullPath).Lock(_repo.Remotes[0].Name, change.Path, log));
|
||||||
if (succ)
|
if (succ)
|
||||||
App.SendNotification(_repo.FullPath, $"Lock file \"{change.Path}\" successfully!");
|
App.SendNotification(_repo.FullPath, $"Lock file \"{change.Path}\" successfully!");
|
||||||
|
|
||||||
|
log.Complete();
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -861,10 +867,12 @@ namespace SourceGit.ViewModels
|
||||||
lockRemote.Header = remoteName;
|
lockRemote.Header = remoteName;
|
||||||
lockRemote.Click += async (_, e) =>
|
lockRemote.Click += async (_, e) =>
|
||||||
{
|
{
|
||||||
var succ = await Task.Run(() => new Commands.LFS(_repo.FullPath).Lock(remoteName, change.Path));
|
var log = _repo.CreateLog("Lock LFS File");
|
||||||
|
var succ = await Task.Run(() => new Commands.LFS(_repo.FullPath).Lock(remoteName, change.Path, log));
|
||||||
if (succ)
|
if (succ)
|
||||||
App.SendNotification(_repo.FullPath, $"Lock file \"{change.Path}\" successfully!");
|
App.SendNotification(_repo.FullPath, $"Lock file \"{change.Path}\" successfully!");
|
||||||
|
|
||||||
|
log.Complete();
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
};
|
};
|
||||||
lfsLock.Items.Add(lockRemote);
|
lfsLock.Items.Add(lockRemote);
|
||||||
|
@ -880,10 +888,12 @@ namespace SourceGit.ViewModels
|
||||||
{
|
{
|
||||||
lfsUnlock.Click += async (_, e) =>
|
lfsUnlock.Click += async (_, e) =>
|
||||||
{
|
{
|
||||||
var succ = await Task.Run(() => new Commands.LFS(_repo.FullPath).Unlock(_repo.Remotes[0].Name, change.Path, false));
|
var log = _repo.CreateLog("Unlock LFS File");
|
||||||
|
var succ = await Task.Run(() => new Commands.LFS(_repo.FullPath).Unlock(_repo.Remotes[0].Name, change.Path, false, log));
|
||||||
if (succ)
|
if (succ)
|
||||||
App.SendNotification(_repo.FullPath, $"Unlock file \"{change.Path}\" successfully!");
|
App.SendNotification(_repo.FullPath, $"Unlock file \"{change.Path}\" successfully!");
|
||||||
|
|
||||||
|
log.Complete();
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -896,10 +906,12 @@ namespace SourceGit.ViewModels
|
||||||
unlockRemote.Header = remoteName;
|
unlockRemote.Header = remoteName;
|
||||||
unlockRemote.Click += async (_, e) =>
|
unlockRemote.Click += async (_, e) =>
|
||||||
{
|
{
|
||||||
var succ = await Task.Run(() => new Commands.LFS(_repo.FullPath).Unlock(remoteName, change.Path, false));
|
var log = _repo.CreateLog("Unlock LFS File");
|
||||||
|
var succ = await Task.Run(() => new Commands.LFS(_repo.FullPath).Unlock(remoteName, change.Path, false, log));
|
||||||
if (succ)
|
if (succ)
|
||||||
App.SendNotification(_repo.FullPath, $"Unlock file \"{change.Path}\" successfully!");
|
App.SendNotification(_repo.FullPath, $"Unlock file \"{change.Path}\" successfully!");
|
||||||
|
|
||||||
|
log.Complete();
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
};
|
};
|
||||||
lfsUnlock.Items.Add(unlockRemote);
|
lfsUnlock.Items.Add(unlockRemote);
|
||||||
|
@ -1211,10 +1223,12 @@ namespace SourceGit.ViewModels
|
||||||
{
|
{
|
||||||
lfsLock.Click += async (_, e) =>
|
lfsLock.Click += async (_, e) =>
|
||||||
{
|
{
|
||||||
var succ = await Task.Run(() => new Commands.LFS(_repo.FullPath).Lock(_repo.Remotes[0].Name, change.Path));
|
var log = _repo.CreateLog("Lock LFS File");
|
||||||
|
var succ = await Task.Run(() => new Commands.LFS(_repo.FullPath).Lock(_repo.Remotes[0].Name, change.Path, log));
|
||||||
if (succ)
|
if (succ)
|
||||||
App.SendNotification(_repo.FullPath, $"Lock file \"{change.Path}\" successfully!");
|
App.SendNotification(_repo.FullPath, $"Lock file \"{change.Path}\" successfully!");
|
||||||
|
|
||||||
|
log.Complete();
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1227,10 +1241,12 @@ namespace SourceGit.ViewModels
|
||||||
lockRemote.Header = remoteName;
|
lockRemote.Header = remoteName;
|
||||||
lockRemote.Click += async (_, e) =>
|
lockRemote.Click += async (_, e) =>
|
||||||
{
|
{
|
||||||
var succ = await Task.Run(() => new Commands.LFS(_repo.FullPath).Lock(remoteName, change.Path));
|
var log = _repo.CreateLog("Lock LFS File");
|
||||||
|
var succ = await Task.Run(() => new Commands.LFS(_repo.FullPath).Lock(remoteName, change.Path, log));
|
||||||
if (succ)
|
if (succ)
|
||||||
App.SendNotification(_repo.FullPath, $"Lock file \"{change.Path}\" successfully!");
|
App.SendNotification(_repo.FullPath, $"Lock file \"{change.Path}\" successfully!");
|
||||||
|
|
||||||
|
log.Complete();
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
};
|
};
|
||||||
lfsLock.Items.Add(lockRemote);
|
lfsLock.Items.Add(lockRemote);
|
||||||
|
@ -1246,10 +1262,12 @@ namespace SourceGit.ViewModels
|
||||||
{
|
{
|
||||||
lfsUnlock.Click += async (_, e) =>
|
lfsUnlock.Click += async (_, e) =>
|
||||||
{
|
{
|
||||||
var succ = await Task.Run(() => new Commands.LFS(_repo.FullPath).Unlock(_repo.Remotes[0].Name, change.Path, false));
|
var log = _repo.CreateLog("Unlock LFS File");
|
||||||
|
var succ = await Task.Run(() => new Commands.LFS(_repo.FullPath).Unlock(_repo.Remotes[0].Name, change.Path, false, log));
|
||||||
if (succ)
|
if (succ)
|
||||||
App.SendNotification(_repo.FullPath, $"Unlock file \"{change.Path}\" successfully!");
|
App.SendNotification(_repo.FullPath, $"Unlock file \"{change.Path}\" successfully!");
|
||||||
|
|
||||||
|
log.Complete();
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1262,10 +1280,12 @@ namespace SourceGit.ViewModels
|
||||||
unlockRemote.Header = remoteName;
|
unlockRemote.Header = remoteName;
|
||||||
unlockRemote.Click += async (_, e) =>
|
unlockRemote.Click += async (_, e) =>
|
||||||
{
|
{
|
||||||
var succ = await Task.Run(() => new Commands.LFS(_repo.FullPath).Unlock(remoteName, change.Path, false));
|
var log = _repo.CreateLog("Unlock LFS File");
|
||||||
|
var succ = await Task.Run(() => new Commands.LFS(_repo.FullPath).Unlock(remoteName, change.Path, false, log));
|
||||||
if (succ)
|
if (succ)
|
||||||
App.SendNotification(_repo.FullPath, $"Unlock file \"{change.Path}\" successfully!");
|
App.SendNotification(_repo.FullPath, $"Unlock file \"{change.Path}\" successfully!");
|
||||||
|
|
||||||
|
log.Complete();
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
};
|
};
|
||||||
lfsUnlock.Items.Add(unlockRemote);
|
lfsUnlock.Items.Add(unlockRemote);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue