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


C# Branch类代码示例

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


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

示例1: FinancialStatusByBranchController

 public FinancialStatusByBranchController(Branch branch)
     : base(UITableViewStyle.Grouped, null)
 {
     Autorotate = false;
     this.branch = branch;
     buildReport ();
 }
开发者ID:rajeshwarn,项目名称:GhostPractice-iPadRepo,代码行数:7,代码来源:FinancialStatusByBranchController.cs

示例2: Connect

    public void Connect(Uri path)
    {
      // Try to see if ther is already a git repository inside the filesystem path
      if (Repository.IsValid(m_fileSystemPath))
      {
        m_repository = new Repository(m_fileSystemPath, new RepositoryOptions());
      }
      else
      {
        var tempFolder = Guid.NewGuid().ToString("N");

        m_bareWorkDirPath = System.IO.Path.Combine(m_fileSystemPath, tempFolder);
        var ret = Repository.Clone(path.AbsoluteUri, m_bareWorkDirPath, new CloneOptions()
        {
          CredentialsProvider = (url, fromUrl, types) => new UsernamePasswordCredentials()
          {
            Password = m_password,
            Username = m_userName,
          },
          Checkout = false,
          IsBare = true,
        });

        m_repository = new Repository(m_bareWorkDirPath, new RepositoryOptions());
      }

      m_branch = m_repository.Branches[m_branchPath];
      if (m_branch == null)
      {
        throw new Exception("Branch not found: " + m_branchPath);
      }
    }
开发者ID:ronenbarak,项目名称:Barak.VersionPatcher,代码行数:32,代码来源:GitSourceControl.cs

示例3: LatestMergeCommit

        public static Commit LatestMergeCommit(this Branch thisBranch, Branch otherBranch)
        {
            IEnumerable<Commit> otherBranchCommits = otherBranch.Commits;

            if (otherBranchCommits.Contains(thisBranch.Tip))
            {
                // Current branch is merged back to otherBranch.
                // So we find the last commit on otherBranch before this merge and all it's ancestors.
                var otherTipAfterMerge =
                    otherBranchCommits.SkipWhile(c => c.Parents.All(p => p != thisBranch.Tip)).FirstOrDefault();
                if (otherTipAfterMerge != null)
                {
                    var thisTipBeforeMerge = otherTipAfterMerge.Parents.First(p => p != thisBranch.Tip);
                    otherBranchCommits =
                        new List<Commit> { thisTipBeforeMerge }.Concat(thisTipBeforeMerge.GetAllAncestors());
                }
            }

            var branchCommits = thisBranch.Commits.Except(otherBranchCommits).ToList();
            var branchCommitsMergedFromOtherBranch =
                branchCommits.Where(c => c.IsMergeFrom(otherBranchCommits)).ToList();

            if (branchCommitsMergedFromOtherBranch.Any())
            {
                return branchCommitsMergedFromOtherBranch.First().GetSingleParentFrom(otherBranchCommits);
            }

            if (branchCommits.Any())
            {
                return branchCommits.Last().GetSingleParentFrom(otherBranchCommits);
            }

            return null;
        }
开发者ID:rickbeerendonk,项目名称:GitBranchDiff,代码行数:34,代码来源:BranchExtensions.cs

示例4: Login

        public User Login(string username, string password)
        {
            var session = NHibernateSessionManager.GetLocalSession();
            var macAddress = _clientAdapter.GetCurrentClientMacAddress();
            var user = _userRepository.LoginActiveUser(username, password);
            var terminal = _terminalRepository.FindByMac(macAddress);

            if (user.IsNull())
            {
                throw new ApplicationException(@"User not found");
            }

            if (terminal == null)
            {
                session.DoTransactional(sess =>
                    terminal = _terminalRepository.Insert(
                        new Terminal(
                            string.Format(@"T-{0}/{1:00}", user.Employee.Branch.Code ,_terminalRepository.Count() + 1),
                            macAddress,
                            user.Employee.Branch
                        )
                    )
                );
            }

            LoggedInUser = user;
            LoggedInUserBranch = user.Employee.Branch;
            LoggedInTerminal = terminal;

            return user;
        }
开发者ID:gofixiao,项目名称:Macsauto-Backup,代码行数:31,代码来源:LoginService.cs

示例5: Push

 /// <summary>
 /// Push the specified branch to its tracked branch on the remote.
 /// </summary>
 /// <param name="network">The <see cref="Network"/> being worked with.</param>
 /// <param name="branch">The branch to push.</param>
 /// <param name="pushOptions"><see cref="PushOptions"/> controlling push behavior</param>
 /// <exception cref="LibGit2SharpException">Throws if either the Remote or the UpstreamBranchCanonicalName is not set.</exception>
 public static void Push(
     this Network network,
     Branch branch,
     PushOptions pushOptions = null)
 {
     network.Push(new[] { branch }, pushOptions);
 }
开发者ID:Ran-QUAN,项目名称:libgit2sharp,代码行数:14,代码来源:NetworkExtensions.cs

