• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Git.GitRepository类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



GitRepository类属于MonoDevelop.VersionControl.Git命名空间,在下文中一共展示了GitRepository类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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 ();
			}
		}
开发者ID:sushihangover,项目名称:monodevelop,代码行数:25,代码来源:GitService.cs


示例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;
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:7,代码来源:GitVersionControl.cs


示例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 ();
		}
开发者ID:sushihangover,项目名称:monodevelop,代码行数:35,代码来源:EditBranchDialog.cs


示例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 ();
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:30,代码来源:MergeDialog.cs


示例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 ();
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:33,代码来源:MergeDialog.cs


示例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 ();
		}
开发者ID:jrhtcg,项目名称:monodevelop,代码行数:29,代码来源:GitConfigurationDialog.cs


示例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 ();
			}
		}
开发者ID:sushihangover,项目名称:monodevelop,代码行数:25,代码来源:GitService.cs


示例8: SwitchToBranch

		public static void SwitchToBranch (GitRepository repo, string branch)
		{
			IdeApp.Workbench.AutoReloadDocuments = true;
			try {
				repo.SwitchToBranch (branch);
			} finally {
				IdeApp.Workbench.AutoReloadDocuments = false;
			}
		}
开发者ID:Tak,项目名称:monodevelop-novell,代码行数:9,代码来源:GitService.cs


示例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 ());
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:9,代码来源:GitSupportFeature.cs


示例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.");
			}
		}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:10,代码来源:GitCommitDialogExtensionWidget.cs


示例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);
		}
开发者ID:rae1,项目名称:monodevelop,代码行数:12,代码来源:GitVersionControl.cs


示例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);
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:13,代码来源:GitVersionControl.cs


示例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 ();
			}
		}
开发者ID:nickname100,项目名称:monodevelop,代码行数:14,代码来源:GitService.cs


示例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 ();
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:15,代码来源:PushDialog.cs


示例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 ();
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:48,代码来源:GitConfigurationDialog.cs


示例16: StashManagerDialog

		public StashManagerDialog (GitRepository repo)
		{
			this.Build ();
			stashes = repo.GetStashes ();
			
			store = new ListStore (typeof(Stash), typeof(string), typeof(string));
			list.Model = store;
			
			list.AppendColumn (GettextCatalog.GetString ("Date/Time"), new CellRendererText (), "text", 1);
			list.AppendColumn (GettextCatalog.GetString ("Comment"), new CellRendererText (), "text", 2);
			Fill ();
			TreeIter it;
			if (store.GetIterFirst (out it))
				list.Selection.SelectIter (it);
			UpdateButtons ();
		}
开发者ID:okrmartin,项目名称:monodevelop,代码行数:16,代码来源:StashManagerDialog.cs


示例17: Push

		public static void Push (GitRepository repo)
		{
			PushDialog dlg = new PushDialog (repo);
			if (dlg.Run () == (int) Gtk.ResponseType.Ok) {
				string remote = dlg.SelectedRemote;
				string branch = dlg.SelectedRemoteBranch;
				dlg.Destroy ();
				IProgressMonitor monitor = VersionControlService.GetProgressMonitor (GettextCatalog.GetString ("Pushing changes..."));
				System.Threading.ThreadPool.QueueUserWorkItem (delegate {
					try {
						repo.Push (monitor, remote, branch);
					} catch (Exception ex) {
						monitor.ReportError (ex.Message, ex);
					} finally {
						monitor.Dispose ();
					}
				});
			} else
				dlg.Destroy ();
		}
开发者ID:pgoron,项目名称:monodevelop,代码行数:20,代码来源:GitService.cs


示例18: Push

		public static void Push (GitRepository repo)
		{
			PushDialog dlg = new PushDialog (repo);
			if (dlg.Run () == (int) Gtk.ResponseType.Ok) {
				string remote = dlg.SelectedRemote;
				string branch = dlg.SelectedRemoteBranch;
				dlg.Destroy ();
				IProgressMonitor monitor = IdeApp.Workbench.ProgressMonitors.GetOutputProgressMonitor ("Version Control", "md-version-control", false, true);
				System.Threading.ThreadPool.QueueUserWorkItem (delegate {
					try {
						repo.Push (monitor, remote, branch);
					} catch (Exception ex) {
						monitor.ReportError (ex.Message, ex);
					} finally {
						monitor.Dispose ();
					}
				});
			} else
				dlg.Destroy ();
		}
开发者ID:acken,项目名称:monodevelop,代码行数:20,代码来源:GitService.cs


示例19: OnInitializeRepository

		virtual protected void OnInitializeRepository()
		{
			var item = GetItems()[0];

			var vcs = (from v in VersionControlService.GetVersionControlSystems()
				   where v is GitVersionControl
				   select v).FirstOrDefault();
			if (vcs != null && vcs.IsInstalled) {
				var rep = new GitRepository(vcs, item.Path);
				rep.Initialize();

				rep.Add(GetAllFiles(item.WorkspaceObject), false, null);

				if (item.WorkspaceObject is Solution)
					((Solution)item.WorkspaceObject).NeedsReload = true;
				else if (item.WorkspaceObject is Project)
					((Project)item.WorkspaceObject).NeedsReload = true;
				else
					System.Diagnostics.Debug.Assert(false, "Item should be either solution or project.");
			}
		}
开发者ID:yvanjanssens,项目名称:monodevelop-git,代码行数:21,代码来源:GitCommandHandler.cs


示例20: SwitchToBranch

		public static void SwitchToBranch (GitRepository repo, string branch)
		{
			MessageDialogProgressMonitor monitor = new MessageDialogProgressMonitor (true, false, false, true);
			try {
				IdeApp.Workbench.AutoReloadDocuments = true;
				IdeApp.Workbench.LockGui ();
				System.Threading.ThreadPool.QueueUserWorkItem (delegate {
					try {
						repo.SwitchToBranch (monitor, branch);
					} catch (Exception ex) {
						monitor.ReportError ("Branch switch failed", ex);
					} finally {
						monitor.Dispose ();
					}
				});
				monitor.AsyncOperation.WaitForCompleted ();
			} finally {
				IdeApp.Workbench.AutoReloadDocuments = false;
				IdeApp.Workbench.UnlockGui ();
			}
		}
开发者ID:nickname100,项目名称:monodevelop,代码行数:21,代码来源:GitService.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Git.GitRevision类代码示例发布时间:2022-05-26
下一篇:
C# Git.GitMonitor类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap