Re: Meld, Gnome-VFS



> I've got a copy of Meld installed from Debian - "0.9.4.1+20050125-4" -
> and I've patched it to support Gnome-VFS in very basic (and hacky!)
> ways. I've been using a copy of Meld patched like this to do merging
> over FTP for a couple of months at my work, and it's been absolutely
> fabulous and saved me a lot of time.
> 
> My boss approved me sending you what I've changed, so I've attached a
> patch (diff -u) and a full copy of the changed file (filediff.py).
> 
> It's horribly incomplete - no file browsing, no directory diffs (I might
> have even broken it entirely, not sure), no encoding changes, and unless
> you check your terminal, you won't notice errors most of the time.
> 
> That said, I find it useful. I don't expect it to be of any actual use
> to you, but I thought you might appreciate it anyway. I hope that one
> day Meld gets the true VFS support it deserves!

Thanks for the patch Robert. I'm working on the next generation meld
at the moment (the filediff in CVS head is almost done!), so it may be
some time before I'm able to look at using gnomevfs, but I'll keep it
in mind.

Stephen.

> Thankyou;
> Robert.
> PS. I found this email only through BugZilla. You might want to put it
> on the meld site somewhere obvious :)

Good point: I've updated the home page with links to the mailing list.
It's probably better in the long run to publicise the list rather than
my personal email.
--- /usr/lib/meld/filediff.py	2005-03-31 19:49:10.000000000 +0930
+++ /home/mibus/Desktop/meld-mine/filediff.py	2005-06-15 12:24:47.000000000 +0930
@@ -35,6 +35,8 @@
 import melddoc
 import paths
 
+import gnome.vfs
+
 sourceview_available = 0
 
 for sourceview in "gtksourceview sourceview".split():
@@ -555,7 +557,7 @@
             if f:
                 b = self.textview[i].get_buffer()
                 b.delete( b.get_start_iter(), b.get_end_iter() )
-                absfile = os.path.abspath(f)
+                absfile = f # os.path.abspath(f)
                 self.fileentry[i].set_filename(absfile)
                 self.bufferdata[i] = MeldBufferData(absfile)
         self.recompute_label()
@@ -576,7 +578,7 @@
             if f:
                 try:
                     task = misc.struct(filename = f,
-                                       file = codecs.open(f, "rU", try_codecs[0]),
+                                       file = gnome.vfs.open (f, gnome.vfs.OPEN_READ), #codecs.open(f, "rU", try_codecs[0]),
                                        buf = buffers[i],
                                        codec = try_codecs[:],
                                        text = [],
@@ -592,8 +594,12 @@
         yield _("[%s] Reading files") % self.label_text
         while len(tasks):
             for t in tasks[:]:
+		ok = True
                 try:
                     nextbit = t.file.read(4096)
+		except gnome.vfs.EOFError:
+		    nextbit = ''
+		    ok = True
                 except ValueError, err:
                     t.codec.pop(0)
                     if len(t.codec):
@@ -607,12 +613,14 @@
                             _("Could not read from '%s'.\n\nI tried encodings %s.") % (t.filename, try_codecs),
                             parent = self)
                         tasks.remove(t)
+		    ok = False
                 except IOError, ioerr:
                     misc.run_dialog(
                         _("Could not read from '%s'.\n\nThe error was:\n%s") % (t.filename, str(ioerr)),
                         parent = self)
                     tasks.remove(t)
-                else:
+		    ok = False
+                if ok:
                     if len(nextbit):
                         t.buf.insert( t.buf.get_end_iter(), nextbit )
                         t.text.append(nextbit)
@@ -720,7 +728,7 @@
                         buttonstype = gtk.BUTTONS_YES_NO)
                     if response == gtk.RESPONSE_NO:
                         return melddoc.RESULT_ERROR
-                bufdata.filename = os.path.abspath(filename)
+                bufdata.filename = filename # os.path.abspath(filename)
                 self.fileentry[pane].set_filename( bufdata.filename)
         text = buf.get_text(buf.get_start_iter(), buf.get_end_iter(), 0)
         if bufdata.newlines:
@@ -749,7 +757,10 @@
                     self, gtk.MESSAGE_ERROR, gtk.BUTTONS_YES_NO) != gtk.RESPONSE_YES:
                     return melddoc.RESULT_ERROR
         try:
-            open(bufdata.filename, "w").write(text)
+            #open(bufdata.filename, "w").write(text)
+	    tf = gnome.vfs.open (bufdata.filename, gnome.vfs.OPEN_WRITE)
+	    tf.write(text)
+	    tf.close()
         except IOError, e:
             misc.run_dialog(
                 _("Error writing to %s\n\n%s.") % (bufdata.filename, e),


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