当前位置: 首页>>代码示例>>C#>>正文


C# GitCommands.GitItem类代码示例

本文整理汇总了C#中GitCommands.GitItem的典型用法代码示例。如果您正苦于以下问题:C# GitItem类的具体用法?C# GitItem怎么用?C# GitItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


GitItem类属于GitCommands命名空间,在下文中一共展示了GitItem类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateGitItemFromString

        internal static GitItem CreateGitItemFromString(GitModule aModule, string itemsString)
        {
            if ((itemsString == null) || (itemsString.Length <= MinimumStringLength))
                return null;

            var guidStart = itemsString.IndexOf(' ', 7);

            var item = new GitItem(aModule)
                           {
                               Mode = itemsString.Substring(0, 6),
                               ItemType = itemsString.Substring(7, guidStart - 7),
                               Guid = itemsString.Substring(guidStart + 1, 40),
                               Name = itemsString.Substring(guidStart + 42).Trim()
                           };

            item.FileName = item.Name;
            return item;
        }
开发者ID:Carbenium,项目名称:gitextensions,代码行数:18,代码来源:GitItem.cs

示例2: GetFileChanges

        public IList<GitItem> GetFileChanges(string file)
        {
            file = FixPath(file);
            var tree = RunGitCmd("whatchanged --all -- \"" + file + "\"");

            var itemsStrings = tree.Split('\n');

            var items = new List<GitItem>();

            GitItem item = null;
            foreach (var itemsString in itemsStrings)
            {
                if (itemsString.StartsWith("commit "))
                {
                    item = new GitItem(this) { CommitGuid = itemsString.Substring(7).Trim() };

                    items.Add(item);
                }
                else if (item == null)
                {
                    continue;
                }
                else if (itemsString.StartsWith("Author: "))
                {
                    item.Author = itemsString.Substring(7).Trim();
                }
                else if (itemsString.StartsWith("Date:   "))
                {
                    item.Date = itemsString.Substring(7).Trim();
                }
                else if (!itemsString.StartsWith(":") && !string.IsNullOrEmpty(itemsString))
                {
                    item.Name += itemsString.Trim() + Environment.NewLine;
                }
                else
                {
                    if (itemsString.Length > 32)
                        item.Guid = itemsString.Substring(26, 7);
                }
            }

            return items;
        }
开发者ID:saland,项目名称:gitextensions,代码行数:43,代码来源:GitModule.cs

示例3: GetFullPathFromGitItem

 public static string GetFullPathFromGitItem(GitModule gitModule, GitItem gitItem)
 {
     return GetFullPathFromFilename(gitModule, gitItem.FileName);
 }
开发者ID:holstebroe,项目名称:gitextensions,代码行数:4,代码来源:FormBrowseUtil.cs

示例4: GetTree

        public static List<IGitItem> GetTree(string id)
        {
            var tree = RunCachableCmd(Settings.GitCommand, "ls-tree -z \"" + id + "\"");

            var itemsStrings = tree.Split(new char[] { '\0', '\n' });

            var items = new List<IGitItem>();

            foreach (var itemsString in itemsStrings)
            {
                if (itemsString.Length <= 53)
                    continue;

                var item = new GitItem { Mode = itemsString.Substring(0, 6) };
                var guidStart = itemsString.IndexOf(' ', 7);
                item.ItemType = itemsString.Substring(7, guidStart - 7);
                item.Guid = itemsString.Substring(guidStart + 1, 40);
                item.Name = itemsString.Substring(guidStart + 42).Trim();
                item.FileName = item.Name;

                items.Add(item);
            }

            return items;
        }
开发者ID:avish,项目名称:gitextensions,代码行数:25,代码来源:GitCommandsHelper.cs

