Skip to content

Commit

Permalink
add commit search
Browse files Browse the repository at this point in the history
  • Loading branch information
yysun committed Feb 8, 2012
1 parent b774207 commit 64fe114
Show file tree
Hide file tree
Showing 7 changed files with 114 additions and 30 deletions.
6 changes: 5 additions & 1 deletion GitApi/DataServices/Commit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,9 @@ public class Commit
public DateTime CommitDate { get; set; }
public string CommitDateRelative { get; set; }
internal bool deleted { get; set; }
}

public override string ToString()
{
return string.Format("[{0}] {1}", Id.Substring(0, 7), Message.Replace("\r", ""));
} }
}
Expand Down
4 changes: 2 additions & 2 deletions GitUI/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
<Grid x:Name="rootGrid" MouseRightButtonUp="rootGrid_MouseRightButtonUp">
<GitScc_UI:HistoryGraph HorizontalAlignment="Stretch" VerticalAlignment="Stretch" x:Name="graph"/>

<my:MainToolBar x:Name="topToolBar" Height="60" Visibility="Collapsed"
<my:MainToolBar x:Name="topToolBar" Height="90" Visibility="Collapsed"
HorizontalAlignment="Stretch" VerticalAlignment="Top">
<my:MainToolBar.RenderTransform>
<TranslateTransform Y="-60" />
<TranslateTransform Y="-690" />
</my:MainToolBar.RenderTransform>
</my:MainToolBar>

Expand Down
2 changes: 1 addition & 1 deletion GitUI/UI/CommitDetails.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
<Label Content="Author" HorizontalAlignment="Right" Margin="0,0,6,0" Name="lblAuthor" VerticalAlignment="Bottom" FontSize="10"/>
<Button Content="back to graphic view" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,6,10,0" Padding="10,0"
Command="cmd:HistoryViewCommands.CloseCommitDetails" Template="{DynamicResource BackButtonControlTemplate}" ToolTip="Back to graphic view" />
<Button HorizontalAlignment="Right" Margin="0,6,40,0" Name="btnSwitch" VerticalAlignment="Top" Click="btnSwitch_Click" Template="{DynamicResource btnSwitchControlTemplate}" RenderTransformOrigin="-1.5,0.542" ToolTip="Reverse the comparison order" />
<Button HorizontalAlignment="Right" Margin="0,6,40,0" Name="btnSwitch" VerticalAlignment="Top" Click="btnSwitch_Click" Template="{DynamicResource btnSwitchControlTemplate}" RenderTransformOrigin="-1.5,0.542" ToolTip="Reverse the comparison order" Visibility="Collapsed" />
<Grid.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFF2F2F2" Offset="0" />
Expand Down
2 changes: 1 addition & 1 deletion GitUI/UI/CommitDetails.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ internal void Show(GitFileStatusTracker tracker, string commitId)
this.radioShowFileTree.IsEnabled = true;

//this.lblCommit.Content = commit.Id;
this.lblMessage.Content = string.Format("[{0}] {1}", commit.Id.Substring(0, 7), commit.Message.Replace("\r", ""));
this.lblMessage.Content = commit.ToString();
this.lblAuthor.Content = commit.CommitterName + " " + commit.CommitDateRelative;
//this.fileTree.ItemsSource = repositoryGraph.GetTree(commitId).Children;
this.patchList.ItemsSource = repositoryGraph.GetChanges(commitId);
Expand Down
17 changes: 10 additions & 7 deletions GitUI/UI/MainToolBar.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="60" d:DesignWidth="500">
d:DesignHeight="90" d:DesignWidth="500">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="ResourceDictionary.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid PreviewKeyDown="Grid_PreviewKeyDown">
<Grid.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFF2F2F2" Offset="0" />
Expand All @@ -23,20 +23,23 @@

<Label Content="Branches" Height="28" HorizontalAlignment="Left" Margin="6,2,0,0" x:Name="label1" VerticalAlignment="Top" FontSize="10" />
<Label Content="Tags" Height="28" HorizontalAlignment="Left" Margin="6,26,0,0" x:Name="label2" VerticalAlignment="Top" FontSize="10" />
<ListBox x:Name="branchList" Margin="60,4,160,36" ItemsPanel="{DynamicResource ItemsPanelTemplate1}" ItemTemplate="{DynamicResource DataTemplate1}"
<ListBox x:Name="branchList" Margin="60,3,200,67" ItemsPanel="{DynamicResource ItemsPanelTemplate1}" ItemTemplate="{DynamicResource DataTemplate1}"
Background="#00000000" BorderBrush="{x:Null}" Height="20" ItemContainerStyle="{DynamicResource ListBoxItemStyle1}"
ScrollViewer.HorizontalScrollBarVisibility="hidden" ScrollViewer.VerticalScrollBarVisibility="Hidden" SelectionChanged="branchList_SelectionChanged" />

