Monotone 'log' or 'list certs' depens with tokens on LANG setting.
Check the LANG by calling 'mtn --version' and verify the string.
If not ok, raise a critical error to inform the user.

Todo:
Set environment "LANG=C" inside tailor, before calls monotone.

Complete patch wiht more fixups can found on:
http://www.henrynestler.com/tailor/monotone-complete-20070603.patch

--
Henry N.
# Monotone 'log' or 'list certs' depens with tokens on LANG setting.
# Check the LANG by calling 'mtn --version' and verify the string.
# If not ok, raise a critical error to inform the user.
#
# Todo:
# Set environment "LANG=C" inside tailor, before calls monotone.
# 
# 2007-06-03 Henry(at)Bigfoot.de
#
--- tailor-snapshot/vcpx/repository/monotone.py
+++ tailor-20070603/vcpx/repository/monotone.py
@@ -22,6 +22,7 @@
 from vcpx.target import SynchronizableTargetWorkingDir, TargetInitializationFailure
 from vcpx.changes import Changeset
 from vcpx.tzinfo import UTC
+from vcpx.config import ConfigurationError
 
 
 MONOTONERC = """\
@@ -51,9 +52,46 @@
                         cget(self.name, '%s-keygenid' % self.which)
         self.custom_lua = cget(self.name, 'custom_lua') or \
                           cget(self.name, '%s-custom_lua' % self.which)
+        self._supportsLanguagePosix = Unknown
         self._supportsLogRevision = Unknown
         self._supportsLogNoGraph = Unknown
 
+    def supportsLanguagePosix(self):
+        """
+        In Monotone, ``mtn list certs`` depens on environment ``LANG``.
+
+        Workarrount: Check version string for non english text.
+        Typical output for --version with LANG=C:
+        monotone 0.35 (base revision: f92dd754bf5c1e6eddc9c462b8d68691cfeb7f8b)
+
+        with LANG=de_DE: monotone 0.35 (Basis-Revision: f92d...
+        with LANG=it_IT: monotone 0.35 (revisione base: f92d...
+        with LANG=fr_FR: monotone 0.35 (revision de base: f92d...
+
+        FIXME: Set "LANG=C" inside tailor, before call monotone.
+        """
+
+        # Lazily (upon first request) attempt to determine the value
+        # of this variable:
+        if self._supportsLanguagePosix is Unknown:
+            cmd = self.command("--version")
+            mtl = ExternalCommand(command=cmd)
+            outstr = mtl.execute(stdout=PIPE, stderr=PIPE)
+
+            if mtl.exit_status:
+                raise ConfigurationError("%s --version returned status %d" %
+                                         (self.EXECUTABLE, mtl.exit_status))
+
+            self.data = outstr[0].getvalue()
+            pos = self.data.find("base revision:")
+            if pos > 1:
+                self._supportsLanguagePosix = True
+            else:
+                raise ConfigurationError("Please set LANG=POSIX for internal "
+                                         "use of 'monotone list certs'")
+
+        return self._supportsLanguagePosix
+
     def supportsLogRevision(self, working_dir, revision):
         """
         In Monotone 0.32, ``mtn log --revision`` was changed to ``mtn
@@ -272,6 +310,8 @@
         self.changelog=""
         self.branches=[]
 
+        langCheck = self.repository.supportsLanguagePosix()
+
         cmd = None
 
         logRevision = self.repository.supportsLogRevision(self.working_dir,
_______________________________________________
Tailor mailing list
[email protected]
http://lists.zooko.com/mailman/listinfo/tailor

Reply via email to