ports/148058: trac-mercurial-0.11.0.7_2 mercurial-1.5.4 incompatibility issues

Ruben van Staveren ruben at verweg.com
Tue Jun 22 09:40:06 UTC 2010


>Number:         148058
>Category:       ports
>Synopsis:       trac-mercurial-0.11.0.7_2 mercurial-1.5.4 incompatibility issues
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jun 22 09:40:03 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Ruben van Staveren
>Release:        FreeBSD 8.0-STABLE amd64
>Organization:
>Environment:
System: FreeBSD erg.verweg.com 8.0-STABLE FreeBSD 8.0-STABLE #0: Mon Mar 15 14:06:11 CET 2010 root at chassis:/opt/obj/usr/cvsup/8-stable/src/sys/CHASSIS amd64


	
>Description:

	  the combination of trac-mercurial and mercurial 1.5.4 won't work as since
mercurial 1.2+ some imports have moved to other places. You'll see errors about
RepoError, version, and interactive

>How-To-Repeat:
Install trac-mercurial-0.11.0.7_2 mercurial-1.5.4, and configure the
plugin in trac.
>Fix:

Install this file as files/patch-mercurialplugin::tracext::hg::backend.py

This is a minimalistic fix obtained from http://svn.edgewall.org/repos/trac/plugins/0.11/mercurial-plugin/tracext/hg/backend.py


--- tracext/hg/backend.py.orig	2008-12-03 18:43:40.000000000 +0100
+++ tracext/hg/backend.py	2010-06-22 11:23:10.000000000 +0200
@@ -47,8 +47,6 @@
     from mercurial import hg
     from mercurial.hg import repository
     from mercurial.ui import ui
-    from mercurial.repo import RepoError
-    from mercurial.revlog import LookupError
     from mercurial.node import hex, short, nullid
     from mercurial.util import pathto, cachefunc
     from mercurial.cmdutil import walkchangerevs
@@ -57,12 +55,18 @@
 
     # Note: due to the nature of demandimport, there will be no actual 
     # import error until those symbols get accessed, so here we go:
-    for sym in ("repository ui RepoError LookupError hex short nullid pathto "
+    for sym in ("repository ui hex short nullid pathto "
                 "cachefunc walkchangerevs loadall".split()):
         if repr(globals()[sym]) == "<unloaded module '%s'>" % sym:
             hg_import_error.append(sym)
     if hg_import_error:
         hg_import_error = "Couldn't import symbols: "+','.join(hg_import_error)
+
+    # Mercurial versions >= 1.2 won't have mercurial.repo.RepoError anymore
+    from mercurial.repo import RepoError
+    from mercurial.revlog import LookupError
+    if repr(RepoError) == "<unloaded module 'RepoError'>":
+        from mercurial.error import RepoError, LookupError
     
     if demandimport:
         demandimport.disable();
@@ -204,8 +208,18 @@
     def get_repository(self, type, dir, authname):
         """Return a `MercurialRepository`"""
         if not self._version:
-            from mercurial.version import get_version
-            self._version = get_version()
+            try:
+                from mercurial.version import get_version
+                self._version = get_version()
+            except ImportError: # gone in Mercurial 1.2 (hg:9626819b2e3d)
+                from mercurial.util import version
+                self._version = version()
+            # development version assumed to be always the ''newest'' one,
+            # i.e. old development version won't be supported
+            self._version_info = (999, 0, 0) 
+            m = re.match(r'(\d+)\.(\d+)(?:\.(\d+))?', self._version or '')
+            if m:
+                self._version_info = tuple([int(n or 0) for n in m.groups()])
             self.env.systeminfo.append(('Mercurial', self._version))
         if not self.ui:
             self._setup_ui(self.config.get(type, 'hgrc'))
@@ -250,9 +264,8 @@
         
 class trac_ui(ui):
     def __init__(self, log, *args, **kwargs):
-        kwargs = kwargs.copy()
-        kwargs['interactive'] = False
-        ui.__init__(self, *args, **kwargs)
+        ui.__init__(self, *args)
+        self.setconfig('ui', 'interactive', 'off')
         self.log = log
         
     def write(self, *args):


>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list