Re: [PATCHES] random fixes all over the place - accumulated patch



Index: misc.py
===================================================================
--- misc.py	(revision 1153)
+++ misc.py	(working copy)
@@ -29,7 +29,6 @@
 import shutil
 import re
 import signal
-import errno

 whitespace_re = re.compile(r"\s")

@@ -347,7 +346,6 @@
 def diff_files_callback(option, opt_str, value, parser):
     """Gather arguments after option in a list and append to option.dest."""
     assert value is None
-    done = 0
     diff_files_args = []
     rargs = parser.rargs
     while rargs:
Index: gnomeglade.py
===================================================================
--- gnomeglade.py	(revision 1153)
+++ gnomeglade.py	(working copy)
@@ -127,7 +127,7 @@
                 widget = list(widget)
             except TypeError:
                 widget = [widget]
-            for w in widgets:
+            for w in widget:
                 try:
                     if when == 'on':
                         w.connect(signal, method)
Index: vcview.py
===================================================================
--- vcview.py	(revision 1153)
+++ vcview.py	(working copy)
@@ -177,15 +177,15 @@
         addCol(_("Options"), COL_OPTIONS)

         class ConsoleStream(object):
-            def __init__(this, textview):
-                this.textview = textview
+            def __init__(self, textview):
+                self.textview = textview
                 b = textview.get_buffer()
-                this.mark = b.create_mark("END", b.get_end_iter(), 0)
-            def write(this, s):
+                self.mark = b.create_mark("END", b.get_end_iter(), 0)
+            def write(self, s):
                 if s:
-                    b = this.textview.get_buffer()
+                    b = self.textview.get_buffer()
                     b.insert(b.get_end_iter(), s)
-                    this.textview.scroll_mark_onscreen( this.mark )
+                    self.textview.scroll_mark_onscreen( self.mark )
         self.consolestream = ConsoleStream(self.consoleview)
         self.location = None
         self.treeview_column_location.set_visible(self.actiongroup.get_action("VcFlatten").get_active())
Index: diffutil.py
===================================================================
--- diffutil.py	(revision 1153)
+++ diffutil.py	(working copy)
@@ -106,7 +106,7 @@
     def _locate_chunk(self, whichdiffs, sequence, line):
         """Find the index of the chunk which contains line."""
         idx = 1 + 2*(sequence != 1)
-        line_in_chunk = lambda x: line < c[idx+1]
+        line_in_chunk = lambda x: line < x[idx+1]
         i = 0
         for c in self.diffs[whichdiffs]:
             if line_in_chunk(c):
Index: dirdiff.py
===================================================================
--- dirdiff.py	(revision 1153)
+++ dirdiff.py	(working copy)
@@ -437,7 +437,7 @@
                             def first_nonempty(seq):
                                 for s in seq:
                                     if s: return s
-                            return tuple([ t or
first_nonempty(tuples) or k for t in tuples ])
+                            return tuple([ t or
first_nonempty(tuples) or key for t in tuples ])
                         return [ fixup(k, self.items[k]) for k in keys ]
             accumdirs = accum(self, roots)
             accumfiles = accum(self, roots)
@@ -464,7 +464,6 @@
                                             s = os.stat( join(root,e) )
                                         except OSError, err:
                                             print "ignoring dangling
symlink", e
-                                            pass
                                         else:
                                             if stat.S_ISREG(s.st_mode):
                                                 files.append(e)
Index: filediff.py
===================================================================
--- filediff.py	(revision 1153)
+++ filediff.py	(working copy)
@@ -272,7 +272,7 @@
         self.pixels_per_line = (metrics.get_ascent() +
metrics.get_descent()) / 1024
         self.pango_char_width = metrics.get_approximate_char_width()
         tabs = pango.TabArray(10, 0)
-        tab_size = self.prefs.tab_size;
+        tab_size = self.prefs.tab_size
         for i in range(10):
             tabs.set_tab(i, pango.TAB_LEFT, i*tab_size*self.pango_char_width)
         for i in range(3):
Index: vc/_null.py
===================================================================
--- vc/_null.py	(revision 1153)
+++ vc/_null.py	(working copy)
@@ -21,7 +21,6 @@
 ### (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 ### THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-import os
 import _vc

 class Vc(_vc.Vc):
Index: vc/cvs.py
===================================================================
--- vc/cvs.py	(revision 1153)
+++ vc/cvs.py	(working copy)
@@ -157,7 +157,7 @@
                                   "The error was '%s'") %
(",".join(ignored), e))
         else:
             class dummy(object):
-                def match(*args): return None
+                def match(self, *args): return None
             ignore_re = dummy()

         for f,path in files:
Index: vc/bzr.py
===================================================================
--- vc/bzr.py	(revision 1153)
+++ vc/bzr.py	(working copy)
@@ -111,7 +111,7 @@
                 mydir, name = os.path.split(mydir)
             if mydir != directory:
                 continue
-            rev, date, options, tag = "","","",""
+            rev, options, tag = "","",""
             if path.endswith('/'):
                 retdirs.append( _vc.Dir(path[:-1], name, state))
             else:
Index: vc/monotone.py
===================================================================
--- vc/monotone.py	(revision 1153)
+++ vc/monotone.py	(working copy)
@@ -23,11 +23,9 @@
 ### THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

 import os
-import re
-import time
 import _vc
+import errno

-
 class Vc(_vc.Vc):
     CMD = "mtn"
     NAME = "Monotone"
@@ -226,7 +224,6 @@
         tree_state = {}
         for entry in entries:
             mstate = entry[0:3]
-            rename_tracking = entry[4:7] # unused
             fname = entry[8:]

             if mstate in statemap:
@@ -237,7 +234,7 @@
                 state = _vc.STATE_ERROR
                 print "WARNING: impossible state ('%s') reported by
'automate inventory' (version skew?)" % mstate

-            tree_state[os.path.join(self.root, fname)] = state;
+            tree_state[os.path.join(self.root, fname)] = state

         return tree_state

@@ -261,7 +258,7 @@
                 mydir, name = os.path.split(mydir)
             if mydir != directory:
                 continue
-            rev, date, options, tag = "","","",""
+            rev, options, tag = "","",""
             if path.endswith('/'):
                 retdirs.append( _vc.Dir(path[:-1], name, state))
             else:
Index: vc/mercurial.py
===================================================================
--- vc/mercurial.py	(revision 1153)
+++ vc/mercurial.py	(working copy)
@@ -78,7 +78,7 @@
         hgfiles = {}
         for statekey, name in [ (entry[0], entry[2:]) for entry in
entries if entry.find("/")==-1 ]:
             path = os.path.join(directory, name)
-            rev, date, options, tag = "","","",""
+            rev, options, tag = "","",""
             state = statemap.get(statekey, _vc.STATE_NONE)
             retfiles.append( _vc.File(path, name, state, rev, tag, options) )
             hgfiles[name] = 1
Index: vc/svn.py
===================================================================
--- vc/svn.py	(revision 1153)
+++ vc/svn.py	(working copy)
@@ -22,7 +22,6 @@
 ### THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

 import os
-import re
 import errno
 import subprocess
 import _vc
Index: vc/_vc.py
===================================================================
--- vc/_vc.py	(revision 1153)
+++ vc/_vc.py	(working copy)
@@ -86,9 +86,6 @@
     def patch_command(self, workdir):
         return
["patch","--strip=%i"%self.PATCH_STRIP_NUM,"--reverse","--directory=%s"
% workdir]

-    def lookup_files(self, cdirs, cfiles):
-        raise NotImplementedError()
-
     def get_working_directory(self, workdir):
         return workdir

Index: meldapp.py
===================================================================
--- meldapp.py	(revision 1153)
+++ meldapp.py	(working copy)
@@ -329,7 +329,7 @@
         # FIXME: ideally, we would use custom ellipsization that ellipsized the
         # two paths separately, but that requires significant changes to label
         # generation in many different parts of the code
-        label.set_ellipsize(pango.ELLIPSIZE_MIDDLE);
+        label.set_ellipsize(pango.ELLIPSIZE_MIDDLE)
         label.set_single_line_mode(True)
         label.set_alignment(0.0, 0.5)
         label.set_padding(0, 0)
@@ -435,6 +435,8 @@
             #TRANSLATORS: translate this string ONLY to the first
"\t", leave it and the following parts intact
             _("Leading whitespace\t0\t^[ \\t\\r\\f\\v]*\n") + \
             #TRANSLATORS: translate this string ONLY to the first
"\t", leave it and the following parts intact
+            _("CRLF line endings\t0\t\\r+$\n") + \
+            #TRANSLATORS: translate this string ONLY to the first
"\t", leave it and the following parts intact
             _("Script comment\t0\t#.*")),
         "ignore_blank_lines" : prefs.Value(prefs.BOOL, 1)
     }
@@ -565,7 +567,7 @@
         elif 1:
             def showPrefs(): PreferencesDialog(self)
             gobject.idle_add(showPrefs)
-        dnd_targets = self.widget.drag_dest_set(
+        self.widget.drag_dest_set(
             gtk.DEST_DEFAULT_MOTION | gtk.DEST_DEFAULT_HIGHLIGHT |
gtk.DEST_DEFAULT_DROP,
             [ ('text/uri-list', 0, 0) ],
             gtk.gdk.ACTION_COPY)
@@ -722,9 +724,6 @@
     def on_menu_redo_activate(self, *extra):
         self.current_doc().on_redo_activate()

-    def on_menu_refresh_activate(self, *extra):
-        self.current_doc().on_refresh_activate()
-
     def on_menu_reload_activate(self, *extra):
         self.current_doc().on_reload_activate()

@@ -791,7 +790,6 @@
         for i in range(8):
             self.append_filediff( ("ntest/file%ia"%i, "ntest/file%ib"%i) )
             #self.append_filediff( ("ntest/file9a", "ntest/file9b") )
-        pass

     def on_menu_edit_down_activate(self, *args):
         misc.safe_apply( self.current_doc(), "next_diff", gtk.gdk.SCROLL_DOWN )
Index: historyentry.py
===================================================================
--- historyentry.py	(revision 1153)
+++ historyentry.py	(working copy)
@@ -196,17 +196,19 @@
     history_id = gobject.property(get_history_id, __set_history_id, type=str)
     max_saved = gobject.property(get_history_length,
set_history_length, type=int)

+def setDoNothingHandlers(instance, *methodNames):
+
+    def do_nothing(self):
+        return
+
+    for methodName in methodNames:
+        setattr(instance, methodName, do_nothing)
+
 try:
     import gconf
 except ImportError:
-    def do_nothing(self):
-        return
+    setDoNothingHandlers(HistoryEntry, '_save_history',
'_load_history', '_get_gconf_client')

-    for m in ('_save_history', '_load_history', '_get_gconf_client'):
-        setattr(HistoryEntry, m, do_nothing)
-
-
-
 def _expand_filename(filename, default_dir):
     if not filename:
         return ""
@@ -474,8 +476,4 @@
 try:
     import gnomevfs
 except ImportError:
-    def do_nothing(self):
-        return
-
-    setattr(HistoryFileEntry, '_setup_dnd', do_nothing)
-
+    setDoNothingHandlers(HistoryFileEntry, '_setup_dnd')
-- 
Vincent Legoll


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