Got viewing files and diffing files (arbitrary commits) to work.
[Widgit.git] / UI / RevisionChooser.cs
blob8a4a02f5a1c24c99ec47cc72d07a42f248fa3718
1 using System;
2 using System.Collections.Generic;
3 using System.ComponentModel;
4 using System.Data;
5 using System.Drawing;
6 using System.Text;
7 using System.Windows.Forms;
8 using Git;
10 namespace Widgit
12 public partial class RevisionChooser : Form
14 Repo m_currentRepo;
15 public RevisionChooser()
17 InitializeComponent();
20 private void OnBranchSelected(object sender, EventArgs e)
22 m_tags.SelectedIndex = 0;
23 if (!String.IsNullOrEmpty(m_branches.SelectedItem.ToString()))
25 m_statusTable.Treeish = ((Branch)m_branches.SelectedItem);
26 m_statusTable.RepopulateTable();
30 private void OnTagSelected(object sender, EventArgs e)
32 m_branches.SelectedIndex = 0;
33 if (!String.IsNullOrEmpty(m_tags.SelectedItem.ToString()))
35 m_statusTable.Treeish = ((Tag)m_tags.SelectedItem);
36 m_statusTable.RepopulateTable();
40 public string Choose(Repo repo)
42 m_currentRepo = repo;
43 m_statusTable.SetRepo(m_currentRepo);
44 m_branches.Items.Clear();
45 m_branches.Items.Add("");
46 m_branches.Items.AddRange(repo.Branches.ToArray());
47 m_tags.Items.Clear();
48 m_tags.Items.Add("");
49 m_tags.Items.AddRange(repo.Tags.ToArray());
50 if (DialogResult.OK == ShowDialog())
52 if (m_statusTable.SelectedItems.Count == 1)
54 return ((Treeish)m_statusTable.SelectedItems[0].Tag).ID;
57 return null;