private void setGroupCollapsing(ProjectKey projectKey, bool collapse) { bool isCollapsed = _collapsedProjects.Contains(projectKey); if (isCollapsed == collapse) { return; } if (collapse) { _collapsedProjects.Add(projectKey); } else { _collapsedProjects.Remove(projectKey); } NativeMethods.LockWindowUpdate(Handle); int vScrollPosition = Win32Tools.GetVerticalScrollPosition(Handle); ContentChanged?.Invoke(this); Win32Tools.SetVerticalScrollPosition(Handle, vScrollPosition); NativeMethods.LockWindowUpdate(IntPtr.Zero); }
public override int GetHashCode() { unchecked { int hashCode = 0; foreach (var c in Components) { hashCode = (hashCode * 397) ^ c.GetHashCode(); } foreach (var a in Applications) { hashCode = (hashCode * 397) ^ a.GetHashCode(); } hashCode = (hashCode * 397) ^ (Url?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (Password?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (Username?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (ProjectKey?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (Name?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (Caption?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (Labels?.GetHashCode() ?? 0); return(hashCode); } }
internal void CreateGroupForProject(ProjectKey projectKey, bool isSortNeeded) { ListViewGroup group = new ListViewGroup(projectKey.ProjectName, projectKey.ProjectName) { Tag = projectKey }; updateGroupCaption(group); if (!isSortNeeded) { // user defines how to sort group here Groups.Add(group); return; } // sort groups alphabetically int indexToInsert = Groups.Count; for (int iGroup = 0; iGroup < Groups.Count; ++iGroup) { if (projectKey.ProjectName.CompareTo(Groups[iGroup].Header) < 0) { indexToInsert = iGroup; break; } } Groups.Insert(indexToInsert, group); }
internal SingleProjectAccessor(ProjectKey projectKey, IHostProperties settings, IModificationListener modificationListener) { _projectKey = projectKey; _settings = settings; _modificationListener = modificationListener; }
private bool addMissingProject(ProjectKey projectKey) { Trace.TraceInformation("[MainForm] Notify that selected project is not in the list"); if (MessageBox.Show("Selected project is not in the list of projects. Do you want to add it? " + "Selecting 'Yes' will cause reload of all projects. " + "Selecting 'No' will open the merge request at Search tab. ", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification) != DialogResult.Yes) { Trace.TraceInformation("[MainForm] User decided not to add project"); return(false); } Dictionary <string, bool> projects = ConfigurationHelper.GetProjectsForHost( projectKey.HostName, Program.Settings).ToDictionary(item => item.Item1, item => item.Item2); Debug.Assert(!projects.ContainsKey(projectKey.ProjectName)); projects.Add(projectKey.ProjectName, true); ConfigurationHelper.SetProjectsForHost(projectKey.HostName, Enumerable.Zip(projects.Keys, projects.Values, (x, y) => new Tuple <string, bool>(x, y)), Program.Settings); updateProjectsListView(); return(true); }
private static string getProjectName(ProjectKey projectKey) { string projectName = projectKey.ProjectName.Split('/').ElementAtOrDefault(1); projectName = String.IsNullOrWhiteSpace(projectName) ? "N/A" : projectName; return(projectName); }
public override int GetHashCode() { unchecked { int hashCode = 0; foreach (var c in Components) { hashCode = (hashCode * 397) ^ c.GetHashCode(); } foreach (var a in Applications) { hashCode = (hashCode * 397) ^ a.GetHashCode(); } hashCode = (hashCode * 397) ^ (Url != null ? Url.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Password != null ? Password.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Username != null ? Username.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ProjectKey != null ? ProjectKey.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Name != null ? Name.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Caption != null ? Caption.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Labels != null ? Labels.GetHashCode() : 0); return(hashCode); } }
internal RepositoryAccessor(IHostProperties settings, ProjectKey projectKey, INetworkOperationStatusListener networkOperationStatusListener) { _settings = settings; _projectKey = projectKey; _networkOperationStatusListener = networkOperationStatusListener; }
internal ProjectUtil(ProjectKey key, XDocument document) { _key = key; _document = document; _manager = new XmlNamespaceManager(new NameTable()); _manager.AddNamespace("mb", SharedUtil.MSBuildNamespaceUriRaw); }
public Task <bool> WriteStreamAsync( ProjectKey projectKey, string name, Stream stream, Checksum checksum, CancellationToken cancellationToken ) => SpecializedTasks.False;
internal ProjectData(string filePath) { Key = new ProjectKey(filePath); FilePath = Key.FilePath; Document = XDocument.Load(FilePath); ProjectUtil = new ProjectUtil(Key, Document); }
internal MergeRequestAccessor(IHostProperties settings, ProjectKey projectKey, IModificationListener modificationListener) { _settings = settings; _projectKey = projectKey; _modificationListener = modificationListener; }
internal MergeRequestCreator(ProjectKey projectKey, IHostProperties hostProperties, INetworkOperationStatusListener networkOperationStatusListener) { _projectKey = projectKey; _hostProperties = hostProperties; _networkOperationStatusListener = networkOperationStatusListener; }
private static bool findRepositoryAtDisk(string parentFolder, ProjectKey projectKey, LocalCommitStorageType type, out string repositoryPath) { string[] childFolders = Directory.GetDirectories(parentFolder); foreach (string childFolder in childFolders) { repositoryPath = Path.Combine(parentFolder, childFolder); ProjectKey?projectAtPath = getRepositoryProjectKey(repositoryPath, type); if (projectAtPath == null) { Trace.TraceWarning(String.Format( "[LocalGitCommitStoragePathFinder] Path \"{0}\" is not a valid git repository", repositoryPath)); continue; } if (projectAtPath.Value.Equals(projectKey)) { Trace.TraceInformation(String.Format( "[LocalGitCommitStoragePathFinder] Found repository at \"{0}\"", repositoryPath)); return(true); } } repositoryPath = String.Empty; return(false); }
private void createNewMergeRequest(string hostname, User currentUser, NewMergeRequestProperties initialProperties, IEnumerable <Project> fullProjectList, IEnumerable <User> fullUserList) { DataCache dataCache = getDataCache(EDataCacheType.Live); var sourceBranchesInUse = GitLabClient.Helpers.GetSourceBranchesByUser(getCurrentUser(), dataCache); MergeRequestPropertiesForm form = new NewMergeRequestForm(hostname, _shortcuts.GetProjectAccessor(), currentUser, initialProperties, fullProjectList, fullUserList, sourceBranchesInUse, _expressionResolver.Resolve(Program.ServiceManager.GetSourceBranchTemplate())); if (form.ShowDialog() != DialogResult.OK) { Trace.TraceInformation("[MainForm] User declined to create a merge request"); return; } BeginInvoke(new Action( async() => { ProjectKey projectKey = new ProjectKey(hostname, form.ProjectName); SubmitNewMergeRequestParameters parameters = new SubmitNewMergeRequestParameters( projectKey, form.SourceBranch, form.TargetBranch, form.Title, form.AssigneeUsername, form.Description, form.DeleteSourceBranch, form.Squash, form.IsHighPriority); await createNewMergeRequestAsync(parameters, form.SpecialNote); })); }
private static bool isProjectInTheList(ProjectKey projectKey) { IEnumerable <Tuple <string, bool> > projects = ConfigurationHelper.GetProjectsForHost(projectKey.HostName, Program.Settings); return(projects.Any(x => projectKey.MatchProject(x.Item1))); }
// TODO public void Init(bool createOnly, string instance, string projectId, string projectKey, bool isReadonly) { CreateOnly = createOnly; Instance = instance; ProjectId = projectId; if (!string.IsNullOrEmpty(projectKey)) { ProjectKey = new ProjectKey(projectKey, isReadonly); } if (CreateOnly && ProjectKey == null) { var id = _randomGenerator.GetId(); ProjectKey = new ProjectKey(id); } if (CreateOnly && string.IsNullOrEmpty(ProjectKey.Key)) { var id = _randomGenerator.GetId(); ProjectKey.Key = id; } if (ProjectKey != null) { ProjectKey.IsReadonly = isReadonly; } }
public ParsedNewMergeRequestUrl(ProjectKey projectKey, string sourceBranch, IEnumerable <string> targetBranchCandidates) { ProjectKey = projectKey; SourceBranch = sourceBranch; TargetBranchCandidates = targetBranchCandidates; }
// @} IGitRepository /// <summary> /// Construct GitRepository with a path that either does not exist or it is empty /// or points to a valid git repository /// Throws ArgumentException if requirements on `path` argument are not met /// </summary> internal GitRepository(string parentFolder, ProjectKey projectKey, ISynchronizeInvoke synchronizeInvoke, LocalCommitStorageType type, Action <IGitRepository> onClonedRepo) { Path = LocalCommitStoragePathFinder.FindPath(parentFolder, projectKey, type); if (!GitTools.IsSingleCommitFetchSupported(Path)) //-V3022 { throw new ArgumentException("Cannot work with such repositories"); } bool isShallowCloneAllowed = type == LocalCommitStorageType.ShallowGitRepository; UpdateMode mode = isShallowCloneAllowed ? UpdateMode.ShallowClone : UpdateMode.FullCloneWithSingleCommitFetches; // PathFinder must guarantee the following Debug.Assert(isEmptyFolder(Path) || (GitTools.GetRepositoryProjectKey(Path).HasValue && GitTools.GetRepositoryProjectKey(Path).Value.Equals(projectKey))); _processManager = new GitProcessManager(synchronizeInvoke, Path); _updater = new GitRepositoryUpdater(synchronizeInvoke, this, _processManager, mode, onCloned, onFetched); _onClonedRepo = onClonedRepo; _commandService = new NativeGitCommandService(_processManager, Path); ExpectingClone = isEmptyFolder(Path); ProjectKey = projectKey; Trace.TraceInformation(String.Format( "[GitRepository] Created GitRepository at Path {0} for host {1} and project {2}, " + "expecting clone = {3}", Path, ProjectKey.HostName, ProjectKey.ProjectName, ExpectingClone.ToString())); }
public abstract Task <bool> WriteStreamAsync( ProjectKey projectKey, string name, Stream stream, Checksum?checksum, CancellationToken cancellationToken );
async public Task <Commit> LoadCommit(ProjectKey projectKey, string id) { return(await call( () => _operator.GetCommitAsync(projectKey.ProjectName, id), String.Format("Cancelled loading commit {0}", id), String.Format("Cannot load commit {0}", id))); }
static internal void AddProjectKey(string hostname, int projectId, ProjectKey projectKey) { if (!_projectKeys.ContainsKey(hostname)) { _projectKeys[hostname] = new Dictionary <int, ProjectKey>(); } _projectKeys[hostname][projectId] = projectKey; }
private static string getDefaultPath(ProjectKey projectKey, LocalCommitStorageType type, int index) { string projectName = projectKey.ProjectName.Replace('/', '_'); return(type == LocalCommitStorageType.FileStorage ? String.Format("fs{0:00}", index) : (index < 2 ? projectName : String.Format("{0}_{1}", projectName, index))); }
internal SingleProjectAccessor(ProjectKey projectKey, IHostProperties settings, IModificationListener modificationListener, INetworkOperationStatusListener networkOperationStatusListener) { _projectKey = projectKey; _settings = settings; _modificationListener = modificationListener; _networkOperationStatusListener = networkOperationStatusListener; }
public static string GetUploadsPrefix(ProjectKey projectKey) { if (String.IsNullOrEmpty(projectKey.HostName) || string.IsNullOrEmpty(projectKey.ProjectName)) { return(String.Empty); } return(String.Format("{0}/{1}", StringUtils.GetHostWithPrefix(projectKey.HostName), projectKey.ProjectName)); }
public override int GetHashCode() { int hashCode = -195462282; hashCode = hashCode * -1521134295 + ProjectKey.GetHashCode(); hashCode = hashCode * -1521134295 + IId.GetHashCode(); return(hashCode); }
internal MergeRequestAccessor(IHostProperties settings, ProjectKey projectKey, IModificationListener modificationListener, INetworkOperationStatusListener networkOperationStatusListener) { _settings = settings; _projectKey = projectKey; _modificationListener = modificationListener; _networkOperationStatusListener = networkOperationStatusListener; }
private IEnumerable <FullMergeRequestKey> getAllProjectItems(ProjectKey projectKey) { return(_dataCache? .MergeRequestCache? .GetMergeRequests(projectKey) .Select(mergeRequest => new FullMergeRequestKey(projectKey, mergeRequest)) ?? Array.Empty <FullMergeRequestKey>()); }
private Task <IEnumerable <MergeRequest> > loadProjectMergeRequestsAsync(ProjectKey project) { return(call( () => _operator.SearchMergeRequestsAsync( new SearchCriteria(new object[] { new SearchByProject(project.ProjectName) }), null, true), String.Format("Cancelled loading merge requests for project \"{0}\"", project.ProjectName), String.Format("Cannot load project \"{0}\"", project.ProjectName))); }
private static bool isEnabledProject(ProjectKey projectKey) { IEnumerable <Tuple <string, bool> > projects = ConfigurationHelper.GetProjectsForHost(projectKey.HostName, Program.Settings); IEnumerable <Tuple <string, bool> > enabled = projects.Where(x => projectKey.MatchProject(x.Item1)); return(enabled.Any() && enabled.First().Item2); }
protected override string GetResourcePath() { if (ProjectKey.IsNullOrEmpty() || PlanKey.IsNullOrEmpty()) { return("result"); } return($"result/{ProjectKey}-{PlanKey}"); }
protected void scheduleSingleProjectUpdate(ProjectKey projectKey) { ILocalCommitStorage repo = getRepository(projectKey); if (repo != null) { _synchronizeInvoke.BeginInvoke(new Action(async() => await updateAsync(repo)), null); } }