Nasty meld workaround for some versions of monotone



Hi Folks

After extensive off list discussions with Judson Lester we did discover
a problem with meld's monotone integration (albeit one due to a bug in
monotone).

The attached patch works around the problem and provides a little
framework to workaround other problems in the future.
 
-- 
Daniel Thompson (Merlin) <daniel redfelineninja org uk>

'Good morning, Pooh bear,' said Eeyore gloomily. 'If it is a good
morning,' he said, 'Which I doubt.'
monotone: Workaround problems with monotone automate inventory

In monotone 0.33 monotone automate inventory incorrectly omits
certain unversions files and causes meld to issue lots of
warnings. This patch conditionally disables these warnings
if it detects a broken version of monotone is installed.
Index: meld-1.1.4/vc/monotone.py
===================================================================
--- meld-1.1.4.orig/vc/monotone.py
+++ meld-1.1.4/vc/monotone.py
@@ -34,6 +34,10 @@ class Vc(_vc.Vc):
     PATCH_STRIP_NUM = 0
     PATCH_INDEX_RE = "^[+]{3,3} ([^  ]*)\t[0-9a-f]{40,40}$"
 
+    # All bug workarounds should be disabled by default (they will be enabled by
+    # identify_broken_monotone_revisions as required)
+    disable_file_not_listed_warning = False
+
     def __init__(self, location):
         self._tree_cache = None
         location = os.path.normpath(location)
@@ -49,6 +53,7 @@ class Vc(_vc.Vc):
         mtn = find_folder(location,"_MTN")
         if mtn:
             self.root = mtn
+	    self.identify_broken_monotone_revisions()
             return
 
         # for monotone <= 0.25 (different metadata directory, different executable)
@@ -56,10 +61,21 @@ class Vc(_vc.Vc):
         if mt:
             self.root = mt
             self.CMD = "monotone"
+	    # no need to identify broken revisions since there are no workarounds for pre 0.25 releases
             return
 
         raise ValueError
 
+    def identify_broken_monotone_revisions(self):
+	# extract the version number and its SHA-1 hash
+	id = os.popen(self.CMD + " --version").read().split("\n")[0]
+	[ ignore, version, ignore, ignore, sha1 ] = id.split(" ")
+	sha1 = sha1.rstrip(")")
+
+	incorrectly_lists_non_versioned_files = [ "cfebc8eb7049def476cc5fd61fef64eb14120e68" ]
+	if sha1 in incorrectly_lists_non_versioned_files:
+		self.disable_file_not_listed_warning = True
+
     def commit_command(self, message):
         return [self.CMD,"commit","-m",message]
     def diff_command(self):
@@ -208,7 +224,7 @@ class Vc(_vc.Vc):
                 # if the ignore MT filter is not enabled these will crop up
                 ignorelist = [ 'format', 'log', 'options', 'revision', 'work' ]
 
-                if f not in ignorelist:
+                if f not in ignorelist and not self.disable_file_not_listed_warning:
                     print "WARNING: '%s' was not listed by 'automate inventory'" % f
 
                 # if it ain't listed by the inventory it's not under version


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