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


C# Area.GetBranchHeadVersion方法代码示例

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


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

示例1: RunInternal

		protected override bool RunInternal(Area ws, Versionr.Status status, IList<Versionr.Status.StatusEntry> targets, FileBaseCommandVerbOptions options)
		{
			LogVerbOptions localOptions = options as LogVerbOptions;
			if (JruntingMode)
				localOptions.Detail = LogVerbOptions.DetailMode.Jrunting;

			Printer.EnableDiagnostics = localOptions.Verbose;

			bool targetedBranch = false;
			Objects.Version version = null;
			if (!string.IsNullOrEmpty(localOptions.Branch))
			{
				bool multipleBranches = false;
				var branch = ws.GetBranchByPartialName(localOptions.Branch, out multipleBranches);
				if (branch == null || multipleBranches)
				{
					Printer.PrintError("No unique branch found for {0}", localOptions.Branch);
					return false;
				}
				version = ws.GetBranchHeadVersion(branch);
				targetedBranch = true;
			}
			else if (!string.IsNullOrEmpty(localOptions.Version))
			{
				version = ws.GetPartialVersion(localOptions.Version);
				if (version == null)
				{
					Printer.PrintError("Couldn't find matching version for {0}", localOptions.Version);
					return false;
				}
			}

			if (localOptions.Limit == -1)
				localOptions.Limit = (version == null || targetedBranch) ? 10 : 1;
            if (version == null)
                version = ws.Version;

            int? nullableLimit = localOptions.Limit;
            if (nullableLimit.Value <= 0)
                nullableLimit = null;
            
            var history = (localOptions.ShowMerged ? ws.GetLogicalHistory(version, nullableLimit) : ws.GetHistory(version, nullableLimit)).AsEnumerable();

			m_Tip = Workspace.Version;
			Objects.Version last = null;
			m_Branches = new Dictionary<Guid, Objects.Branch>();
			foreach (var x in ApplyHistoryFilter(history, localOptions))
			{
				last = x.Item1;
				FormatLog(x.Item1, x.Item2, localOptions);
			}

			if (!localOptions.Jrunting && last != null && last.ID == m_Tip.ID && version == null)
			{
				var branch = Workspace.CurrentBranch;
				var heads = Workspace.GetBranchHeads(branch);
				bool isHead = heads.Any(x => x.Version == last.ID);
				bool isOnlyHead = heads.Count == 1;
				if (!isHead)
					Printer.PrintMessage("\nCurrent version #b#{0}## is #e#not the head## of branch #b#{1}## (#b#\"{2}\"##)", m_Tip.ShortName, branch.ShortID, branch.Name);
				else if (!isOnlyHead)
					Printer.PrintMessage("\nCurrent version #b#{0}## is #w#not only the head## of branch #b#{1}## (#b#\"{2}\"##)", m_Tip.ShortName, branch.ShortID, branch.Name);
			}

			return true;
		}
开发者ID:eatplayhate,项目名称:versionr,代码行数:66,代码来源:Log.cs


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