FindRepositoryRoot() public static method

public static FindRepositoryRoot ( string path ) : string
path string
return string
Beispiel #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);
            }
        }
        protected void UpdateRootStatusProtected(string path)
        {
            var root = HgPath.FindRepositoryRoot(path);

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

            AddRoot(root);

            Cache(Hg.GetRootStatus(root));
        }
Beispiel #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);
            }
        }
Beispiel #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()));
        }
Beispiel #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);
        }