本文整理汇总了C#中MonoDevelop.VersionControl.Git.GitRepository类的典型用法代码示例。如果您正苦于以下问题:C# GitRepository类的具体用法?C# GitRepository怎么用?C# GitRepository使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GitRepository类属于MonoDevelop.VersionControl.Git命名空间,在下文中一共展示了GitRepository类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShowMergeDialog
public static void ShowMergeDialog (GitRepository repo, bool rebasing)
{
var dlg = new MergeDialog (repo, rebasing);
try {
if (MessageService.RunCustomDialog (dlg) == (int) Gtk.ResponseType.Ok) {
dlg.Hide ();
if (rebasing) {
using (ProgressMonitor monitor = VersionControlService.GetProgressMonitor (GettextCatalog.GetString ("Rebasing branch '{0}'...", dlg.SelectedBranch))) {
if (dlg.IsRemote)
repo.Fetch (monitor, dlg.RemoteName);
repo.Rebase (dlg.SelectedBranch, dlg.StageChanges ? GitUpdateOptions.SaveLocalChanges : GitUpdateOptions.None, monitor);
}
} else {
using (ProgressMonitor monitor = VersionControlService.GetProgressMonitor (GettextCatalog.GetString ("Merging branch '{0}'...", dlg.SelectedBranch))) {
if (dlg.IsRemote)
repo.Fetch (monitor, dlg.RemoteName);
repo.Merge (dlg.SelectedBranch, dlg.StageChanges ? GitUpdateOptions.SaveLocalChanges : GitUpdateOptions.None, monitor, FastForwardStrategy.NoFastForward);
}
}
}
} finally {
dlg.Destroy ();
dlg.Dispose ();
}
}
示例2: GetRepositoryReference
public override Repository GetRepositoryReference (FilePath path, string id)
{
GitRepository repo;
if (!repositories.TryGetValue (path.CanonicalPath, out repo) || repo.Disposed)
repositories [path.CanonicalPath] = repo = new GitRepository (this, path, null);
return repo;
}
示例3: EditBranchDialog
public EditBranchDialog (GitRepository repo, string name, string tracking)
{
this.Build ();
this.repo = repo;
oldName = name;
currentTracking = tracking;
this.UseNativeContextMenus ();
comboStore = new ListStore (typeof(string), typeof(Xwt.Drawing.Image), typeof (string), typeof(string));
comboSources.Model = comboStore;
var crp = new CellRendererImage ();
comboSources.PackStart (crp, false);
comboSources.AddAttribute (crp, "image", 1);
var crt = new CellRendererText ();
comboSources.PackStart (crt, true);
comboSources.AddAttribute (crt, "text", 2);
SemanticModelAttribute modelAttr = new SemanticModelAttribute ("comboStore__Branch", "comboStore__Icon", "comboStore__Name", "comboStore__Tracking");
TypeDescriptor.AddAttributes (comboStore, modelAttr);
foreach (Branch b in repo.GetBranches ()) {
AddValues (b.FriendlyName, ImageService.GetIcon ("vc-branch", IconSize.Menu), "refs/heads/");
}
foreach (Remote r in repo.GetRemotes ()) {
foreach (string b in repo.GetRemoteBranches (r.Name))
AddValues (r.Name + "/" + b, ImageService.GetIcon ("vc-repository", IconSize.Menu), "refs/remotes/");
}
entryName.Text = name;
checkTrack.Active = !string.IsNullOrEmpty (tracking);
UpdateStatus ();
}
示例4: MergeDialog
public MergeDialog (GitRepository repo, bool rebasing)
{
this.Build ();
this.repo = repo;
this.rebasing = rebasing;
store = new TreeStore (typeof(string), typeof(Gdk.Pixbuf), typeof (string), typeof(string));
tree.Model = store;
CellRendererPixbuf crp = new CellRendererPixbuf ();
TreeViewColumn col = new TreeViewColumn ();
col.PackStart (crp, false);
col.AddAttribute (crp, "pixbuf", 1);
CellRendererText crt = new CellRendererText ();
col.PackStart (crt, true);
col.AddAttribute (crt, "text", 2);
tree.AppendColumn (col);
tree.Selection.Changed += HandleTreeSelectionChanged;
if (rebasing) {
labelHeader.Text = GettextCatalog.GetString ("Select the branch to which to rebase:");
checkStage.Label = GettextCatalog.GetString ("Stash/unstash local changes before/after rebasing");
}
checkStage.Active = true;
Fill ();
}
示例5: MergeDialog
public MergeDialog (GitRepository repo, bool rebasing)
{
this.Build ();
this.UseNativeContextMenus ();
this.repo = repo;
this.rebasing = rebasing;
store = new TreeStore (typeof(string), typeof(Xwt.Drawing.Image), typeof (string), typeof(string));
tree.Model = store;
var crp = new CellRendererImage ();
var col = new TreeViewColumn ();
col.PackStart (crp, false);
col.AddAttribute (crp, "image", 1);
var crt = new CellRendererText ();
col.PackStart (crt, true);
col.AddAttribute (crt, "text", 2);
tree.AppendColumn (col);
tree.Selection.Changed += HandleTreeSelectionChanged;
if (rebasing) {
labelHeader.Text = GettextCatalog.GetString ("Select the branch to which to rebase:");
checkStage.Label = GettextCatalog.GetString ("Stash/unstash local changes before/after rebasing");
buttonOk.Label = GettextCatalog.GetString ("Rebase");
}
checkStage.Active = true;
Fill ();
}
示例6: GitConfigurationDialog
public GitConfigurationDialog (GitRepository repo)
{
this.Build ();
this.repo = repo;
this.HasSeparator = false;
// Branches list
storeBranches = new ListStore (typeof(Branch), typeof(string), typeof(string), typeof(string));
listBranches.Model = storeBranches;
listBranches.HeadersVisible = true;
listBranches.AppendColumn (GettextCatalog.GetString ("Branch"), new CellRendererText (), "markup", 1);
listBranches.AppendColumn (GettextCatalog.GetString ("Tracking"), new CellRendererText (), "text", 2);
// Sources tree
storeRemotes = new TreeStore (typeof(RemoteSource), typeof(string), typeof(string), typeof(string), typeof(string));
treeRemotes.Model = storeRemotes;
treeRemotes.HeadersVisible = true;
treeRemotes.AppendColumn ("Remote Source / Branch", new CellRendererText (), "markup", 1);
treeRemotes.AppendColumn ("Url", new CellRendererText (), "text", 2);
// Fill data
FillBranches ();
FillRemotes ();
}
示例7: Push
public static void Push (GitRepository repo)
{
var dlg = new PushDialog (repo);
try {
if (MessageService.RunCustomDialog (dlg) != (int) Gtk.ResponseType.Ok)
return;
string remote = dlg.SelectedRemote;
string branch = dlg.SelectedRemoteBranch ?? repo.GetCurrentBranch ();
ProgressMonitor monitor = VersionControlService.GetProgressMonitor (GettextCatalog.GetString ("Pushing changes..."), VersionControlOperationType.Push);
ThreadPool.QueueUserWorkItem (delegate {
try {
repo.Push (monitor, remote, branch);
} catch (Exception ex) {
monitor.ReportError (ex.Message, ex);
} finally {
monitor.Dispose ();
}
});
} finally {
dlg.Destroy ();
dlg.Dispose ();
}
}
示例8: SwitchToBranch
public static void SwitchToBranch (GitRepository repo, string branch)
{
IdeApp.Workbench.AutoReloadDocuments = true;
try {
repo.SwitchToBranch (branch);
} finally {
IdeApp.Workbench.AutoReloadDocuments = false;
}
}
示例9: OnSolutionSaved
static void OnSolutionSaved (object o, EventArgs a)
{
Solution sol = (Solution)o;
sol.Saved -= OnSolutionSaved;
GitUtil.Init (sol.BaseDirectory, null, null);
GitRepository gitRepo = new GitRepository (sol.BaseDirectory, null);
gitRepo.Add (sol.GetItemFiles (true).ToArray (), false, new MonoDevelop.Core.ProgressMonitoring.NullProgressMonitor ());
}
示例10: GitCommitDialogExtensionWidget
public GitCommitDialogExtensionWidget (GitRepository repo)
{
this.Build ();
bool hasRemote = repo.GetCurrentRemote () != null;
if (!hasRemote) {
checkPush.Sensitive = false;
checkPush.TooltipText = GettextCatalog.GetString ("Pushing is only available for repositories with configured remotes.");
}
}
示例11: GetRepositoryReference
public override Repository GetRepositoryReference (FilePath path, string id)
{
if (path.IsEmpty || path.ParentDirectory.IsEmpty || path.IsNull || path.ParentDirectory.IsNull)
return null;
if (path.IsGitRepository ()) {
GitRepository repo;
if (!repositories.TryGetValue (path.CanonicalPath, out repo))
repositories [path.CanonicalPath] = repo = new GitRepository (path, null);
return repo;
}
return GetRepositoryReference (path.ParentDirectory, id);
}
示例12: GetRepositoryReference
public override Repository GetRepositoryReference (FilePath path, string id)
{
if (path.IsEmpty || path.ParentDirectory.IsEmpty || path.IsNull || path.ParentDirectory.IsNull)
return null;
if (System.IO.Directory.Exists (path.Combine (".git"))) {
GitRepository repo;
if (!repositories.TryGetValue (path.CanonicalPath, out repo))
repositories [path.CanonicalPath] = repo = new GitRepository (path, null);
return repo;
}
else
return GetRepositoryReference (path.ParentDirectory, id);
}
示例13: ShowMergeDialog
public static void ShowMergeDialog (GitRepository repo)
{
MergeDialog dlg = new MergeDialog (repo);
try {
if (MessageService.RunCustomDialog (dlg) == (int) Gtk.ResponseType.Ok) {
dlg.Hide ();
using (IProgressMonitor monitor = VersionControlService.GetProgressMonitor (GettextCatalog.GetString ("Merging branch '{0}'...", dlg.SelectedBranch))) {
repo.Merge (dlg.SelectedBranch, monitor);
}
}
} finally {
dlg.Destroy ();
}
}
示例14: PushDialog
public PushDialog (GitRepository repo)
{
this.Build ();
this.repo = repo;
HasSeparator = false;
changeList.DiffLoader = DiffLoader;
List<string> list = new List<string> (repo.GetRemotes ().Select (r => r.Name));
foreach (string s in list)
remoteCombo.AppendText (s);
remoteCombo.Active = list.IndexOf (repo.GetCurrentRemote ());
UpdateChangeSet ();
}
示例15: GitConfigurationDialog
public GitConfigurationDialog (GitRepository repo)
{
this.Build ();
this.repo = repo;
this.HasSeparator = false;
// Branches list
storeBranches = new ListStore (typeof(Branch), typeof(string), typeof(string), typeof(string));
listBranches.Model = storeBranches;
listBranches.HeadersVisible = true;
listBranches.AppendColumn (GettextCatalog.GetString ("Branch"), new CellRendererText (), "markup", 1);
listBranches.AppendColumn (GettextCatalog.GetString ("Tracking"), new CellRendererText (), "text", 2);
listBranches.Selection.Changed += delegate {
TreeIter it;
if (!listBranches.Selection.GetSelected (out it))
return;
string currentBranch = repo.GetCurrentBranch ();
var b = (Branch) storeBranches.GetValue (it, 0);
buttonRemoveBranch.Sensitive = b.Name != currentBranch;
};
// Sources tree
storeRemotes = new TreeStore (typeof(RemoteSource), typeof(string), typeof(string), typeof(string), typeof(string));
treeRemotes.Model = storeRemotes;
treeRemotes.HeadersVisible = true;
treeRemotes.AppendColumn ("Remote Source / Branch", new CellRendererText (), "markup", 1);
treeRemotes.AppendColumn ("Url", new CellRendererText (), "text", 2);
// Tags list
storeTags = new ListStore (typeof(string));
listTags.Model = storeTags;
listTags.HeadersVisible = true;
listTags.AppendColumn (GettextCatalog.GetString ("Tag"), new CellRendererText (), "text", 0);
// Fill data
FillBranches ();
FillRemotes ();
FillTags ();
}