當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。