当前位置: 首页>>代码示例>>C#>>正文


C# Git.GitRepository类代码示例

本文整理汇总了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 ();
			}
		}
开发者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


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