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


C# GitRepository.GetHistory方法代码示例

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


在下文中一共展示了GitRepository.GetHistory方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GitSelectRevisionDialog

		public GitSelectRevisionDialog (GitRepository repo)
		{
			Title = GettextCatalog.GetString ("Select a revision");

			var vbox = new Xwt.VBox ();
			vbox.MinHeight = 400;
			vbox.MinWidth = 600;

			vbox.PackStart(new Xwt.Label (GettextCatalog.GetString ("Tag Name")));

			tagNameEntry = new Xwt.TextEntry ();
			tagNameEntry.Changed += delegate {
				CheckSensitive ();
			};
			vbox.PackStart (tagNameEntry);

			vbox.PackStart (new Xwt.Label (GettextCatalog.GetString ("Tag Message")));

			tagMessageEntry = new Xwt.TextEntry ();
			vbox.PackStart (tagMessageEntry);

			revisionList = new Xwt.ListView ();
			messageField = new Xwt.DataField<string> ();
			dateField = new Xwt.DataField<string> ();
			authorField = new Xwt.DataField<string> ();
			shaField = new Xwt.DataField<string> ();
			revisionField = new Xwt.DataField<Revision> ();

			revisionStore = new Xwt.ListStore (messageField, dateField, authorField, shaField, revisionField);
			revisionList.DataSource = revisionStore;

			messageColumn = new Xwt.ListViewColumn (GettextCatalog.GetString ("Message"), new Xwt.TextCellView (messageField) { Ellipsize = Xwt.EllipsizeMode.End });
			revisionList.Columns.Add (messageColumn);
			dateColumn = new Xwt.ListViewColumn (GettextCatalog.GetString ("Date"), new Xwt.TextCellView (dateField));
			revisionList.Columns.Add (dateColumn);
			authorColumn = new Xwt.ListViewColumn (GettextCatalog.GetString ("Author"), new Xwt.TextCellView (authorField));
			revisionList.Columns.Add (authorColumn);
			shaColumn = new Xwt.ListViewColumn (GettextCatalog.GetString ("Revision"), new Xwt.TextCellView (shaField));
			revisionList.Columns.Add (shaColumn);

			var history = repo.GetHistory (repo.RootPath, null);
			var min = Math.Min (history.Length, 150);
			for (int i = 0; i < min; ++i) {
				var rev = history [i];

				// Convert to foreach and use i = AddRow ();
				revisionStore.AddRow ();
				revisionStore.SetValue (i, messageField, rev.ShortMessage);
				revisionStore.SetValue (i, dateField, ParseDate (rev.Time));
				revisionStore.SetValue (i, authorField, rev.Author);
				revisionStore.SetValue (i, shaField, ((GitRevision)rev).ShortName);
				revisionStore.SetValue (i, revisionField, rev);
			}

			revisionList.SelectionChanged += delegate {
				CheckSensitive ();
			};

			vbox.PackStart (revisionList, true, true);

			Content = vbox;

			buttonOk = new Xwt.DialogButton (Xwt.Command.Ok) {
				Sensitive = false
			};
			Buttons.Add (buttonOk);
			Buttons.Add (new Xwt.DialogButton (Xwt.Command.Cancel));
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:68,代码来源:GitSelectRevisionDialog.cs

示例2: GitSelectRevisionDialog

		public GitSelectRevisionDialog (GitRepository repo)
		{
			Title = GettextCatalog.GetString ("Select a revision");

			var vbox = new Xwt.VBox ();
			vbox.MinHeight = 400;
			vbox.MinWidth = 800;

			vbox.PackStart(new Xwt.Label (GettextCatalog.GetString ("Tag Name")));

			tagNameEntry = new Xwt.TextEntry { Name = "tagNameEntry" };
			tagNameEntry.Changed += delegate {
				CheckSensitive ();
			};
			vbox.PackStart (tagNameEntry);

			vbox.PackStart (new Xwt.Label (GettextCatalog.GetString ("Tag Message")));

			tagMessageEntry = new Xwt.TextEntry { Name = "tagMessageEntry" };
			vbox.PackStart (tagMessageEntry);

			revisionList = new Xwt.ListView ();
			messageField = new Xwt.DataField<string> ();
			dateField = new Xwt.DataField<string> ();
			authorField = new Xwt.DataField<string> ();
			shaField = new Xwt.DataField<string> ();
			revisionField = new Xwt.DataField<Revision> ();

			revisionStore = new Xwt.ListStore (messageField, dateField, authorField, shaField, revisionField);
			revisionList.DataSource = revisionStore;

			messageColumn = new Xwt.ListViewColumn (GettextCatalog.GetString ("Message"), new Xwt.TextCellView (messageField)) {
				CanResize = true,
				Alignment = Xwt.Alignment.Center,
			};

			revisionList.Columns.Add (messageColumn);
			dateColumn = new Xwt.ListViewColumn (GettextCatalog.GetString ("Date"), new Xwt.TextCellView (dateField)) {
				CanResize = true,
				Alignment = Xwt.Alignment.Center,
			};
			revisionList.Columns.Add (dateColumn);
			authorColumn = new Xwt.ListViewColumn (GettextCatalog.GetString ("Author"), new Xwt.TextCellView (authorField)) {
				CanResize = true,
				Alignment = Xwt.Alignment.Center,
			};
			revisionList.Columns.Add (authorColumn);
			shaColumn = new Xwt.ListViewColumn (GettextCatalog.GetString ("Revision"), new Xwt.TextCellView (shaField)) {
				CanResize = true,
				Alignment = Xwt.Alignment.Center,
			};
			revisionList.Columns.Add (shaColumn);

			Task.Factory.StartNew (async () => {
				const int sliceSize = 150;

				var history = repo.GetHistory (repo.RootPath, null);

				int slices = history.Length / sliceSize;
				for (int i = 0; i < slices; ++i) {
					await Runtime.RunInMainThread (() => {
						for (int n = 0; n < sliceSize; ++n) {
							if (cts.IsCancellationRequested)
								return;

							int row = revisionStore.AddRow ();
							var rev = history [row];

							revisionStore.SetValue (row, messageField, rev.ShortMessage);
							revisionStore.SetValue (row, dateField, ParseDate (rev.Time));
							revisionStore.SetValue (row, authorField, rev.Author);
							revisionStore.SetValue (row, shaField, ((GitRevision)rev).ShortName);
							revisionStore.SetValue (row, revisionField, rev);
						}
					});
				}
			}, cts.Token);

			revisionList.SelectionChanged += delegate {
				CheckSensitive ();
			};

			vbox.PackStart (revisionList, true, true);

			Content = vbox;

			buttonOk = new Xwt.DialogButton (Xwt.Command.Ok) {
				Sensitive = false
			};
			Buttons.Add (buttonOk);
			Buttons.Add (new Xwt.DialogButton (Xwt.Command.Cancel));
		}
开发者ID:sushihangover,项目名称:monodevelop,代码行数:92,代码来源:GitSelectRevisionDialog.cs


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