[meld] Open the VC console on error during a VC operation (closes bgo#440483)



commit 7c1e24a70feac95a22032a8c8da43309b0d07e92
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sat Aug 24 08:10:25 2013 +1000

    Open the VC console on error during a VC operation (closes bgo#440483)
    
    We don't alert the user about errors in any other useful way, so the
    most sensible thing to do is to just show the console that will
    hopefully have some useful information.

 meld/misc.py   |    1 +
 meld/vc/cvs.py |    1 +
 meld/vcview.py |   11 +++++++++++
 3 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/meld/misc.py b/meld/misc.py
index 5c554ee..7c77956 100644
--- a/meld/misc.py
+++ b/meld/misc.py
@@ -227,6 +227,7 @@ def read_pipe_iter(command, errorstream, yield_interval=0.1, workdir=None):
             if status:
                 errorstream.error("Exit code: %i\n" % status)
             yield "".join(bits)
+            yield status
     if workdir == "":
         workdir = None
     return sentinel()()
diff --git a/meld/vc/cvs.py b/meld/vc/cvs.py
index ba22977..51f99e9 100644
--- a/meld/vc/cvs.py
+++ b/meld/vc/cvs.py
@@ -92,6 +92,7 @@ class Vc(_vc.Vc):
         patch = None
         while patch is None:
             patch = next(diffiter)
+        status = next(diffiter)
 
         tmpdir = tempfile.mkdtemp("-meld")
         destfile = os.path.join(tmpdir, os.path.basename(path))
diff --git a/meld/vcview.py b/meld/vcview.py
index ad50698..c4f50d8 100644
--- a/meld/vcview.py
+++ b/meld/vcview.py
@@ -651,6 +651,11 @@ class VcView(melddoc.MeldDoc, gnomeglade.Component):
             misc.run_dialog("Error running command.\n'%s'\n\nThe error was:\n%s" % ( 
misc.shelljoin(command), e),
                 parent=self, messagetype=gtk.MESSAGE_ERROR)
         self.consolestream.output("\n")
+
+        returncode = next(readiter)
+        if returncode:
+            self.set_console_view_visible(True)
+
         if refresh:
             self.refresh_partial(workdir)
         yield workdir, r
@@ -822,6 +827,12 @@ class VcView(melddoc.MeldDoc, gnomeglade.Component):
 
     def on_console_view_toggle(self, box, event=None):
         if box == self.console_hide_box:
+            self.set_console_view_visible(False)
+        else:
+            self.set_console_view_visible(True)
+
+    def set_console_view_visible(self, visible):
+        if not visible:
             self.prefs.vc_console_visible = 0
             self.console_hbox.hide()
             self.console_show_box.show()


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