示例6: GetUnknownBranchSuffix

 static string GetUnknownBranchSuffix(Branch branch)
 {
     var unknownBranchSuffix = branch.Name.Split('-', '/');
     if (unknownBranchSuffix.Length == 1)
         return branch.Name;
     return unknownBranchSuffix[1];
 }
开发者ID:unic,项目名称:GitVersion,代码行数:7,代码来源:OtherBranchVersionFinder.cs

示例7: EnsureVersionIsValid

        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));
            }
        }
开发者ID:potherca-contrib,项目名称:GitVersion,代码行数:35,代码来源:OptionallyTaggedBranchVersionFinderBase.cs

示例8: RenameBranchDialog

        /// <summary>Create <see cref="RenameBranchDialog"/>.</summary>
        /// <param name="branch">Branch to rename.</param>
        /// <exception cref="ArgumentNullException"><paramref name="branch"/> == <c>null</c>.</exception>
        public RenameBranchDialog(Branch branch)
        {
            Verify.Argument.IsNotNull(branch, "branch");
            Verify.Argument.IsFalse(branch.IsDeleted, "branch",
                Resources.ExcObjectIsDeleted.UseAsFormat("Branch"));

            _branch = branch;

            InitializeComponent();
            Localize();

            var inputs = new IUserInputSource[]
            {
                _newNameInput = new TextBoxInputSource(_txtNewName),
            };
            _errorNotifier = new UserInputErrorNotifier(NotificationService, inputs);

            SetupReferenceNameInputBox(_txtNewName, ReferenceType.LocalBranch);

            var branchName = branch.Name;
            _txtOldName.Text = branchName;
            _txtNewName.Text = branchName;
            _txtNewName.SelectAll();

            GitterApplication.FontManager.InputFont.Apply(_txtNewName, _txtOldName);

            _controller = new RenameBranchController(branch) { View = this };
        }
开发者ID:Kuzq,项目名称:gitter,代码行数:31,代码来源:RenameBranchDialog.cs

示例9: ElectronicObject

 public ElectronicObject(string catalogueNumber, string manufacturer, string model, string description, int quantity, Branch category, decimal price, Color color, double display, int capacity)
     : base(catalogueNumber, manufacturer, model, description, quantity, category, price)
 {
     this.display = display;
     this.capacity = capacity;
     this.color = color;
 }
开发者ID:NikolovNikolay,项目名称:Telerik-Academy-Team-work-projects,代码行数:7,代码来源:ElectronicObject.cs

示例10: GetBranchConfiguration

        public static KeyValuePair<string, BranchConfig> GetBranchConfiguration(Commit currentCommit, IRepository repository, bool onlyEvaluateTrackedBranches, Config config, Branch currentBranch, IList<Branch> excludedInheritBranches = null)
        {
            var matchingBranches = LookupBranchConfiguration(config, currentBranch);

            if (matchingBranches.Length == 0)
            {
                var branchConfig = new BranchConfig();
                ConfigurationProvider.ApplyBranchDefaults(config, branchConfig);
                return new KeyValuePair<string, BranchConfig>(string.Empty, branchConfig);
            }
            if (matchingBranches.Length == 1)
            {
                var keyValuePair = matchingBranches[0];
                var branchConfiguration = keyValuePair.Value;

                if (branchConfiguration.Increment == IncrementStrategy.Inherit)
                {
                    return InheritBranchConfiguration(onlyEvaluateTrackedBranches, repository, currentCommit, currentBranch, keyValuePair, branchConfiguration, config, excludedInheritBranches);
                }

                return keyValuePair;
            }

            const string format = "Multiple branch configurations match the current branch branchName of '{0}'. Matching configurations: '{1}'";
            throw new Exception(string.Format(format, currentBranch.Name, string.Join(", ", matchingBranches.Select(b => b.Key))));
        }
开发者ID:pierrebakker,项目名称:GitVersion,代码行数:26,代码来源:BranchConfigurationCalculator.cs

示例11: BranchWrapper

 public BranchWrapper(Repository repo, Branch branch)
 {
     this.repo = repo;
     this.branch = branch;
     IsRemote = branch.IsRemote;
     if (branch.TrackedBranch != null)
     {
         TrackedBranch = new BranchWrapper(repo, branch.TrackedBranch);
     }
     IsTracking = branch.IsTracking;
     TrackingDetails = (Func<object, Task<object>>)(async (j) => { return branch.TrackingDetails; });
     IsCurrentRepositoryHead = (Func<object, Task<object>>)(async (j) => { return branch.IsCurrentRepositoryHead; });
     Tip = async (j) => { return new CommitWrapper(branch.Tip); };
     UpstreamBranchCanonicalName = (Func<object, Task<object>>)(async (j) => { return branch.UpstreamBranchCanonicalName; });
     Remote = branch.Remote;
     CanonicalName = branch.CanonicalName;
     Commits = (Func<object, Task<object>>)(async (j) => {
         if (j != null)
         {
             Commit after = repo.Lookup<Commit>((string)j);
             Commit until = branch.Tip;
             Commit ancestor = repo.Commits.FindMergeBase(after, until) ?? after;
             return CommitsAfter(after, until, ancestor).Distinct().Select(c => new CommitWrapper(c));
         }
         else
         {
             return branch.Commits.Select(c => new CommitWrapper(c));
         }
     });
     Name = branch.Name;
 }
