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


C# VersionControlServer.GetItems方法代码示例

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


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

示例1: GetChildItems

		public static List<string> GetChildItems(VersionControlServer server)
		{
			/*var path = "$/Main/PartnerAccess/PALibraries/PAUdb/.nuget";
			var items = server.GetItems(path, new ChangesetVersionSpec(2538), RecursionType.OneLevel);*/
			var path = "$/Main/PartnerAccess/PALibraries/PAUdb/udbcodegen";
			//var items = server.GetItems(path, new ChangesetVersionSpec(2538), RecursionType.OneLevel);
			var items = server.GetItems(path, RecursionType.OneLevel);
			return items
				.Items
				.Select(i => i.ServerItem)
				.Where(i => i != path)
				.ToList();
		}
开发者ID:shuruev,项目名称:CCNet.Extensions,代码行数:13,代码来源:Program.cs

示例2: ShowChangeset

    public static void ShowChangeset(VersionControlServer vcs, 
																	 ChangesetVersionSpec versionSpec, 
																	 bool brief, DiffOptions diffOpts)
    {
        int changesetId = versionSpec.ChangesetId;
        Changeset changeset = vcs.GetChangeset(changesetId, true, true);

        // fetch all items in one fell swoop
        List<int> ids = new List<int>();
        foreach (Change change in changeset.Changes)
            ids.Add(change.Item.ItemId);

        // find items in prior changeset
        Item[] items = vcs.GetItems(ids.ToArray(), changesetId-1, true);
        SortedList<int, Item> itemList = new SortedList<int, Item>();
        foreach (Item item in items)
            {
                // itemId of 0 means a null item, IOW file was added in this changeset
                // and missing in prior changeset
                if (item.ItemId == 0) continue;
                itemList.Add(item.ItemId, item);
            }

        foreach (Change change in changeset.Changes)
            {
                // skip folders
                if (change.Item.ItemType == ItemType.Folder) continue;
                string p = change.Item.ServerItem.Substring(2);

                if (brief)
                    {
                        Console.WriteLine(p);
                        continue;
                    }

                IDiffItem a = new DiffItemNull();
                IDiffItem b = new DiffItemNull();

                string tnameA = null;
                string tnameB = null;

                if (((change.ChangeType & ChangeType.Add) != ChangeType.Add) &&
                        (itemList.ContainsKey(change.Item.ItemId)))
                    {
                        Item itemA = itemList[change.Item.ItemId];

                        tnameA = Path.GetTempFileName();
                        itemA.DownloadFile(tnameA);

                        a = new DiffItemLocalFile(tnameA, itemA.Encoding,
                                                                            changeset.CreationDate, true);
                    }

                if ((change.ChangeType & ChangeType.Delete) != ChangeType.Delete)
                    {
                        tnameB = Path.GetTempFileName();
                        change.Item.DownloadFile(tnameB);

                        b = new DiffItemLocalFile(tnameB, change.Item.Encoding,
                                                                            changeset.CreationDate, true);
                    }

                diffOpts.TargetLabel = versionSpec.DisplayString;
                Difference.DiffFiles(vcs, a, b, diffOpts, p, true);

                if (!String.IsNullOrEmpty(tnameA))
                    File.Delete(tnameA);

                if (!String.IsNullOrEmpty(tnameB))
                    File.Delete(tnameB);
            }
    }
开发者ID:Jeff-Lewis,项目名称:opentf,代码行数:72,代码来源:DiffItemNull.cs

示例3: RunForItemSpec

        private void RunForItemSpec(VersionControlServer versionControl, string itemSpec)
        {
            _logger.Info(string.Format("Starting for ItemSpec: {0}", itemSpec));

            try
            {
                DateTime startTime = DateTime.UtcNow;

                // Retrieving list of items

                _logger.Info("Retrieving list of items...");

                var items = versionControl.GetItems(itemSpec, VersionSpec.Latest, RecursionType.Full, DeletedState.NonDeleted, ItemType.File, true);

                DateTime finishTimeGetItems = DateTime.UtcNow;
                TimeSpan elapsedTimeGetItems = finishTimeGetItems - startTime;

                _logger.Info("Retrieved {0} items to warm up. Retrieval time: {1}", items.Items.Length, elapsedTimeGetItems);

                if (elapsedTimeGetItems > TimeSpan.FromMinutes(MAX_MINUTES_FOR_GETITEMS))
                {
                    _logger.Warn("Retrieval of items for the ItemSpec took more than {0} minutes, actual time: {1}. Consider reconfiguration of ItemSpecs for the Project Collection.",
                        MAX_MINUTES_FOR_GETITEMS, elapsedTimeGetItems);
                }

                // Processing retrieved items

                _logger.Info("Downloading items...");

                foreach (var item in items.Items)
                {
                    try
                    {
                        // Extracting file ID from the item's download URL to avoid downloading of already warmed up files
                        // during this session

                        int fileId = item.GetFileId();

                        if (!_alreadyDownloadedFileIds.Contains(fileId))
                        {
                            // Requesting file and closing stream, because we don't need the file itself

                            item.DownloadFile().Dispose();

                            _logger.Debug("Downloaded: {0}:{1}", item.ServerItem, item.ChangesetId);

                            // Marking the file as downloaded during this session

                            _alreadyDownloadedFileIds.Add(fileId);
                        }
                        else
                            _logger.Debug("Skipped (already downloaded): {0}:{1}", item.ServerItem, item.ChangesetId);
                    }
                    catch (Exception ex)
                    {
                        _logger.WarnException(string.Format("Failed to process item: {0}:{1}", item.ServerItem, item.ChangesetId), ex);
                    }
                }

                // Calculating elapsed time

                DateTime finishTime = DateTime.UtcNow;
                TimeSpan elapsedTime = finishTime - startTime;

                _logger.Info("Warm up for the ItemSpec done. Elapsed time: {0}", elapsedTime);
            }
            catch (Exception ex)
            {
                _logger.ErrorException(string.Format("Warm up for the ItemSpec failed with error: {0}", ex.Message), ex);
            }
        }
开发者ID:kostrse,项目名称:TfsProxyWarmUp,代码行数:71,代码来源:ProjectCollectionWarmUp.cs


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