<ListBox x:Name="tagList" Margin="60,26,160,14" ItemsPanel="{DynamicResource ItemsPanelTemplate1}" ItemTemplate="{DynamicResource DataTemplate1}"
<ListBox x:Name="tagList" Margin="60,27,200,43" ItemsPanel="{DynamicResource ItemsPanelTemplate1}" ItemTemplate="{DynamicResource DataTemplate1}"
Background="#00000000" BorderBrush="{x:Null}" Height="20" ItemContainerStyle="{DynamicResource ListBoxItemStyle1}"
ScrollViewer.HorizontalScrollBarVisibility="hidden" ScrollViewer.VerticalScrollBarVisibility="Hidden" SelectionChanged="tagList_SelectionChanged" />
<CheckBox Content="Show simplified graph" HorizontalAlignment="Right" Margin="0,8,43,0" Name="checkBox1" Template="{DynamicResource ShowSimpleGraphCheckBoxControlTemplate}"
VerticalAlignment="Top" ToolTip="Toggle View" Click="checkBox1_Click"/>

<Label Content="Simplified view: off" HorizontalAlignment="Right" Margin="0,0,13,1.586" Name="lableView" VerticalAlignment="Bottom" FontSize="9.333" />
<Label Content="Simplified view: off" HorizontalAlignment="Right" Margin="0,28,12,39.586" Name="lableView" FontSize="9.333" d:LayoutOverrides="Height" />

<Button Content="Button" HorizontalAlignment="Right" Margin="0,8,72,28" Template="{DynamicResource SaveButtonControlTemplate}" Command="cmd:HistoryViewCommands.ExportGraph" ToolTip="Export graph ..." />
<Button Content="Button" HorizontalAlignment="Right" Margin="0,8.001,13,27.999" Template="{DynamicResource ButtonRefreshTemplate}" Command="cmd:HistoryViewCommands.RefreshGraph" ToolTip="Refresh" />
<Button Content="Button" HorizontalAlignment="Right" Margin="0,8,72,28" Template="{DynamicResource SaveButtonControlTemplate}" Command="cmd:HistoryViewCommands.ExportGraph" ToolTip="Export graph ..." VerticalAlignment="Top" />
<Button Content="Button" HorizontalAlignment="Right" Margin="0,8.001,13,27.999" Template="{DynamicResource ButtonRefreshTemplate}" Command="cmd:HistoryViewCommands.RefreshGraph" ToolTip="Refresh" VerticalAlignment="Top" />
<Label Content="Commits" Height="28" HorizontalAlignment="Left" Margin="8,54,0,0" VerticalAlignment="Top" FontSize="10" />
<TextBox TextWrapping="Wrap" VerticalAlignment="Bottom" Margin="60,0,200,12.04" x:Name="txtSearch" TextChanged="txtSearch_TextChanged" PreviewKeyDown="txtSearch_PreviewKeyDown" PreviewMouseDown="txtSearch_PreviewMouseDown" />
<ListBox Height="100" Margin="60,0,200,-88.96" VerticalAlignment="Bottom" x:Name="lstSearch" Visibility="Collapsed" PreviewKeyDown="lstSearch_PreviewKeyDown" />
<!--<Button Content="Button" HorizontalAlignment="Right" Margin="0,8,72,28" Template="{DynamicResource CompareButtonControlTemplate}" ToolTip="Select two commits to compare ..." Name="btnCompare" Click="btnCompare_Click" />
<Button Content="0" HorizontalAlignment="Right" Margin="0,8,100,0" Name="btnCommitCount" VerticalAlignment="Top" Template="{DynamicResource CommitCountControlTemplate}" RenderTransformOrigin="-1.125,0.438" Click="btnCommitCount_Click" ToolTip="Click to clear selection" />-->
</Grid>
Expand Down
79 changes: 79 additions & 0 deletions GitUI/UI/MainToolBar.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,84 @@ private void btnRefresh_Click(object sender, RoutedEventArgs e)
{
HistoryViewCommands.RefreshGraph.Execute(null, this);
}

