public ScmRemote[] GetRemotes(IGetItemArgs <ScmRemote> args) { var hgrcFilename = Path.Combine(GetRepositoryStore(args.RepositoryPath), "hgrc"); var iniData = LoadIniFile(hgrcFilename); var remotes = iniData["paths"] .Select(e => new ScmRemote { Name = e.KeyName, Url = e.Value }); remotes = remotes.Where(e => args.Key == null || args.Key.Contains(e.Name)); return(remotes.ToArray()); }
public ScmMergeTool[] GetMergeTools(IGetItemArgs <ScmMergeTool> args) { throw new NotImplementedException(); }
public ScmRemote[] GetRemotes(IGetItemArgs <ScmRemote> args) { throw new NotImplementedException(); }
public ScmMergeTool[] GetMergeTools(IGetItemArgs <ScmMergeTool> args) { var data = LoadIniFile(UserConfigFilename)["merge-tools"]; if (data == null) { return new ScmMergeTool[] { } } ; var tools = new Dictionary <string, ScmMergeTool>(); foreach (var kvp in data) { string toolName; string paramName; try { var parts = kvp.KeyName.Split('.'); toolName = parts[0]; paramName = parts[1]; } catch { continue; } ScmMergeTool tool; if (tools.ContainsKey(toolName)) { tool = tools[toolName]; } else { tool = new ScmMergeTool { Name = toolName }; tools.Add(tool.Name, tool); } const StringComparison ic = StringComparison.OrdinalIgnoreCase; if (paramName.Equals("gui", ic)) { tool.Gui = kvp.Value.Equals("true", ic); } if (paramName.Equals("premerge", ic)) { tool.Premerge = kvp.Value.Equals("true", ic); } if (paramName.Equals("executable", ic)) { tool.Filename = kvp.Value; } if (paramName.Equals("args", ic)) { tool.Arguments = kvp.Value; } if (paramName.Equals("priority", ic)) { if (int.TryParse(kvp.Value, out var v)) { tool.Priority = v; } } } return(tools.Values.InKeys(t => t.Name, args.Key).ToArray()); }