[anjuta] Git: Implement the rebase option for the pull command



commit 2bfb1b97031e541401b5d4a81426f6f5586b6fc4
Author: James Liggett <jrliggett cox net>
Date:   Sat May 16 18:15:40 2009 -0700

    Git: Implement the rebase option for the pull command
    
    As it turns out, git does have a built in shortcut for git fetch; git rebase origin.
    git pull --rebase will do both of these things in one go.
    
    So, make the rebase option active and pull from origin by default.
    
    Thanks to Deniz Koçak for bringing the existence of this option to my attention.
---
 plugins/git/anjuta-git.glade   |   27 +++++++++++++++++++++------
 plugins/git/git-pull-command.c |    8 +++++++-
 plugins/git/git-pull-command.h |    3 ++-
 plugins/git/git-pull-dialog.c  |    6 ++++--
 4 files changed, 34 insertions(+), 10 deletions(-)

diff --git a/plugins/git/anjuta-git.glade b/plugins/git/anjuta-git.glade
index e76623e..a831395 100644
--- a/plugins/git/anjuta-git.glade
+++ b/plugins/git/anjuta-git.glade
@@ -3868,6 +3868,7 @@
                         <child>
                           <widget class="GtkEntry" id="pull_url_entry">
                             <property name="visible">True</property>
+                            <property name="sensitive">False</property>
                             <property name="can_focus">True</property>
                             <property name="invisible_char">&#x25CF;</property>
                             <property name="width_chars">60</property>
@@ -3882,6 +3883,7 @@
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="receives_default">False</property>
+                            <property name="active">True</property>
                             <property name="draw_indicator">True</property>
                           </widget>
                           <packing>
@@ -3926,6 +3928,19 @@
                         <property name="visible">True</property>
                         <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                         <child>
+                          <widget class="GtkCheckButton" id="pull_rebase_check">
+                            <property name="label" translatable="yes">Rebase</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">False</property>
+                            <property name="active">True</property>
+                            <property name="draw_indicator">True</property>
+                          </widget>
+                          <packing>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
                           <widget class="GtkCheckButton" id="pull_no_commit_check">
                             <property name="label" translatable="yes">Do not commit</property>
                             <property name="visible">True</property>
@@ -3937,7 +3952,7 @@
                           <packing>
                             <property name="expand">False</property>
                             <property name="fill">False</property>
-                            <property name="position">0</property>
+                            <property name="position">1</property>
                           </packing>
                         </child>
                         <child>
@@ -3952,7 +3967,7 @@
                           <packing>
                             <property name="expand">False</property>
                             <property name="fill">False</property>
-                            <property name="position">1</property>
+                            <property name="position">2</property>
                           </packing>
                         </child>
                         <child>
@@ -3964,7 +3979,7 @@
                             <property name="draw_indicator">True</property>
                           </widget>
                           <packing>
-                            <property name="position">2</property>
+                            <property name="position">3</property>
                           </packing>
                         </child>
                         <child>
@@ -3976,7 +3991,7 @@
                             <property name="draw_indicator">True</property>
                           </widget>
                           <packing>
-                            <property name="position">3</property>
+                            <property name="position">4</property>
                           </packing>
                         </child>
                         <child>
@@ -3988,7 +4003,7 @@
                             <property name="draw_indicator">True</property>
                           </widget>
                           <packing>
-                            <property name="position">4</property>
+                            <property name="position">5</property>
                           </packing>
                         </child>
                         <child>
@@ -4000,7 +4015,7 @@
                             <property name="draw_indicator">True</property>
                           </widget>
                           <packing>
-                            <property name="position">5</property>
+                            <property name="position">6</property>
                           </packing>
                         </child>
                       </widget>
diff --git a/plugins/git/git-pull-command.c b/plugins/git/git-pull-command.c
index 74ea8c1..4d76f06 100644
--- a/plugins/git/git-pull-command.c
+++ b/plugins/git/git-pull-command.c
@@ -26,7 +26,8 @@
 
 struct _GitPullCommandPriv
 {
-	gchar *url; 
+	gchar *url;
+	gboolean rebase;
 	gboolean no_commit; 
 	gboolean squash; 
 	gboolean commit_fast_forward;
@@ -64,6 +65,9 @@ git_pull_command_run (AnjutaCommand *command)
 	self = GIT_PULL_COMMAND (command);
 	
 	git_command_add_arg (GIT_COMMAND (command), "pull");
+
+	if (self->priv->rebase)
+		git_command_add_arg (GIT_COMMAND (command), "--rebase");
 	
 	if (self->priv->no_commit)
 		git_command_add_arg (GIT_COMMAND (command), "--no-commit");
@@ -104,6 +108,7 @@ git_pull_command_class_init (GitPullCommandClass *klass)
 GitPullCommand *
 git_pull_command_new (const gchar *working_directory,
 					  const gchar *url, 
+                      gboolean rebase,
 					  gboolean no_commit, gboolean squash, 
 					  gboolean commit_fast_forward,
 					  gboolean append_fetch_data, 
@@ -117,6 +122,7 @@ git_pull_command_new (const gchar *working_directory,
 						  NULL);
 	
 	self->priv->url = g_strdup (url);
+	self->priv->rebase = rebase;
 	self->priv->no_commit = no_commit;
 	self->priv->squash = squash;
 	self->priv->commit_fast_forward = commit_fast_forward;
diff --git a/plugins/git/git-pull-command.h b/plugins/git/git-pull-command.h
index b3fe137..1231365 100644
--- a/plugins/git/git-pull-command.h
+++ b/plugins/git/git-pull-command.h
@@ -55,7 +55,8 @@ struct _GitPullCommand
 
 GType git_pull_command_get_type (void) G_GNUC_CONST;
 GitPullCommand *git_pull_command_new (const gchar *working_directory,
-									  const gchar *url, 
+									  const gchar *url,
+                                      gboolean rebase,
 									  gboolean no_commit, gboolean squash, 
 									  gboolean commit_fast_forward,
 									  gboolean append_fetch_data, 
diff --git a/plugins/git/git-pull-dialog.c b/plugins/git/git-pull-dialog.c
index 1b586b9..2186f6e 100644
--- a/plugins/git/git-pull-dialog.c
+++ b/plugins/git/git-pull-dialog.c
@@ -46,6 +46,7 @@ on_pull_dialog_response (GtkDialog *dialog, gint response_id,
 						 GitUIData *data)
 {
 	GtkWidget *pull_origin_check;
+	GtkWidget *pull_rebase_check;
 	GtkWidget *pull_url_entry;
 	GtkWidget *pull_no_commit_check;
 	GtkWidget *pull_squash_check;
@@ -60,6 +61,8 @@ on_pull_dialog_response (GtkDialog *dialog, gint response_id,
 	{	
 		pull_origin_check = glade_xml_get_widget (data->gxml, 
 		                                          "pull_origin_check");
+		pull_rebase_check = glade_xml_get_widget (data->gxml,
+		                                          "pull_rebase_check");
 		pull_url_entry = glade_xml_get_widget (data->gxml, "pull_url_entry");
 		pull_no_commit_check = glade_xml_get_widget (data->gxml, 
 													 "pull_no_commit_check");
@@ -87,10 +90,9 @@ on_pull_dialog_response (GtkDialog *dialog, gint response_id,
 			return;
 		}
 		
-		
-		
 		pull_command = git_pull_command_new (data->plugin->project_root_directory,
 											 url,
+		                                     gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (pull_rebase_check)),
 											 gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (pull_no_commit_check)),
 											 gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (pull_squash_check)),
 											 gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (pull_fast_forward_commit_check)),



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]