newer monotone has changed and wont get recognized

Bug #50549 reported by ronny
2
Affects Status Importance Assigned to Milestone
PIDA
Fix Released
High
Ali Afshar

Bug Description

monotone v0.26 and later are incombatible to earlyer versions - they use a new directory-sheme

Revision history for this message
ronny (ronny-pfannschmidt-deactivatedaccount) wrote : patch: newer monotone has changed and wont get recognized

=== modified file 'pida/utils/vc/monotone.py'
--- pida/utils/vc/monotone.py
+++ pida/utils/vc/monotone.py
@@ -23,24 +23,39 @@
 ### THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

 import os
-import re
-import time
 import _vc

 class Vc(_vc.Vc):
- CMD = "monotone"
+ CMD = "mtn"
     NAME = "Monotone"
     PATCH_STRIP_NUM = 0
     PATCH_INDEX_RE = "^[+]{3,3} ([^ ]*)\t[0-9a-f]{40,40}$"

     def __init__(self, location):
         self._tree_cache = None
- while location != "/":
- if os.path.isdir( "%s/MT" % location):
- self.root = location
- return
- location = os.path.dirname(location)
+ location = os.path.normpath(location)
+
+ def find_folder(where, tofind):
+ while where != "/":
+ cur = os.path.join(where,tofind)
+ if os.path.isdir(cur):
+ return where
+ where = os.path.dirname(where)
+
+ # for monotone >= 0.26
+ mtn = find_folder(location,"_MTN")
+ if mtn:
+ self.root = mtn
+ return
+
+ # for monotone <= 0.25 (different metadata directory, different executable)
+ mt = find_folder(location,"MT")
+ if mt:
+ self.root = mt
+ self.CMD = "monotone"
+ return
+
         raise ValueError

     def commit_command(self, message):
@@ -69,7 +84,7 @@
     def lookup_tree(self):
         while 1:
             try:
- entries = os.popen("monotone automate inventory").read().split("\n")[:-1]
+ entries = os.popen("cd %s && %s automate inventory"%(self.root,self.CMD)).read().split("\n")[:-1]
                 break
             except OSError, e:
                 if e.errno != errno.EAGAIN:

Revision history for this message
ronny (ronny-pfannschmidt-deactivatedaccount) wrote : patch for supporting the new monotone

made this by from the updated vc/monotone.py of meld, and fixing a problem with the working dir

monotone ppl might add a switch to monotone for a more portable version ( actually it relies on popen using a shell wich wont run on windows )

Ali Afshar (aafshar)
Changed in pida:
importance: Untriaged → High
status: Unconfirmed → Fix Committed
assignee: nobody → aafshar
Revision history for this message
Ali Afshar (aafshar) wrote :

0.4.0

Changed in pida:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.