[gitg/wip/sindhus/interactive-rebase] Slice the git-rebase-todo array into 3 cols and n rows



commit 5e491ad7a365a4dbfe92bffeba8014733f5add67
Author: Sindhu S <sindhus live in>
Date:   Mon Sep 9 17:51:19 2013 +0530

    Slice the git-rebase-todo array into 3 cols and n rows

 gitg/gitg-rebase-parser.vala |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/gitg/gitg-rebase-parser.vala b/gitg/gitg-rebase-parser.vala
index 576d6c8..23d75e9 100644
--- a/gitg/gitg-rebase-parser.vala
+++ b/gitg/gitg-rebase-parser.vala
@@ -29,19 +29,32 @@ namespace Gitg
                {
                        string contents;
                        int line_number=0;
+//                     string[,] rebase_array = {};
 
                        try
                        {
                                FileUtils.get_contents(filename, out contents);
                        }
-                       catch{}
+                       catch(Glib.Error e)
+                       {
+                               stdout.printf("The file does not exist!");
+                       }
 
                        var file_lines = contents.split("\n");
-                       while (file_lines[line_number][0] != '#')
+                       while (file_lines[line_number][0] != '#' && file_lines[line_number] != "")
                        {
-                               stdout.printf("\n" + file_lines[line_number]);
+                               string[] temp_array = new string [3];
+                               string current_line = file_lines[line_number];
+                               var line_words = current_line.split(" ");
+                               temp_array[0] = line_words[0];
+                               temp_array[1] = line_words[1];
+                               temp_array[2] = string.joinv(" ", line_words[2:line_words.length-1]);
+//                             rebase_array += temp_array;
+                               stdout.printf("\naction: %s sha: %s msg: %s\n", temp_array[0], temp_array[1], 
temp_array[2]);
                                line_number++;
                        }
+
+
                }
        }
 }


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