Skip to content

Commit

Permalink
add menu for archiving commits
Browse files Browse the repository at this point in the history
  • Loading branch information
yysun committed Feb 8, 2012
1 parent 61d6fb4 commit 05cb33a
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
4 changes: 4 additions & 0 deletions GitUI/GitViewModel.cs
Expand Up @@ -148,5 +148,9 @@ internal string CheckoutBranch(string name)
return GitRun("checkout " + name);
}

internal string Archive(string id, string fileName)
{
return GitRun(string.Format("archive {0} --format=zip --output \"{1}\"", id, fileName));
}
}
}
5 changes: 3 additions & 2 deletions GitUI/UI/CommitBox.xaml
Expand Up @@ -37,7 +37,8 @@
<ContextMenu>
<MenuItem Header="new tag" Click="NewTag_Click" />
<MenuItem Header="new branch" Click="NewBranch_Click" />
<MenuItem Header="view details" Command="cmd:HistoryViewCommands.OpenCommitDetails" CommandParameter="{Binding Id}" />
<!--<MenuItem Header="view details" Command="cmd:HistoryViewCommands.OpenCommitDetails" CommandParameter="{Binding Id}" />-->
<MenuItem Header="archive" Click="Export_Click" />
</ContextMenu>
</UserControl.ContextMenu>
<Grid x:Name="root" Height="120" Width="200" RenderTransformOrigin="0.5,0.5" MouseEnter="root_MouseEnter" MouseLeave="root_MouseLeave" MouseLeftButtonUp="root_MouseLeftButtonUp">
Expand Down Expand Up @@ -104,6 +105,6 @@
<TextBlock x:Name="txtDate" FontSize="10" HorizontalAlignment="Right" Margin="0,0,12,6" VerticalAlignment="Bottom" TextAlignment="Right"
Text="{Binding Date}" Foreground="#D1000000" />
<Button HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="12,0,0,8" Template="{DynamicResource ButtonControlTemplate1}"
ToolTip="Select commit to compare" Click="Button_Click"/>
ToolTip="Select commit to compare" Click="Button_Click"/>
</Grid>
</UserControl>
16 changes: 16 additions & 0 deletions GitUI/UI/CommitBox.xaml.cs
Expand Up @@ -132,5 +132,21 @@ private void Button_Click(object sender, RoutedEventArgs e)
{
HistoryViewCommands.SelectCommit.Execute(this.txtId.Text, this);
}

private void Export_Click(object sender, RoutedEventArgs e)
{
var dlg = new Microsoft.Win32.SaveFileDialog();
dlg.DefaultExt = ".zip";
dlg.Filter = "Archive (.zip)|*.zip";
dlg.FileName = this.txtId.Text + ".zip";
if (dlg.ShowDialog() == true)
{
var ret = GitViewModel.Current.Archive(this.txtId.Text, dlg.FileName);
if (!string.IsNullOrWhiteSpace(ret))
{
MessageBox.Show(ret, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
}
}
}
}
}
3 changes: 2 additions & 1 deletion Readme.htm
Expand Up @@ -19,14 +19,15 @@ <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 (RC4 - dd5e9f7) </strong>
<strong>V0.9.1 (RC4 - 340eca9) </strong>
<ul>
<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>
<li>search commits</li>
<li>select and compare too commits</li>
<li>Archive (export) commit</li>
</ul>
</li>
<li>Add Git Extensions menus to Pending Changed tool window </li>
Expand Down

0 comments on commit 05cb33a

Please sign in to comment.