=== 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:
=== modified file 'pida/utils/ vc/monotone. py' vc/monotone. py vc/monotone. py
--- pida/utils/
+++ pida/utils/
@@ -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): STRIP_NUM = 0 9a-f]{40, 40}$"
- CMD = "monotone"
+ CMD = "mtn"
NAME = "Monotone"
PATCH_
PATCH_INDEX_RE = "^[+]{3,3} ([^ ]*)\t[0-
def __init__(self, location):
self. _tree_cache = None dirname( location) normpath( location) join(where, tofind) dirname( where) location, "_MTN") location, "MT")
- while location != "/":
- if os.path.isdir( "%s/MT" % location):
- self.root = location
- return
- location = os.path.
+ location = os.path.
+
+ def find_folder(where, tofind):
+ while where != "/":
+ cur = os.path.
+ if os.path.isdir(cur):
+ return where
+ where = os.path.
+
+ # for monotone >= 0.26
+ mtn = find_folder(
+ if mtn:
+ self.root = mtn
+ return
+
+ # for monotone <= 0.25 (different metadata directory, different executable)
+ mt = find_folder(
+ if mt:
+ self.root = mt
+ self.CMD = "monotone"
+ return
+
raise ValueError
def commit_ command( self, message): ).read( ).split( "\n")[: -1] %(self. root,self. CMD)).read( ).split( "\n")[: -1]
break
@@ -69,7 +84,7 @@
def lookup_tree(self):
while 1:
try:
- entries = os.popen("monotone automate inventory"
+ entries = os.popen("cd %s && %s automate inventory"
except OSError, e:
if e.errno != errno.EAGAIN: