[gitg/wip/sindhus/interactive-rebase] Split git-rebase-todo file into lines and spit



commit 1ff7515c6d7e236783512ce561e41bf7cb739842
Author: Sindhu S <sindhus live in>
Date:   Mon Sep 9 17:29:58 2013 +0530

    Split git-rebase-todo file into lines and spit

 gitg/gitg-rebase-parser.vala |   16 ++++++++++++++--
 gitg/gitg-rebase-window.vala |    2 +-
 2 files changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/gitg/gitg-rebase-parser.vala b/gitg/gitg-rebase-parser.vala
index f85283d..576d6c8 100644
--- a/gitg/gitg-rebase-parser.vala
+++ b/gitg/gitg-rebase-parser.vala
@@ -28,8 +28,20 @@ namespace Gitg
                public void parse_rebase_todo(string filename)
                {
                        string contents;
-                       FileUtils.get_contents(filename, out contents);
-                       stdout.printf("Contents: %s", contents);
+                       int line_number=0;
+
+                       try
+                       {
+                               FileUtils.get_contents(filename, out contents);
+                       }
+                       catch{}
+
+                       var file_lines = contents.split("\n");
+                       while (file_lines[line_number][0] != '#')
+                       {
+                               stdout.printf("\n" + file_lines[line_number]);
+                               line_number++;
+                       }
                }
        }
 }
diff --git a/gitg/gitg-rebase-window.vala b/gitg/gitg-rebase-window.vala
index 9c5d35a..f58a1bb 100644
--- a/gitg/gitg-rebase-window.vala
+++ b/gitg/gitg-rebase-window.vala
@@ -26,7 +26,7 @@ public class RebaseWindow : Gtk.Window
        public RebaseWindow()
        {
                this.title = "gitg Rebase";
-               
+
        }
 }
 


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