示例5: GetConflictedFiles

        public static List<GitItem> GetConflictedFiles()
        {
            string[] unmerged = RunCmd(Settings.GitCommand, "ls-files --unmerged").Split('\n');

            List<GitItem> unmergedFiles = new List<GitItem>();

            string fileName = "";
            foreach (string file in unmerged)
            {
                if (file.LastIndexOfAny(new char[] { ' ', '\t' }) > 0)
                {
                    if (file.Substring(file.LastIndexOfAny(new char[] { ' ', '\t' }) + 1) != fileName)
                    {
                        fileName = file.Substring(file.LastIndexOfAny(new char[] { ' ', '\t' }) + 1);
                        GitItem gitFile = new GitItem();
                        gitFile.FileName = fileName;

                        unmergedFiles.Add(gitFile);
                    }
                }
            }

            return unmergedFiles;
        }
开发者ID:Gitulf,项目名称:gitextensions,代码行数:24,代码来源:GitCommands.cs

示例6: GetTree

        public static List<IGitItem> GetTree(string id)
        {
            string tree = RunCachableCmd(Settings.GitCommand, "ls-tree \"" + id + "\"");

            string[] itemsStrings = tree.Split('\n');

            List<IGitItem> items = new List<IGitItem>();

            foreach (string itemsString in itemsStrings)
            {
                GitItem item = new GitItem();

                if (itemsString.Length > 53)
                {

                    item.Mode = itemsString.Substring(0, 6);
                    int guidStart = itemsString.IndexOf(' ', 7);
                    item.ItemType = itemsString.Substring(7, guidStart - 7);
                    item.Guid = itemsString.Substring(guidStart + 1, 40);
                    item.Name = itemsString.Substring(guidStart + 42).Trim();
                    item.FileName = item.Name;

                    //if (item.ItemType == "tree")
                    //    item.SubItems = GetTree(item.Guid);

                    items.Add(item);
                }
            }

            return items;
        }
开发者ID:Gitulf,项目名称:gitextensions,代码行数:31,代码来源:GitCommands.cs

示例7: GetFileName

        private static string GetFileName(GitItem item)
        {
            var fileName = item.FileName;
            if (fileName.Contains("\\") && fileName.LastIndexOf("\\") < fileName.Length)
                fileName = fileName.Substring(fileName.LastIndexOf('\\') + 1);
            if (fileName.Contains("/") && fileName.LastIndexOf("/") < fileName.Length)
                fileName = fileName.Substring(fileName.LastIndexOf('/') + 1);

            fileName = (Path.GetTempPath() + fileName).Replace(Settings.PathSeparatorWrong, Settings.PathSeparator);
            return fileName;
        }
开发者ID:dominiqueplante,项目名称:gitextensions,代码行数:11,代码来源:FormBrowse.cs

示例8: GetFileChanges

        public static List<GitItem> GetFileChanges(string file)
        {
            file = FixPath(file);
            string tree = RunCmd(Settings.GitDir + "git.cmd", "whatchanged --all -- \"" + file + "\"");

            string[] itemsStrings = tree.Split('\n');

            List<GitItem> items = new List<GitItem>();

            GitItem item = null;
            foreach (string itemsString in itemsStrings)
            {
                if (itemsString.StartsWith("commit "))
                {
                    item = new GitItem();

                    item.CommitGuid = itemsString.Substring(7).Trim();
                    items.Add(item);
                }
                else
                if (item == null)
                {
                    continue;
                }
                else
                if (itemsString.StartsWith("Author: "))
                {
                    item.Author = itemsString.Substring(7).Trim();
                }
                else
                if (itemsString.StartsWith("Date:   "))
                {
                    item.Date = itemsString.Substring(7).Trim();
                }
                else
                if (!itemsString.StartsWith(":") && !string.IsNullOrEmpty(itemsString))
                {
                    item.Name += itemsString.Trim() + "\n";
                }
                else
                {
                    if (item != null && itemsString.Length > 32)
                        item.Guid = itemsString.Substring(26, 7);
                }
            }

            return items;
        }
开发者ID:jorn,项目名称:gitextensions,代码行数:48,代码来源:GitCommands.cs


注:本文中的GitCommands.GitItem类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。