开发者ID:itsananderson,项目名称:edge-git,代码行数:31,代码来源:BranchWrapper.cs

示例12: GetBranchConfiguration

        /// <summary>
        /// Gets the <see cref="BranchConfig"/> for the current commit.
        /// </summary>
        public static BranchConfig GetBranchConfiguration(GitVersionContext context, Branch targetBranch, IList<Branch> excludedInheritBranches = null)
        {
            var matchingBranches = LookupBranchConfiguration(context.FullConfiguration, targetBranch).ToArray();

            BranchConfig branchConfiguration;
            if (matchingBranches.Length > 0)
            {
                branchConfiguration = matchingBranches[0];

                if (matchingBranches.Length > 1)
                {
                    Logger.WriteWarning(string.Format(
                        "Multiple branch configurations match the current branch branchName of '{0}'. Using the first matching configuration, '{1}'. Matching configurations include: '{2}'",
                        targetBranch.FriendlyName,
                        branchConfiguration.Name,
                        string.Join("', '", matchingBranches.Select(b => b.Name))));
                }
            }
            else
            {
                Logger.WriteInfo(string.Format(
                    "No branch configuration found for branch {0}, falling back to default configuration",
                    targetBranch.FriendlyName));

                branchConfiguration = new BranchConfig { Name = string.Empty };
                ConfigurationProvider.ApplyBranchDefaults(context.FullConfiguration, branchConfiguration, "");
            }

            return branchConfiguration.Increment == IncrementStrategy.Inherit ?
                InheritBranchConfiguration(context, targetBranch, branchConfiguration, excludedInheritBranches) :
                branchConfiguration;
        }
开发者ID:GitTools,项目名称:GitVersion,代码行数:35,代码来源:BranchConfigurationCalculator.cs

示例13: CalculateWhenMultipleParents

        static Branch[] CalculateWhenMultipleParents(IRepository repository, Commit currentCommit, ref Branch currentBranch, Branch[] excludedBranches)
        {
            var parents = currentCommit.Parents.ToArray();
            var branches = repository.Branches.Where(b => !b.IsRemote && b.Tip == parents[1]).ToList();
            if (branches.Count == 1)
            {
                var branch = branches[0];
                excludedBranches = new[]
                {
                    currentBranch,
                    branch
                };
                currentBranch = branch;
            }
            else if (branches.Count > 1)
            {
                currentBranch = branches.FirstOrDefault(b => b.Name == "master") ?? branches.First();
            }
            else
            {
                var possibleTargetBranches = repository.Branches.Where(b => !b.IsRemote && b.Tip == parents[0]).ToList();
                if (possibleTargetBranches.Count > 1)
                {
                    currentBranch = possibleTargetBranches.FirstOrDefault(b => b.Name == "master") ?? possibleTargetBranches.First();
                }
                else
                {
                    currentBranch = possibleTargetBranches.FirstOrDefault() ?? currentBranch;
                }
            }

            Logger.WriteInfo("HEAD is merge commit, this is likely a pull request using " + currentBranch.Name + " as base");

            return excludedBranches;
        }
开发者ID:mtdavidson,项目名称:GitVersion,代码行数:35,代码来源:BranchConfigurationCalculator.cs

示例14: CreateBranch

        /// <summary>
        /// Create New Branch
        /// </summary>
        /// <param name="NewBranch"></param>
        public void CreateBranch(Branch NewBranch)
        {
            string qryInsertBranch =
                            @"INSERT INTO [dbo].[Company]
                            ([BranchID]
                            , [CompanyID]
                            , [BranchRegion]
                            , [BranchCode]
                            , [BranchName]
                            , [BranchHotelName]
                            , [BranchSpaName]
                            , [BranchAddress]
                            , [BranchCity]
                            , [BranchState]
                            , [BranchCountry]
                            , [BranchContactNo]
                            , [BranchComment]
                            , [BranchCreatedBy])
                            values
                            (@BranchID, @CompanyID, @BranchRegion, @BranchCode, @BranchName,
                            @BranchHotelName, @BranchSpaName, @BranchAddress, @BranchCity,
                            @BranchState, @BranchCountry, @BranchContactNo, @BranchComment, @BranchCreatedBy)";

            //creates new Branch
            this._con.Query<int>(qryInsertBranch, NewBranch);
        }
开发者ID:RelaCodeTech,项目名称:AspNetIdentityV2,代码行数:30,代码来源:BranchRepository.cs

示例15: NumberOfCommitsOnBranchSinceCommit

 public int NumberOfCommitsOnBranchSinceCommit(Branch branch, Commit commit)
 {
     var olderThan = branch.Tip.Committer.When;
     return branch.Commits
         .TakeWhile(x => x != commit)
         .Count();
 }
开发者ID:reavowed,项目名称:GitReleaseNotes,代码行数:7,代码来源:GitHelper.cs


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