本文整理汇总了C#中Branch类的典型用法代码示例。如果您正苦于以下问题:C# Branch类的具体用法?C# Branch怎么用?C# Branch使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Branch类属于命名空间,在下文中一共展示了Branch类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: Checkout
/// <summary>
/// Checkout the tip commit of the specified <see cref="Branch"/> object. If this commit is the
/// current tip of the branch, will checkout the named branch. Otherwise, will checkout the tip commit
/// as a detached HEAD.
/// </summary>
/// <param name="repository">The repository to act on</param>
/// <param name="branch">The <see cref="Branch"/> to check out.</param>
/// <param name="options"><see cref="CheckoutOptions"/> controlling checkout behavior.</param>
/// <returns>The <see cref="Branch"/> that was checked out.</returns>
public static Branch Checkout(IRepository repository, Branch branch, CheckoutOptions options)
{
Ensure.ArgumentNotNull(repository, "repository");
Ensure.ArgumentNotNull(branch, "branch");
Ensure.ArgumentNotNull(options, "options");
// Make sure this is not an unborn branch.
if (branch.Tip == null)
{
throw new UnbornBranchException("The tip of branch '{0}' is null. There's nothing to checkout.",
branch.FriendlyName);
}
if (!branch.IsRemote && !(branch is DetachedHead) &&
string.Equals(repository.Refs[branch.CanonicalName].TargetIdentifier, branch.Tip.Id.Sha,
StringComparison.OrdinalIgnoreCase))
{
Checkout(repository, branch.Tip.Tree, options, branch.CanonicalName);
}
else
{
Checkout(repository, branch.Tip.Tree, options, branch.Tip.Id.Sha);
}
return repository.Head;
}
开发者ID:PKRoma,项目名称:libgit2sharp,代码行数:35,代码来源:Checkout.cs
示例17: Stalker
//readonly Tree masterTree;
//readonly Tree currentTree;
public Stalker(String localRepo, String sourceFileName, String ignoreFileName, String localStalkBranch = null, String targetTag = null, String localMaster = "master")
{
repo = new Repository (localRepo);
master = repo.Branches.Single (branch => branch.FriendlyName == localMaster);
if (targetTag != null) {
tag = repo.Tags.Single (t => t.FriendlyName == targetTag);
}
// if (localStalkBranch != null)
head = repo.Branches.Single (branch => branch.FriendlyName == localStalkBranch);
// else
// head = repo.Head;
// if (head != repo.Branches.Single (b => b.IsCurrentRepositoryHead)) {
// repo.Checkout(head);
// }
// head = repo.Branches.Single(b => b.IsCurrentRepositoryHead);
//var filter = new CommitFilter { Since = repo.Branches["master"], Until = repo.Branches["development"] };
//masterTree = repo.Lookup<Tree>(master.Tip.Sha);
//currentTree = repo.Lookup<Tree>(head.Tip.Sha);
try {
sources = File.ReadAllLines (Path.Combine (localRepo, sourceFileName));
} catch {
} finally {
}
try {
ignore = File.ReadAllLines (Path.Combine (localRepo, ignoreFileName));
} catch {
} finally {
}
}
开发者ID:sushihangover,项目名称:ForkStalker,代码行数:35,代码来源:Stalker.cs
示例18: Employee
public Employee(Branch branch, Position position, PersonName name, Gender gender)
: base(name)
{
_branch = branch;
_position = position;
base.Gender = gender;
}
开发者ID:gofixiao,项目名称:Macsauto-Backup,代码行数:7,代码来源:Employee.cs
示例19: MainViewModel
public MainViewModel(KeyHooker hookerKey, MouseHooker hookerMouse, KeySenderInput keySenderInput, MouseSenderInput mouseSenderInput)
{
mHookerKey = hookerKey;
mHookerKey.SetHook();
mHookerMouse = hookerMouse;
mHookerMouse.SetHook();
mKeySenderInput = keySenderInput;
mMouseSenderInput = mouseSenderInput;
mStopMacroBranch = new Branch<IInput>(mInputEqualityComparer);
mMacrosModeBranch = new Branch<IInput>(mInputEqualityComparer);
Settings.Default.Setting = Settings.Default.Setting ?? new AppSettings(mInputEqualityComparer);
AppSettings settings = Settings.Default.Setting;
mTreeRoot = settings.TreeRoot;
mTreeSequence = settings.TreeSequence;
MacrosCollection = settings.MacrosCollection;
StopMacroCollection = settings.SequenceStopMacro;
MacrosModeCollection = settings.SequenceMacrosMode;
SequenceCollection = settings.Sequence;
MacroCollection = settings.Macro;
mSequenceReader = new HookNotRepeatReader(mHookerKey, SequenceCollection);
ObservableCollection<IInput> tempCollection = new ObservableCollection<IInput>(MacroCollection.Cast<IInput>());
tempCollection.CollectionChanged += ReadMacro_CollectionChanged;
mMacroReader = new MultiHookNotRepeatReader(new List<IHooker> { mHookerKey, mHookerMouse }, tempCollection);
mStopMacroReader = new HookNotRepeatReader(mHookerKey, StopMacroCollection);
mMacrosModeReader = new HookNotRepeatReader(mHookerKey, MacrosModeCollection);
RecordSequenceCommand = new RelayCommand(RecordSequence);
RecordMacroCommand = new RelayCommand(RecordMacro);
CreateMacrosCommand = new RelayCommand(CreateMacros);
CleanRowsSequenceCommand = new RelayCommand(CleanSequence);
CleanRowsMacroCommand = new RelayCommand(CleanMacro);
CleanRowsMacrosCommand = new RelayCommand(CleanMacros);
DeleteRowSequenceCommand = new RelayCommand<IInput>(RemoveSequence);
DeleteRowMacroCommand = new RelayCommand<InputDelay>(RemoveMacro);
DeleteRowMacrosCommand = new RelayCommand<Macros>(RemoveMacros);
StopRecordStopMacroCommand = new RelayCommand(StopRecordStopMacro);
StartRecordStopMacroCommand = new RelayCommand(StartRecordStopMacro);
StartRecordMacrosModeCommand = new RelayCommand(StartRecordMacrosMode);
StopRecordMacrosModeCommand = new RelayCommand(StopRecordMacrosMode);
SetDefaultDelayCommand = new RelayCommand(SetDefaultDelay);
StopAllRecordCommand = new RelayCommand(StopAllRecord);
mCancellationState = new CancelState<IInput>(mInputEqualityComparer);
StateWalker<IInput> machineWalker = new StateWalker<IInput>(mTreeRoot);
mHookerKey.Hooked += arg =>
{
State<IInput> currentState = machineWalker.WalkStates(arg);
return currentState is FunctionState<IInput>
? (bool)((FunctionState<IInput>)currentState).ExecuteFunction()
: currentState is CancellationFunctionState<IInput>
? (bool)((CancellationFunctionState<IInput>)currentState).ExecuteFunction(mCancellationState.CancelToken)
: true;
};
}
开发者ID:EmptyBucket,项目名称:MacroKey,代码行数:59,代码来源:MainViewModel.cs
示例20: GenerateCode
public string GenerateCode(Branch b, string newLine)
{
if (string.IsNullOrEmpty(b.Path))
return string.Format("(\"{0}\", {1})", b.Name, GenerateCode(b.Tree, newLine)); ;
return string.Format("(\"{0}\", {1} {2} {3} )", b.Name,
b.Many ? "mapTrees" : "mapTree", b.Path, GenerateCode(b.Tree, newLine)); ;
}
开发者ID:ibrahimbensalah,项目名称:XmallSteps,代码行数:8,代码来源:CalculationCodeGenerator.cs
注:本文中的Branch类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论