private void DoCheckout(bool purge) { OperationStatusDialog.Start("Checkout"); m_AreaVM.Area.Checkout(Name, purge, false, false); m_AreaVM.RefreshBranches(); OperationStatusDialog.Finish(); }
private void Pull() { OperationStatusDialog.Start("Pull"); m_AreaVM.ExecuteClientCommand((c) => c.Pull(true, Name), "pull"); if (IsCurrent) { m_AreaVM.Area.Update(new Versionr.Area.MergeSpecialOptions()); } OperationStatusDialog.Finish(); }
private void Commit() { if (string.IsNullOrEmpty(CommitMessage)) { MainWindow.Instance.Dispatcher.Invoke(() => { MainWindow.ShowMessage("Not so fast...", "Please provide a commit message", MessageDialogStyle.Affirmative); }); return; } // Tag has been typed in but not added if (!string.IsNullOrEmpty(TagString) && CustomTags.All(x => x.Tag != TagString)) { MessageDialogResult result = MessageDialogResult.Negative; MainWindow.Instance.Dispatcher.Invoke(async() => { result = await MainWindow.ShowMessage("Missing Tag", "You seem to have a tag that has not been added. Do you want to continue without adding the tag?", MessageDialogStyle.AffirmativeAndNegative); }).Wait(); if (result == MessageDialogResult.Negative) { return; } } OperationStatusDialog.Start("Commit"); bool commitSuccessful = _areaVM.Area.Commit(CommitMessage, false, GetCommitTags()); if (commitSuccessful && PushOnCommit) { _areaVM.ExecuteClientCommand((c) => c.Push(), "push", true); } OperationStatusDialog.Finish(); CommitMessage = string.Empty; TagPresets.ForEach(x => x.IsChecked = false); MainWindow.Instance.Dispatcher.Invoke(() => CustomTags.Clear()); Refresh(); }
private void Push() { OperationStatusDialog.Start("Push"); m_AreaVM.ExecuteClientCommand((c) => c.Push(Name), "push", true); OperationStatusDialog.Finish(); }
public void Init(string path, AreaInitMode areaInitMode, string host, int port, Action <AreaVM, string, string> afterInit) { Load(() => { DirectoryInfo dir = new DirectoryInfo(path); string title = String.Empty; string message = String.Empty; switch (areaInitMode) { case AreaInitMode.Clone: OperationStatusDialog.Start("Clone"); Client client = new Client(dir); if (client.Connect(Client.ToVersionrURL(host, port, null), true)) { bool result = client.Clone(true); if (!result) { result = client.Clone(false); } if (result) { string remoteName = "default"; client.Workspace.SetRemote(Client.ToVersionrURL(client.Host, client.Port, client.Module), remoteName); client.Pull(false, client.Workspace.CurrentBranch.ID.ToString()); Area = Area.Load(client.Workspace.Root); Area.Checkout(null, false, false); } } else { title = "Clone Failed"; message = $"Couldn't connect to {host}:{port}"; } client.Close(); OperationStatusDialog.Finish(); break; case AreaInitMode.InitNew: // Tell versionr to initialize at path try { dir.Create(); } catch { title = "Init Failed"; message = $"Couldn't create subdirectory \"{dir.FullName}\""; break; } Area = Area.Init(dir, m_Name); break; case AreaInitMode.UseExisting: // Add it to settings and refresh UI, get status etc. Area = Area.Load(dir); if (Area == null) { title = "Missing workspace"; message = $"Failed to load \"{m_Name}\". The location {path} may be have been removed."; } break; } RefreshAll(); NotifyPropertyChanged(nameof(Directory)); NotifyPropertyChanged(nameof(IsValid)); NotifyPropertyChanged(nameof(Remotes)); NotifyPropertyChanged(nameof(Status)); NotifyPropertyChanged(nameof(Settings)); NotifyPropertyChanged(nameof(Branches)); MainWindow.Instance.Dispatcher.Invoke(afterInit, this, title, message); }); }