protected SemanticVersion FindVersion( GitVersionContext context, BranchType branchType) { var ancestor = FindCommonAncestorWithDevelop(context.Repository, context.CurrentBranch, branchType); if (!IsThereAnyCommitOnTheBranch(context.Repository, context.CurrentBranch)) { var developVersionFinder = new DevelopVersionFinder(); return developVersionFinder.FindVersion(context); } var versionOnMasterFinder = new VersionOnMasterFinder(); var versionFromMaster = versionOnMasterFinder.Execute(context, context.CurrentCommit.When()); var numberOfCommitsOnBranchSinceCommit = NumberOfCommitsOnBranchSinceCommit(context, ancestor); var preReleaseTag = context.CurrentBranch.Name .TrimStart(branchType.ToString() + '-') .TrimStart(branchType.ToString() + '/'); var semanticVersion = new SemanticVersion { Major = versionFromMaster.Major, Minor = versionFromMaster.Minor + 1, Patch = 0, PreReleaseTag = preReleaseTag, BuildMetaData = new SemanticVersionBuildMetaData( numberOfCommitsOnBranchSinceCommit, context.CurrentBranch.Name, context.CurrentCommit.Sha, context.CurrentCommit.When()) }; semanticVersion.OverrideVersionManuallyIfNeeded(context.Repository, context.Configuration); return semanticVersion; }
protected SemanticVersion FindVersion( GitVersionContext context, BranchType branchType) { var ancestor = FindCommonAncestorWithDevelop(context.Repository, context.CurrentBranch, branchType); if (!IsThereAnyCommitOnTheBranch(context.Repository, context.CurrentBranch)) { var developVersionFinder = new DevelopVersionFinder(); return(developVersionFinder.FindVersion(context)); } var versionOnMasterFinder = new VersionOnMasterFinder(); var versionFromMaster = versionOnMasterFinder.Execute(context, context.CurrentCommit.When()); var numberOfCommitsOnBranchSinceCommit = NumberOfCommitsOnBranchSinceCommit(context, ancestor); var preReleaseTag = context.CurrentBranch.Name .TrimStart(branchType.ToString() + '-') .TrimStart(branchType.ToString() + '/'); var semanticVersion = new SemanticVersion { Major = versionFromMaster.Major, Minor = versionFromMaster.Minor + 1, Patch = 0, PreReleaseTag = preReleaseTag, BuildMetaData = new SemanticVersionBuildMetaData( numberOfCommitsOnBranchSinceCommit, context.CurrentBranch.Name, context.CurrentCommit.Sha, context.CurrentCommit.When()) }; semanticVersion.OverrideVersionManuallyIfNeeded(context.Repository, context.Configuration); return(semanticVersion); }
/// <summary>Initializes a new instance of the <see cref="T:System.Object"></see> class.</summary> public CircuitBranchMetadata(int n1, int n2, BranchType branchType, ICircuitDefinitionDevice device) { N1 = n1; N2 = n2; BranchType = branchType; Device = device; }
public void SetLocalPath(BranchType branch, string localPath) { if (branch == BranchType.All) { throw new MyTfsConnectionException("Cannot set a local directory for BranchType.All"); } if (!Directory.Exists(localPath)) { throw new MyTfsConnectionException("Local directory does not exist: " + localPath); } if (!WorkSpace.IsLocalPathMapped(localPath)) { throw new MyTfsConnectionException("Local directory " + localPath + " is not mapped in the TFS workspace"); } string serverPath = WorkSpace.GetServerItemForLocalItem(localPath); // double check string localPathFromWorkspace = WorkSpace.GetLocalItemForServerItem(serverPath); if (!Utility.PathHelper.PathsEqual(localPathFromWorkspace, localPath)) { string message = $"When trying to set {branch.ToString()}:\n"; message += string.Format("Inconsistent local and server items: local {0}, server {1}, local matching server {2}.", localPath, serverPath, localPathFromWorkspace); throw new MyTfsConnectionException(message); } _branchMap[branch] = new BranchPaths(localPath, serverPath); }
void EnsureVersionIsValid(SemanticVersion version, Branch branch, BranchType branchType) { var msg = string.Format("Branch '{0}' doesn't respect the {1} branch naming convention. ", branch.Name, branchType); if (version.PreReleaseTag.HasTag()) { throw new WarningException(msg + string.Format("Supported format is '{0}-Major.Minor.Patch'.", branchType.ToString().ToLowerInvariant())); } switch (branchType) { case BranchType.Hotfix: if (version.Patch == 0) { throw new WarningException(msg + "A patch segment different than zero is required."); } break; case BranchType.Release: if (version.Patch != 0) { throw new WarningException(msg + "A patch segment equals to zero is required."); } break; case BranchType.Unknown: break; default: throw new NotSupportedException(string.Format("Unexpected branch type {0}.", branchType)); } }
public void UpdateBranch(BranchType Branch) { if (!_branchMap.ContainsKey(Branch)) { throw new MyTfsConnectionException("Invalid branch: " + Branch); } List <BranchType> branches = BranchToList(Branch); foreach (var branch in branches) { try { string localPath = _branchMap[branch].Local; var itemSpec = new ItemSpec(localPath, RecursionType.Full); var getRequest = new GetRequest(itemSpec, VersionSpec.Latest); Output.WriteLine("\nUpdating {0} branch...", branch.ToString()); //GetStatus getStatus = _workSpace.Get(getRequest, GetOptions.NoAutoResolve); GetStatus getStatus = WorkSpace.Get(getRequest, GetOptions.None); //Output.WriteLine(" {0} files ({1} bytes) downloaded", getStatus.NumFiles, getStatus.NumBytes); Output.WriteLine(); } catch (Exception ex) { throw new MyTfsConnectionException("Exception on Get():\n" + ex.ToString()); } } }
int NumberOfCommitsInBranchNotKnownFromBaseBranch( IRepository repo, Branch branch, BranchType branchType, string baseBranchName) { var baseTip = repo.FindBranch(baseBranchName).Tip; if (branch.Tip == baseTip) { // The branch bears no additional commit return(0); } var ancestor = repo.Commits.FindMergeBase( baseTip, branch.Tip); if (ancestor == null) { var message = string.Format("A {0} branch is expected to branch off of '{1}'. However, branch '{1}' and '{2}' do not share a common ancestor.", branchType, baseBranchName, branch.Name); throw new WarningException(message); } var filter = new CommitFilter { Since = branch.Tip, Until = ancestor, SortBy = CommitSortStrategies.Topological | CommitSortStrategies.Time }; return(repo.Commits.QueryBy(filter).Count()); }
void EnsureVersionIsValid(SemanticVersion version, Branch branch, BranchType branchType) { var msg = string.Format("Branch '{0}' doesn't respect the {1} branch naming convention. ", branch.Name, branchType); if (version.PreReleaseTag.HasTag()) { throw new ErrorException(msg + string.Format("Supported format is '{0}-Major.Minor.Patch'.", branchType.ToString().ToLowerInvariant())); } switch (branchType) { case BranchType.Hotfix: if (version.Patch == 0) { throw new ErrorException(msg + "A patch segment different than zero is required."); } break; case BranchType.Release: if (version.Patch != 0) { throw new ErrorException(msg + "A patch segment equals to zero is required."); } break; case BranchType.Unknown: break; default: throw new NotSupportedException(string.Format("Unexpected branch type {0}.", branchType)); } }
public async Task <IActionResult> Edit(long id, [Bind("Id,Name")] BranchType branchType) { if (id != branchType.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(branchType); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BranchTypeExists(branchType.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(branchType)); }
/// <summary> /// Creates a new collextor entity to hold the data /// </summary> /// <param name="data">program reference</param> /// <param name="targetType">which branch type to search</param> /// <param name="upperBranch">true for upper, false for lower</param> public CollectorEntity(SfcProgramData data, BranchType targetType, bool upperBranch) { Data = data; CollectedSteps = new List <int>(); TargetType = targetType; UpperBranch = upperBranch; }
protected SemanticVersion FindVersion( GitVersionContext context, BranchType branchType) { var ancestor = FindCommonAncestorWithDevelop(context.Repository, context.CurrentBranch, branchType); if (!IsThereAnyCommitOnTheBranch(context.Repository, context.CurrentBranch)) { var developVersionFinder = new DevelopVersionFinder(); return(developVersionFinder.FindVersion(context)); } var versionOnMasterFinder = new VersionOnMasterFinder(); var versionFromMaster = versionOnMasterFinder.Execute(context, context.CurrentBranch.Tip.Committer.When); var numberOfCommitsOnBranchSinceCommit = NumberOfCommitsOnBranchSinceCommit(context, ancestor); var sha = context.CurrentBranch.Tip.Sha; var releaseDate = ReleaseDateFinder.Execute(context.Repository, sha, 0); var semanticVersion = new SemanticVersion { Major = versionFromMaster.Major, Minor = versionFromMaster.Minor + 1, Patch = 0, PreReleaseTag = "unstable0", BuildMetaData = new SemanticVersionBuildMetaData( numberOfCommitsOnBranchSinceCommit, context.CurrentBranch.Name, releaseDate) }; return(semanticVersion); }
public MenuAction(int id, string name, string description, BranchType branch) { ID = id; Name = name; Description = description; Branch = branch; }
protected SemanticVersion FindVersion( GitVersionContext context, BranchType branchType) { var ancestor = FindCommonAncestorWithDevelop(context.Repository, context.CurrentBranch, branchType); if (!IsThereAnyCommitOnTheBranch(context.Repository, context.CurrentBranch)) { var developVersionFinder = new DevelopVersionFinder(); return developVersionFinder.FindVersion(context); } var versionOnMasterFinder = new VersionOnMasterFinder(); var versionFromMaster = versionOnMasterFinder.Execute(context, context.CurrentBranch.Tip.Committer.When); var numberOfCommitsOnBranchSinceCommit = NumberOfCommitsOnBranchSinceCommit(context, ancestor); var sha = context.CurrentBranch.Tip.Sha; var releaseDate = ReleaseDateFinder.Execute(context.Repository, sha, 0); var semanticVersion = new SemanticVersion { Major = versionFromMaster.Major, Minor = versionFromMaster.Minor + 1, Patch = 0, PreReleaseTag = "unstable0", BuildMetaData = new SemanticVersionBuildMetaData( numberOfCommitsOnBranchSinceCommit, context.CurrentBranch.Name, releaseDate) }; return semanticVersion; }
protected void InsertAppData() { StringBuilder appDataSb = new StringBuilder(); appDataSb.Append("window.appData = {"); appDataSb.Append("dictionaries: {"); appDataSb.Append("inputDocTypes: [" + FormatDictionaryList(InputDocType.GetAll(), "InputDocTypeID") + "], "); appDataSb.Append("inputMethods: [" + FormatDictionaryList(InputMethod.GetAll(), "InputMethodID") + "], "); appDataSb.Append("inputSigns: [" + FormatDictionaryList(InputSign.GetAll(), "InputSignID") + "], "); appDataSb.Append("inputSubjectTypes: [" + FormatDictionaryList(InputSubjectType.GetAll(), "InputSubjectTypeID") + "], "); appDataSb.Append("deliveryTypes: [" + FormatDictionaryList(DeliveryType.GetAll(), "DeliveryTypeID") + "] ,"); appDataSb.Append("socialStatuses: [" + FormatDictionaryList(SocialStatus.GetAll(), "SocialStatusID") + "], "); appDataSb.Append("branchTypes: [" + FormatDictionaryList(BranchType.GetAll(), "BranchTypeID") + "], "); appDataSb.Append("socialCategories: [" + FormatDictionaryList(SocialCategory.GetAll(), "SocialCategoryID") + "], "); appDataSb.Append("cardStatuses: [" + FormatDictionaryList(CardStatus.GetAll(), "CardStatusID") + "], "); appDataSb.Append("labels: [" + FormatDictionaryList(Label.GetList(), "LabelID") + "], "); appDataSb.Append("docStatuses: [" + FormatDictionaryList(DocStatus.GetAll(), "DocStatusID") + "]"); appDataSb.Append("}"); appDataSb.Append("}"); HtmlGenericControl scriptControl = new HtmlGenericControl("script"); scriptControl.Attributes["type"] = "text/javascript"; scriptControl.InnerHtml = appDataSb.ToString(); Page.Header.Controls.AddAt(0, scriptControl); }
public BranchOp(Source src, DataType @bool, BranchType type, Expression left, Expression right) : base(src) { BranchType = type; Left = left; Right = right; _bool = @bool; }
public Branch(string name, BranchType type, Company company, string address, string openingHours) { Name = name; Type = type; Company = company; Address = address; OpeningHours = openingHours; }
public override void EnterTable_sources(TSqlParser.Table_sourcesContext ctx) { if (ctx.ChildCount > 1) { mode = JoinMode.Where; } branch = BranchType.Table_sources; }
private static void AssertBranchingInstruction( InstructionBase instruction, InstructionBase branchTarget, BranchType branchType) { Assert.That(instruction, Is.InstanceOf <BranchingInstruction>()); Assert.That(((BranchingInstruction)instruction).BranchTarget, Is.EqualTo(branchTarget)); Assert.That(((BranchingInstruction)instruction).BranchType, Is.EqualTo(branchType)); }
public override void EnterTable_source_item_joined([Antlr4.Runtime.Misc.NotNull] TSqlParser.Table_source_item_joinedContext ctx) { if ((mode == JoinMode.Undefined & ctx.ChildCount == 1) || (mode == JoinMode.Where)) { return; } mode = JoinMode.Join; branch = BranchType.Table_sources; }
protected SemanticVersion FindVersion( GitVersionContext context, BranchType branchType, string baseBranchName) { var nbHotfixCommits = NumberOfCommitsInBranchNotKnownFromBaseBranch(context.Repository, context.CurrentBranch, branchType, baseBranchName); var versionString = context.CurrentBranch.GetSuffix(branchType); if (!versionString.Contains(".")) { return(new SemanticVersion()); } var version = SemanticVersion.Parse(versionString); EnsureVersionIsValid(version, context.CurrentBranch, branchType); if (branchType == BranchType.Hotfix) { version.PreReleaseTag = "beta.1"; } if (branchType == BranchType.Release) { version.PreReleaseTag = "beta.1"; } if (branchType == BranchType.Unknown) { version.PreReleaseTag = context.CurrentBranch.Name.Replace("-" + versionString, string.Empty) + ".1"; } var tagVersion = RetrieveMostRecentOptionalTagVersion(context.Repository, version, context.CurrentBranch.Commits.Take(nbHotfixCommits + 1)); var sha = context.CurrentCommit.Sha; var releaseDate = ReleaseDateFinder.Execute(context.Repository, sha, version.Patch); var semanticVersion = new SemanticVersion { Major = version.Major, Minor = version.Minor, Patch = version.Patch, PreReleaseTag = version.PreReleaseTag, BuildMetaData = new SemanticVersionBuildMetaData( nbHotfixCommits, context.CurrentBranch.Name, releaseDate) }; if (tagVersion != null) { //If the tag is on the eact commit then dont bump the PreReleaseTag if (context.CurrentCommit.Sha != tagVersion.Commit.Sha) { tagVersion.SemVer.PreReleaseTag.Number++; } semanticVersion.PreReleaseTag = tagVersion.SemVer.PreReleaseTag; } return(semanticVersion); }
public TicketItemTemplate(TicketItem tItem, BranchType branching = BranchType.None) { Tag = true; InitializeComponent(); TicketItem = tItem; IsSelected = false; Branching = branching; GridControl.Background = ConfigurationManager.ListItemBackgroundBrush; Loaded += TicketItemTemplate_Loaded; }
public IBranchBase CreateType(BranchType branchType) { switch (branchType) { case BranchType.HomeScreen: { CreateHomeScreenBranch(_branch); return(ieJect.WithParams <IHomeScreenBranch>(_branch)); } case BranchType.Standard: { CreateStandardBranch(_branch); return(ieJect.WithParams <IStandardBranch>(_branch)); } case BranchType.ResolvePopUp: { CreateResolvePopUp(_branch); return(ieJect.WithParams <IResolvePopUpBranch>(_branch)); } case BranchType.OptionalPopUp: { CreateOptionalPopUp(_branch); return(ieJect.WithParams <IOptionalPopUpBranch>(_branch)); } case BranchType.TimedPopUp: { CreateTimedPopUp(_branch); return(ieJect.WithParams <ITimedPopUpBranch>(_branch)); } case BranchType.PauseMenu: { CreatePauseMenu(_branch); return(ieJect.WithParams <IPauseBranch>(_branch)); } case BranchType.Internal: { CreateInternal(_branch); return(ieJect.WithParams <IStandardBranch>(_branch)); } case BranchType.InGameObject: CreateInGameUi(_branch); return(ieJect.WithParams <IGOUIBranch>(_branch)); default: throw new ArgumentOutOfRangeException(nameof(branchType), branchType, null); } }
public async Task <IActionResult> Create([Bind("Id,Name")] BranchType branchType) { if (ModelState.IsValid) { _context.Add(branchType); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(branchType)); }
public override void EnterSearch_condition([Antlr4.Runtime.Misc.NotNull] TSqlParser.Search_conditionContext ctx) { if (mode == JoinMode.Undefined) { return; } branch = BranchType.Search_condition; System.Console.WriteLine("Search_condition"); System.Console.WriteLine(ctx.GetText()); return; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ddlSocialCategory.DataSource = SocialCategory.GetAll(); ddlSocialCategory.DataBind(); ddlBranchType.DataSource = BranchType.GetAll(); ddlBranchType.DataBind(); } }
private void validateInput() { var comboBoxItem = Type.SelectedValue; var isValid = true; if (Name.Text?.Length == 0) { NameValidationErrorTextBlock.Text = "This field is required."; isValid = false; } else if (Name.Text.Length > 200) { NameValidationErrorTextBlock.Text = "The maximum length of this field is 200 characters."; isValid = false; } if (OpeningHours.Text?.Length == 0) { OpeningHoursValidationErrorTextBlock.Text = "This field is required."; isValid = false; } else if (OpeningHours.Text.Length > 200) { OpeningHoursValidationErrorTextBlock.Text = "The maximum length of this field is 200 characters."; isValid = false; } if (Address.Text?.Length == 0) { AddressValidationErrorTextBlock.Text = "This field is required."; isValid = false; } else if (Address.Text.Length > 200) { AddressValidationErrorTextBlock.Text = "The maximum length of this field is 200 characters."; isValid = false; } if (comboBoxItem == null) { TypeValidationErrorTextBlock.Text = "You have to choose a type"; isValid = false; } if (isValid) { BranchType selectedType = (BranchType)comboBoxItem; Branch newBranch = new Branch() { Name = Name.Text, Address = Address.Text, OpeningHours = OpeningHours.Text, Type = selectedType }; SimpleIoc.Default.GetInstance <CompanyViewModel>().AddBranch(newBranch); } }
private float CalculateBranchWidth(BranchType branchType, float prevWidth) { if (branchType == BranchType.Room) { return(Rand.Range(extCaves.branchRoomFixedWidthMin, extCaves.branchRoomFixedWidthMax)); } if (branchType == BranchType.Tunnel) { return(Rand.Range(extCaves.branchTunnelFixedWidthMin, extCaves.branchTunnelFixedWidthMax)); } return(prevWidth * Rand.Range(extCaves.branchWidthFactorMin, extCaves.branchWidthFactorMax)); }
public bool IsHeadOfficeExist(BranchType branchType, string id, string tenantId) { var branch = _repository.AsNoTracking().Where(x => x.TenantId == tenantId) .FirstOrDefault(x => x.Type == BranchType.HeadOffice); if (branch != null && branch.Id != id) { return(true); } return(false); }
public void EditBranch(string name, string address, string openingHours, BranchType type) { var oldBranch = MySelectedBranch; if (oldBranch != null) { oldBranch.Name = name; oldBranch.Address = address; oldBranch.OpeningHours = openingHours; oldBranch.Type = type; } }
/// <summary> /// Changes the sfc line type to the given type. /// </summary> public void UpdateBranchLine(BranchType type) { if (_sfcLineType != type) { if (type != BranchType.Unused) { SetLineTexture(type); } _sfcLineType = type; UpdateLineVisibility(); } }
public static BranchType Invert(this BranchType type) { switch (type) { case BranchType.IfFalse: return(BranchType.IfTrue); case BranchType.IfTrue: return(BranchType.IfFalse); } return(BranchType.Unconditional); }
/// <summary> /// Constructor for BTB test /// </summary> /// <param name="spacing">How far apart branches should be. Valid values are 4, 8, 16</param> /// <param name="conditional">If true, use conditional branches (still always taken)</param> public BtbTest(int spacing, BranchType branchType, bool varyspacing = false) { this.Counts = new int[] { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 1536, 2048, 3072, 4096, 4608, 5120, 6144, 7168, 8192, 10240, 16384, 32768 }; this.Prefix = "btb" + spacing + (varyspacing ? "v" : "") + branchType; this.Description = $"Branch Target Buffer, " + branchType + $" branch every {spacing} bytes " + (varyspacing ? " (varied spacing)" : ""); this.FunctionDefinitionParameters = "uint64_t iterations"; this.GetFunctionCallParameters = "structIterations"; this.DivideTimeByCount = true; this.spacing = spacing; this.branchType = branchType; this.varyspacing = varyspacing; }
public void AddWorkflowBranch(BranchType branchType) { if (branchType == BranchType.Close && branches.Any() && branches.Peek() == BranchType.Open) { branches.Pop(); } else { branches.Push(branchType); } }
public void ValidateInformationalVersionBuilder(BranchType branchType, string branchName, string sha, int major, int minor, int patch, string tag, int? suffix, string versionString) { var semanticVersion = new SemanticVersion { Major = major, Minor = minor, Patch = patch, PreReleaseTag = tag, BuildMetaData = new SemanticVersionBuildMetaData(suffix, branchName, new ReleaseDate{ CommitSha = sha }), }; var informationalVersion = semanticVersion.ToString("i"); Assert.AreEqual(versionString, informationalVersion); }
Commit FindCommonAncestorWithDevelop(IRepository repo, Branch branch, BranchType branchType) { var ancestor = repo.Commits.FindMergeBase( repo.FindBranch("develop").Tip, branch.Tip); if (ancestor != null) { return ancestor; } throw new ErrorException( string.Format("A {0} branch is expected to branch off of 'develop'. " + "However, branch 'develop' and '{1}' do not share a common ancestor." , branchType, branch.Name)); }
protected SemanticVersion FindVersion( GitVersionContext context, BranchType branchType, string baseBranchName) { var nbHotfixCommits = NumberOfCommitsInBranchNotKnownFromBaseBranch(context.Repository, context.CurrentBranch, branchType, baseBranchName); var versionString = context.CurrentBranch.GetSuffix(branchType); if (!versionString.Contains(".")) return new SemanticVersion(); var version = SemanticVersion.Parse(versionString); EnsureVersionIsValid(version, context.CurrentBranch, branchType); if (branchType == BranchType.Hotfix) version.PreReleaseTag = "beta.1"; if (branchType == BranchType.Release) version.PreReleaseTag = "beta.1"; if (branchType == BranchType.Unknown) version.PreReleaseTag = context.CurrentBranch.Name.Replace("-" + versionString, string.Empty) + ".1"; var tagVersion = RetrieveMostRecentOptionalTagVersion(context.Repository, version, context.CurrentBranch.Commits.Take(nbHotfixCommits + 1)); var sha = context.CurrentCommit.Sha; var releaseDate = ReleaseDateFinder.Execute(context.Repository, sha, version.Patch); var semanticVersion = new SemanticVersion { Major = version.Major, Minor = version.Minor, Patch = version.Patch, PreReleaseTag = version.PreReleaseTag, BuildMetaData = new SemanticVersionBuildMetaData( nbHotfixCommits, context.CurrentBranch.Name, releaseDate) }; if (tagVersion != null) { //If the tag is on the eact commit then dont bump the PreReleaseTag if (context.CurrentCommit.Sha != tagVersion.Commit.Sha) { tagVersion.SemVer.PreReleaseTag.Number++; } semanticVersion.PreReleaseTag = tagVersion.SemVer.PreReleaseTag; } return semanticVersion; }
public static string GetSuffix(this Branch branch, BranchType branchType) { switch (branchType) { case BranchType.Hotfix: return branch.GetHotfixSuffix(); case BranchType.Release: return branch.GetReleaseSuffix(); case BranchType.Unknown: return branch.GetUnknownBranchSuffix(); default: throw new NotSupportedException(string.Format("Unexpected branch type {0}.", branchType)); } }
public BranchResult(AnalyzeType AnalyzeType, BranchType BranchType, params uint[] PossibleJumpList) { this.BranchType = BranchType; this.AnalyzeType = AnalyzeType; this.PossibleJumpList = PossibleJumpList; }
/// <summary> /// 作者:Vincen /// 时间:2014.04.24 /// 描述:获取区域中心列表,通过用户编号 /// </summary> /// <param name="userId"></param> /// <param name="branchType"></param> /// <returns></returns> public static List<Branch> GetBranchList(int userId, BranchType branchType) { var Db = new EmeEntities(dbRead); var btype = CommonHelper.To<int>(branchType); var query = from a in Db.Branch join b in Db.UserBranch on a.Id equals b.BranchId where a.BranchType == btype && b.UserId == userId && a.Status == ConvertEnum.StatusTypeForActive && b.Status == ConvertEnum.StatusTypeForActive orderby b.IsMain descending, a.OrderNum ascending select a; return query.ToList(); }
int NumberOfCommitsInBranchNotKnownFromBaseBranch( IRepository repo, Branch branch, BranchType branchType, string baseBranchName) { var baseTip = repo.FindBranch(baseBranchName).Tip; if (branch.Tip == baseTip) { // The branch bears no additional commit return 0; } var ancestor = repo.Commits.FindMergeBase( baseTip, branch.Tip); if (ancestor == null) { var message = string.Format("A {0} branch is expected to branch off of '{1}'. However, branch '{1}' and '{2}' do not share a common ancestor.", branchType, baseBranchName, branch.Name); throw new ErrorException(message); } var filter = new CommitFilter { Since = branch.Tip, Until = ancestor, SortBy = CommitSortStrategies.Topological | CommitSortStrategies.Time }; return repo.Commits.QueryBy(filter).Count(); }
private static void AssertBranchingInstruction( InstructionBase instruction, InstructionBase branchTarget, BranchType branchType) { Assert.That(instruction, Is.InstanceOf<BranchingInstruction>()); Assert.That(((BranchingInstruction) instruction).BranchTarget, Is.EqualTo(branchTarget)); Assert.That(((BranchingInstruction) instruction).BranchType, Is.EqualTo(branchType)); }
/// <summary> /// Generates code for branching /// </summary> /// <param name="branchLabelRecord"></param> /// <param name="branchType"></param> internal void GenerateBranch(ref string branchLabelRecord, BranchType branchType) { if (branchLabelRecord.Equals(string.Empty)) { branchLabelRecord = nextLabel; } cilOutput.Write(Enumerations.GetDescription<BranchType>(branchType)); cilOutput.WriteLine(branchLabelRecord); }
/// <summary> /// 作者:Vincen /// 时间:20104.04.22 /// 描述:获取中心列表,不包含指定类型 /// </summary> /// <param name="parentId"></param> /// <param name="branchType"></param> /// <returns></returns> public static List<Branch> GetBranchListNotBranchType(int? parentId, BranchType branchType) { var Db = new EmeEntities(dbRead); var btype = CommonHelper.To<int>(branchType); return Db.Branch.Where(p => p.ParentId == parentId && p.BranchType < btype && p.Status == ConvertEnum.StatusTypeForActive).OrderBy(p => p.OrderNum).ToList(); }