FindRepositoryRoot() public static method

public static FindRepositoryRoot ( string path ) : string
path string
return string
Example #1
0
        public static void ShowHistoryWindow(string fileName)
        {
            var root = HgPath.FindRepositoryRoot(fileName);

            if (!String.IsNullOrEmpty(root))
            {
                fileName = fileName.Substring(root.Length + 1);

                Start(String.Format("history \"{0}\"", fileName), root);
            }
        }
Example #2
0
        protected void UpdateRootStatusProtected(string path)
        {
            var root = HgPath.FindRepositoryRoot(path);

            if (String.IsNullOrEmpty(root))
            {
                return;
            }

            AddRoot(root);

            Cache(Hg.GetRootStatus(root));
        }
Example #3
0
        private static void StartForEachRoot(string command, string[] files)
        {
            var commandWithOptions = String.Concat("--nofork ", command);

            foreach (var group in files.GroupBy(x => HgPath.FindRepositoryRoot(x)))
            {
                if (String.IsNullOrEmpty(group.Key))
                {
                    continue;
                }

                Start(commandWithOptions, group.Key, group);
            }
        }
Example #4
0
        public static HgFileInfo[] RenameFiles(string[] fileNames, string[] newFileNames)
        {
            for (int i = 0; i < Math.Min(fileNames.Length, newFileNames.Length); i++)
            {
                var root = HgPath.FindRepositoryRoot(fileNames[i]);

                var oldName = HgPath.StripRoot(fileNames[i], root);
                var newName = HgPath.StripRoot(newFileNames[i], root);

                var option = StringComparer.InvariantCultureIgnoreCase.Equals(oldName, newName) ? null : " -A";

                Run(String.Format("rename {0} \"{1}\" \"{2}\"", option, oldName, newName), root);
            }

            return(GetFileInfo(fileNames.Concat(newFileNames).ToArray()));
        }
Example #5
0
        private static Dictionary <string, string[]> ProcessFiles(string command, string[] fileNames)
        {
            var rootOutput = new Dictionary <string, string[]>();

            foreach (var rootGroup in fileNames.GroupBy(x => HgPath.FindRepositoryRoot(x)))
            {
                var root   = rootGroup.Key;
                var output = new List <string>();

                foreach (var fileArgs in GetFileArguments(root, rootGroup))
                {
                    var commandOutput = Run(String.Concat(command, fileArgs), root);

                    output.AddRange(commandOutput);
                }

                rootOutput[root] = output.ToArray();
            }

            return(rootOutput);
        }