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


C# IGitTfsRemote.QuickFetch方法代码示例

本文整理汇总了C#中IGitTfsRemote.QuickFetch方法的典型用法代码示例。如果您正苦于以下问题:C# IGitTfsRemote.QuickFetch方法的具体用法?C# IGitTfsRemote.QuickFetch怎么用?C# IGitTfsRemote.QuickFetch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IGitTfsRemote的用法示例。


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

示例1: DoFetch

 protected override void DoFetch(IGitTfsRemote remote)
 {
     if (InitialChangeset.HasValue)
         remote.QuickFetch(InitialChangeset.Value);
     else
         remote.QuickFetch();
 }
开发者ID:runt18,项目名称:git-tfs,代码行数:7,代码来源:QuickFetch.cs

示例2: DoFetch

 protected override void DoFetch(IGitTfsRemote remote, bool stopOnFailMergeCommit)
 {
     if (InitialChangeset.HasValue)
         remote.QuickFetch(InitialChangeset.Value);
     else
         remote.QuickFetch();
 }
开发者ID:EdwinTai,项目名称:git-tfs,代码行数:7,代码来源:QuickFetch.cs

示例3: DoFetch

 protected override void DoFetch(IGitTfsRemote remote)
 {
     if (changeSetId == default(int))
         // Just grab the latest changeset:
         remote.QuickFetch();
     else
         // Use a specific changeset to start from:
         remote.QuickFetch(changeSetId);
 }
开发者ID:nnieslan,项目名称:git-tfs,代码行数:9,代码来源:QuickFetch.cs

示例4: DoFetch

 protected override void DoFetch(IGitTfsRemote remote, bool stopOnFailMergeCommit)
 {
     if (InitialChangeset.HasValue)
         remote.QuickFetch(InitialChangeset.Value);
     else
         remote.QuickFetch();
     _properties.InitialChangeset = remote.MaxChangesetId;
     _properties.PersistAllOverrides();
 }
开发者ID:pmiossec,项目名称:git-tfs,代码行数:9,代码来源:QuickFetch.cs

示例5: DoFetch

 protected override void DoFetch(IGitTfsRemote remote)
 {
     if (InitialChangeset.HasValue)
         // Just grab the latest changeset:
         remote.QuickFetch();
     else
         // Use a specific changeset to start from:
         remote.QuickFetch(InitialChangeset.Value);
 }
开发者ID:salty-horse,项目名称:git-tfs,代码行数:9,代码来源:QuickFetch.cs

示例6: DoFetch

        protected virtual void DoFetch(IGitTfsRemote remote, bool stopOnFailMergeCommit)
        {
            if (remote.Repository.IsBare)
            {
                if(string.IsNullOrEmpty(BareBranch))
                    throw new GitTfsException("error : specify a git branch to fetch on...");
                if (!remote.Repository.HasRef(GitRepository.ShortToLocalName(BareBranch)))
                    throw new GitTfsException("error : the specified git branch doesn't exist...");
                if (!ForceFetch && remote.MaxCommitHash != remote.Repository.GetCommit(BareBranch).Sha)
                    throw new GitTfsException("error : fetch is not allowed when there is ahead commits!",
                        new List<string>() {"Remove ahead commits and retry", "use the --force option (ahead commits will be lost!)"});
            }

            // It is possible that we have outdated refs/remotes/tfs/<id>.
            // E.g. someone already fetched changesets from TFS into another git repository and we've pulled it since
            // in that case tfs fetch will retrieve same changes again unnecessarily. To prevent it we will scan tree from HEAD and see if newer changesets from
            // TFS exists (by checking git-tfs-id mark in commit's comments).
            // The process is similar to bootstrapping.
            if (!ForceFetch)
                globals.Repository.MoveTfsRefForwardIfNeeded(remote);
            var exportMetadatasFilePath = Path.Combine(globals.GitDir, "git-tfs_workitem_mapping.txt");
            if (ExportMetadatas)
            {
                remote.ExportMetadatas = true;
                remote.Repository.SetConfig(GitTfsConstants.ExportMetadatasConfigKey, "true");
                if (!string.IsNullOrEmpty(ExportMetadatasFile))
                {
                    if (File.Exists(ExportMetadatasFile))
                    {
                        File.Copy(ExportMetadatasFile, exportMetadatasFilePath);
                    }
                    else
                        throw new GitTfsException("error: the work items mapping file doesn't exist!");
                }
            }
            else
            {
                if(remote.Repository.GetConfig(GitTfsConstants.ExportMetadatasConfigKey) == "true")
                    remote.ExportMetadatas = true;
            }
            remote.ExportWorkitemsMapping = new Dictionary<string, string>();
            if (remote.ExportMetadatas && File.Exists(exportMetadatasFilePath))
            {
                try
                {
                    foreach (var lineRead in File.ReadAllLines(exportMetadatasFilePath))
                    {
                        if (string.IsNullOrWhiteSpace(lineRead))
                            continue;
                        var values = lineRead.Split('|');
                        var oldWorkitem = values[0].Trim();
                        if(!remote.ExportWorkitemsMapping.ContainsKey(oldWorkitem))
                            remote.ExportWorkitemsMapping.Add(oldWorkitem, values[1].Trim());
                    }
                }
                catch (Exception)
                {
                    throw new GitTfsException("error: bad format of workitems mapping file! One line format should be: OldWorkItemId|NewWorkItemId");
                }
            }

            try
            {
                if (InitialChangeset.HasValue)
                {
                    properties.InitialChangeset = InitialChangeset.Value;
                    properties.PersistAllOverrides();
                    remote.QuickFetch(InitialChangeset.Value);
                    remote.Fetch(stopOnFailMergeCommit);
                }
                else
                {
                    remote.Fetch(stopOnFailMergeCommit);
                }

            }
            finally
            {
                Trace.WriteLine("Cleaning...");
                remote.CleanupWorkspaceDirectory();

                if (remote.Repository.IsBare)
                    remote.Repository.UpdateRef(GitRepository.ShortToLocalName(BareBranch), remote.MaxCommitHash);
            }
        }
