[gitg/wip/sindhus/interactive-rebase] Generate the rebase todo file output cleanly
- From: Sindhu Sundar <sindhus src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg/wip/sindhus/interactive-rebase] Generate the rebase todo file output cleanly
- Date: Tue, 10 Sep 2013 21:04:59 +0000 (UTC)
commit 82bbb4aae0e52b5c7df223876c1da02180e9e3f7
Author: Sindhu S <sindhus live in>
Date: Tue Sep 10 21:01:28 2013 +0530
Generate the rebase todo file output cleanly
gitg/gitg-rebase-list-box.vala | 28 +++++++++++++++++++++++++++-
gitg/gitg-rebase-parser.vala | 12 +++++++++---
gitg/gitg-rebase-window.vala | 8 +++++---
3 files changed, 41 insertions(+), 7 deletions(-)
---
diff --git a/gitg/gitg-rebase-list-box.vala b/gitg/gitg-rebase-list-box.vala
index 2a87c9c..c8b5bbb 100644
--- a/gitg/gitg-rebase-list-box.vala
+++ b/gitg/gitg-rebase-list-box.vala
@@ -46,11 +46,21 @@ namespace Gitg
public string? commit_action
{
get {
+/*
Gtk.TreeIter selected_iter;
r_commit_action.get_active_iter(out selected_iter);
- Value action_name;
+ Value action_name = new Value();
r_commit_action.get_model().get_value(selected_iter, 0, out
action_name);
return action_name.get_string();
+*/
+ int action_id = r_commit_action.active;
+ switch(action_id)
+ {
+ case 0: return "pick";
+ case 1: return "squash";
+ case 2: return "fixup";
+ }
+ return "pick";
}
set {
var action_id = 0;
@@ -84,6 +94,22 @@ namespace Gitg
construct {
show ();
}
+
+ public Gee.ArrayList<Gee.ArrayList<string>> get_rebase_array()
+ {
+ Gee.ArrayList<Gee.ArrayList<string>> rebase_array = new
Gee.ArrayList<Gee.ArrayList<string>>();
+ foreach (var child in get_children())
+ {
+ var row = (Row) child;
+ Gee.ArrayList<string> rebase_row = new Gee.ArrayList<string>();
+ rebase_row.add(row.commit_action);
+ rebase_row.add(row.commit_sha);
+ rebase_row.add(row.commit_msg);
+ rebase_array.add(rebase_row);
+ }
+ return rebase_array;
+ }
+
}
}
diff --git a/gitg/gitg-rebase-parser.vala b/gitg/gitg-rebase-parser.vala
index 94b87f6..0db96a8 100644
--- a/gitg/gitg-rebase-parser.vala
+++ b/gitg/gitg-rebase-parser.vala
@@ -52,10 +52,16 @@ namespace Gitg
return rebase_array;
}
- public string generate_rebase_todo(string[,] rebase_array)
+ public string generate_rebase_todo(Gee.ArrayList<Gee.ArrayList<string>> rebase_array)
{
- // Write function to generate rebase todo file back again
- return "";
+ string result = "";
+ foreach (var rebase_row in rebase_array)
+ {
+ result += rebase_row[0] + " ";
+ result += rebase_row[1] + " ";
+ result += rebase_row[2] + "\n";
+ }
+ return result;
}
}
}
diff --git a/gitg/gitg-rebase-window.vala b/gitg/gitg-rebase-window.vala
index 4976b12..852102e 100644
--- a/gitg/gitg-rebase-window.vala
+++ b/gitg/gitg-rebase-window.vala
@@ -50,10 +50,12 @@ public class RebaseWindow : Gtk.Window
private void start_rebase()
{
- stdout.printf("Starting rebase, baby!!");
+ var parser = new RebaseParser();
+ var rebase_array = r_rebase_list_box.get_rebase_array();
+ string rebase_output = "";
+ rebase_output = parser.generate_rebase_todo(rebase_array);
+ stdout.printf("\nrebase_output: \n%s", rebase_output);
}
}
-
-
}
\ No newline at end of file
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]