#region Search commits
private void txtSearch_TextChanged(object sender, TextChangedEventArgs e)
{
var text = txtSearch.Text.ToLower();
if (string.IsNullOrWhiteSpace(text))
{
lstSearch.ItemsSource = tracker.RepositoryGraph.Commits;
}
else
{
lstSearch.ItemsSource = tracker.RepositoryGraph.Commits
.Where(c => c.Message.ToLower().Contains(text) ||
c.Id.StartsWith(text) ||
c.CommitterName.ToLower().StartsWith(text) ||
c.CommitterEmail.ToLower().StartsWith(text) ||
c.CommitDateRelative.StartsWith(text));
}
lstSearch.Visibility = Visibility.Visible;
}

private void ShowSearchList()
{
lstSearch.Visibility = Visibility.Visible;
lstSearch.Focus();
}

private void HideSearchList()
{
lstSearch.Visibility = Visibility.Collapsed;
txtSearch.Focus();
}

private void Grid_PreviewKeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Escape)
{
HideSearchList();
}
}

private void txtSearch_PreviewKeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Down || e.Key == Key.Up)
{
ShowSearchList();
}
}

private void txtSearch_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
HideSearchList();
if (txtSearch.SelectedText == "")
{
txtSearch.SelectAll();
e.Handled = true;
}
}

private void lstSearch_PreviewKeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter)
{
e.Handled = true;
lstSearch.Visibility = Visibility.Collapsed;
txtSearch.Focus();

var commit = lstSearch.SelectedItem as Commit;
if (commit != null)
{
txtSearch.TextChanged -= new TextChangedEventHandler(txtSearch_TextChanged);
txtSearch.Text = commit.Message;
txtSearch.TextChanged += new TextChangedEventHandler(txtSearch_TextChanged);
HistoryViewCommands.ScrollToCommit.Execute(commit.Id, this);
}
}
}

#endregion
}
}
34 changes: 16 additions & 18 deletions Readme.htm
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,26 @@ <h1>Git Source Control Provider</h1>
<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&amp;business=KBCLF3PZD6C98&amp;lc=US&amp;item_name=Git%20Source%20Control%20Provider&amp;currency_code=USD&amp;bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted">
<img alt="Donate" style="border:0px; vertical-align:middle" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif" title="Donate" /></a><br />
<h2>Change Logs</h2>
<strong>V0.9.1
(beta - f73b4a2)
</strong>
<strong>V0.9.1 (RC3 - dd5e9f7) </strong>
<ul>
<li>Change History Window to be a stand alone program - add/delete tag, add/checkout
branch</li>
<li>Add Git Extensions menus to Pending Changed tool window </li>
<li>Add GitTortoise menus to Pending Changed tool window</li>
<li>Add Git - About ... menu, <a
<li>Change History Window to be a stand alone program<ul>
<li>add/delete tag, add/checkout branch</li>
<li>scroll to branch/tag</li>
<li>refresh button</li>
</ul>
</li>
<li>Add Git Extensions menus to Pending Changed tool window </li>
<li>Add GitTortoise menus to Pending Changed tool window</li>
<li>Add Git - About ... menu,
<a
href="http://gitscc.codeplex.com/workitem/17051">Referencing
Git hash when building</a></li>
<li>Add Option to disable auto load,
<a href="http://gitscc.codeplex.com/workitem/16904">
Automatically switch to the Git provider when loading a Git-controlled solution</a></li>
<li>Bug Fix: <a href="http://gitscc.codeplex.com/workitem/17101">
autocrlf warning prevents commits from Git Pending Changes</a></li>
<li>Bug Fix: <a href="http://gitscc.codeplex.com/workitem/17213">
Show Changes Window Disappear</a></li>
<li>Buf Fix: <a href="http://gitscc.codeplex.com/workitem/17277">
Git status is not refreshed</a></li>
<li>Bug Fix: <a href="http://gitscc.codeplex.com/workitem/17322">
config core.ignorecase true</a></li>
<a href="http://gitscc.codeplex.com/workitem/16904">Automatically switch to the Git provider when loading a Git-controlled solution</a></li>
<li>Bug Fix: <a href="http://gitscc.codeplex.com/workitem/17101">autocrlf warning prevents commits from Git Pending Changes</a></li>
<li>Bug Fix: <a href="http://gitscc.codeplex.com/workitem/17213">Show Changes Window Disappear</a></li>
<li>Buf Fix: <a href="http://gitscc.codeplex.com/workitem/17277">Git status is not refreshed</a></li>
<li>Bug Fix: <a href="http://gitscc.codeplex.com/workitem/17322">config core.ignorecase true</a></li>
<li>Merge pull request #19 from GitHub</li>
</ul>

Expand Down

0 comments on commit 64fe114

Please sign in to comment.