开发者ID:rav121,项目名称:git-tfs,代码行数:85,代码来源:Fetch.cs

示例7: DoFetch

        protected virtual void DoFetch(IGitTfsRemote remote, bool stopOnFailMergeCommit)
        {
            var bareBranch = string.IsNullOrEmpty(BareBranch) ? remote.Id : BareBranch;

            // It is possible that we have outdated refs/remotes/tfs/<id>.
            // E.g. someone already fetched changesets from TFS into another git repository and we've pulled it since
            // in that case tfs fetch will retrieve same changes again unnecessarily. To prevent it we will scan tree from HEAD and see if newer changesets from
            // TFS exists (by checking git-tfs-id mark in commit's comments).
            // The process is similar to bootstrapping.
            if (!ForceFetch)
            {
                if (!remote.Repository.IsBare)
                    remote.Repository.MoveTfsRefForwardIfNeeded(remote);
                else
                    remote.Repository.MoveTfsRefForwardIfNeeded(remote, bareBranch);
            }

            if (!ForceFetch &&
                remote.Repository.IsBare &&
                remote.Repository.HasRef(GitRepository.ShortToLocalName(bareBranch)) &&
                remote.MaxCommitHash != remote.Repository.GetCommit(bareBranch).Sha)
            {
                throw new GitTfsException("error : fetch is not allowed when there is ahead commits!",
                    new[] {"Remove ahead commits and retry", "use the --force option (ahead commits will be lost!)"});
            }

            var metadataExportInitializer = new ExportMetadatasInitializer(globals);
            bool shouldExport = ExportMetadatas || remote.Repository.GetConfig(GitTfsConstants.ExportMetadatasConfigKey) == "true";

            if (ExportMetadatas)
            {
                metadataExportInitializer.InitializeConfig(remote.Repository, ExportMetadatasFile);
            }

            metadataExportInitializer.InitializeRemote(remote, shouldExport);

            try
            {
                if (InitialChangeset.HasValue)
                {
                    properties.InitialChangeset = InitialChangeset.Value;
                    properties.PersistAllOverrides();
                    remote.QuickFetch(InitialChangeset.Value);
                    remote.Fetch(stopOnFailMergeCommit);
                }
                else
                {
                    remote.Fetch(stopOnFailMergeCommit,upToChangeSet);
                }

            }
            finally
            {
                Trace.WriteLine("Cleaning...");
                remote.CleanupWorkspaceDirectory();

                if (remote.Repository.IsBare)
                    remote.Repository.UpdateRef(GitRepository.ShortToLocalName(bareBranch), remote.MaxCommitHash);
            }
        }
开发者ID:XinChenBug,项目名称:git-tfs,代码行数:60,代码来源:Fetch.cs

示例8: DoFetch

 protected override void DoFetch(IGitTfsRemote remote)
 {
     remote.QuickFetch();
 }
开发者ID:hammerdr,项目名称:git-tfs,代码行数:4,代码来源:QuickFetch.cs


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