本文整理汇总了C#中NGit.Api.Git.SetName方法的典型用法代码示例。如果您正苦于以下问题:C# Git.SetName方法的具体用法?C# Git.SetName怎么用?C# Git.SetName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NGit.Api.Git
的用法示例。
在下文中一共展示了Git.SetName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SwitchToBranch
public void SwitchToBranch (IProgressMonitor monitor, string branch)
{
monitor.BeginTask (GettextCatalog.GetString ("Switching to branch {0}", branch), GitService.StashUnstashWhenSwitchingBranches ? 4 : 2);
// Get a list of files that are different in the target branch
IEnumerable<DiffEntry> statusList = GitUtil.GetChangedFiles (RootRepository, branch);
StashCollection stashes = null;
Stash stash = null;
if (GitService.StashUnstashWhenSwitchingBranches) {
stashes = GitUtil.GetStashes (RootRepository);
// Remove the stash for this branch, if exists
string currentBranch = GetCurrentBranch ();
stash = GetStashForBranch (stashes, currentBranch);
if (stash != null)
stashes.Remove (stash);
// Create a new stash for the branch. This allows switching branches
// without losing local changes
using (var gm = new GitMonitor (monitor))
stash = stashes.Create (gm, GetStashName (currentBranch));
monitor.Step (1);
}
// Replace with NGit.Api.Git ().Checkout ()
// Switch to the target branch
var checkout = new NGit.Api.Git (RootRepository).Checkout ();
checkout.SetName (branch);
try {
checkout.Call ();
} finally {
// Restore the branch stash
if (GitService.StashUnstashWhenSwitchingBranches) {
stash = GetStashForBranch (stashes, branch);
if (stash != null) {
using (var gm = new GitMonitor (monitor))
stash.Apply (gm);
stashes.Remove (stash);
}
monitor.Step (1);
}
}
// Notify file changes
NotifyFileChanges (monitor, statusList);
if (BranchSelectionChanged != null)
BranchSelectionChanged (this, EventArgs.Empty);
monitor.EndTask ();
}
示例2: CreateBranch
public void CreateBranch (string name, string trackSource)
{
var create = new NGit.Api.Git (RootRepository).BranchCreate ();
if (!String.IsNullOrEmpty (trackSource))
create.SetStartPoint (trackSource);
create.SetName (name);
create.Call ();
}
示例3: AddTag
public void AddTag (string name, Revision rev, string message)
{
var addTag = new NGit.Api.Git (RootRepository).Tag ();
var gitRev = (GitRevision)rev;
addTag.SetName (name).SetMessage (message).SetObjectId (gitRev.Commit);
addTag.SetObjectId (gitRev.Commit).SetTagger (new PersonIdent (RootRepository));
addTag.Call ();
}
示例4: CreateBranchFromCommit
public void CreateBranchFromCommit (string name, RevCommit id)
{
var create = new NGit.Api.Git (RootRepository).BranchCreate ();
if (id != null)
create.SetStartPoint (id);
create.SetName (name);
create.Call ();
}