[75014] trunk/dports/devel/hg-forest
landonf at macports.org
landonf at macports.org
Tue Jan 11 08:33:22 PST 2011
Revision: 75014
http://trac.macports.org/changeset/75014
Author: landonf at macports.org
Date: 2011-01-11 08:33:13 -0800 (Tue, 11 Jan 2011)
Log Message:
-----------
Switch the port to an actively maintained fork that supports hg 1.7, and update the
Portfile to use 'notes' instead of ui_msg.
The hgforest extension appears to have been abandoned by its maintainer and does not
work with the current version of Mercurial, but is still in active use by projects
like OpenJDK. This updated fork was acquired from:
https://bitbucket.org/pmezard/hgforest-crew/overview
Changeset 3647b4bed1a1 (2010-11-18)
Modified Paths:
--------------
trunk/dports/devel/hg-forest/Portfile
trunk/dports/devel/hg-forest/files/forest.py
Modified: trunk/dports/devel/hg-forest/Portfile
===================================================================
--- trunk/dports/devel/hg-forest/Portfile 2011-01-11 15:42:42 UTC (rev 75013)
+++ trunk/dports/devel/hg-forest/Portfile 2011-01-11 16:33:13 UTC (rev 75014)
@@ -3,7 +3,7 @@
PortSystem 1.0
PortGroup python26 1.0
name hg-forest
-version 20090409
+version 20101118
categories devel mercurial
maintainers nomaintainer
description Mercurial extension for nested repositories
@@ -15,7 +15,7 @@
platforms darwin
-homepage http://www.selenic.com/mercurial/wiki/index.cgi/ForestExtension
+homepage http://mercurial.selenic.com/wiki/ForestExtension
# This is only here since master_sites is a required key
master_sites macports
@@ -28,12 +28,12 @@
xinstall -m 755 -d ${destroot}${python.pkgd}/hgext
xinstall -m 644 -W ${filespath} forest.py ${destroot}${python.pkgd}/hgext
}
-post-activate {
- ui_msg "To setup forest to run, edit your .hgrc to add:"
- ui_msg " \[extensions\]"
- ui_msg " hgext.forest="
- ui_msg "See ${homepage} for more explanation"
-}
+notes "To setup forest to run, edit your .hgrc to add:
+ \[extensions\]
+ hgext.forest=
+See ${homepage} for more explanation
+"
+
livecheck.type none
Modified: trunk/dports/devel/hg-forest/files/forest.py
===================================================================
--- trunk/dports/devel/hg-forest/files/forest.py 2011-01-11 15:42:42 UTC (rev 75013)
+++ trunk/dports/devel/hg-forest/files/forest.py 2011-01-11 16:33:13 UTC (rev 75014)
@@ -49,26 +49,15 @@
"""
-import ConfigParser
import errno
import os
import re
import shutil
-from mercurial import cmdutil, commands, hg, hgweb, node, util
+from mercurial import cmdutil, commands, error, hg, hgweb, node, util
from mercurial import localrepo, sshrepo, sshserver, httprepo, statichttprepo
from mercurial.i18n import gettext as _
-# Import exceptions with backwards compatibility
-try:
- from mercurial.error import RepoError, UnknownCommand
-except ImportError:
- from mercurial.repo import RepoError
- try:
- from mercurial.cmdutil import UnknownCommand
- except ImportError:
- from mercurial.commands import UnknownCommand
-
# For backwards compatibility, we need the following function definition.
# If we didn't want that, we'd have just written:
# from mercurial.commands import
@@ -87,6 +76,20 @@
except AttributeError:
findcmd.findcmd = commands.findcmd
findcmd.__doc__ = commands.findcmd.__doc__
+for m in (error, cmdutil, commands):
+ if hasattr(m, "UnknownCommand"):
+ UnknownCommand = m.UnknownCommand
+ break
+try:
+ # Assign the exceptions explicitely to avoid demandload issues
+ import mercurial.repo
+ import mercurial.cmdutil
+ RepoError = mercurial.repo.RepoError
+ ParseError = mercurial.dispatch.ParseError
+except AttributeError:
+ import mercurial.error
+ RepoError = mercurial.error.RepoError
+ ParseError = mercurial.error.ParseError
# For backwards compatibility, find the parseurl() function that splits
# urls and revisions. Mercurial 0.9.3 doesn't have this, so we need
@@ -95,17 +98,51 @@
parseurl = cmdutil.parseurl
except:
try:
- parseurl = hg.parseurl
+ _parseurl = hg.parseurl
+ def parseurl(url, branches=None):
+ url, revs = _parseurl(url, branches)
+ if isinstance(revs, tuple):
+ # hg >= 1.6
+ return url, revs[1]
+ return url, revs
except:
def parseurl(url, revs):
"""Mercurial <= 0.9.3 doesn't have this feature."""
return url, (revs or None)
-
# For backwards compatibility, find the HTTP protocol.
if not hasattr(hgweb, 'protocol'):
hgweb.protocol = hgweb.hgweb_mod.hgweb
+# There are no issues with backward compatibility and ConfigParser.
+# But since it was replaced in mercurial >= 1.3, the module is not
+# longer shipped by Windows binary packages. In this case, use
+# mercurial.config instead.
+try:
+ from mercurial import config
+ ConfigError = error.ConfigError
+
+ def readconfig(path):
+ cfg = config.config()
+ try:
+ cfg.read(path)
+ return cfg
+ except IOError:
+ return None
+
+except (ImportError, AttributeError):
+ import ConfigParser
+ ConfigError = ConfigParser.Error
+
+ def readconfig(path):
+ cfg = ConfigParser.RawConfigParser()
+ if not cfg.read([path]):
+ return None
+ return cfg
+
+class SnapshotError(ConfigError):
+ pass
+
def cmd_options(ui, cmd, remove=None, table=commands.table):
aliases, spec = findcmd(ui, cmd, table)
res = list(spec[1])
@@ -179,6 +216,13 @@
localrepo.localrepository.forests = _localrepo_forests
+def repocall(repo, *args, **kwargs):
+ if hasattr(repo, '_call'):
+ # hg >= 1.7
+ callfn = repo._call
+ else:
+ callfn = repo.do_read
+ return callfn(*args, **kwargs)
def _sshrepo_forests(self, walkhg):
"""Shim this function into mercurial.sshrepo.sshrepository so
@@ -191,7 +235,7 @@
raise util.Abort(_("Remote forests cannot be cloned because the "
"other repository doesn't support the forest "
"extension."))
- data = self.call("forests", walkhg=("", "True")[walkhg])
+ data = repocall(self, "forests", walkhg=("", "True")[walkhg])
return data.splitlines()
sshrepo.sshrepository.forests = _sshrepo_forests
@@ -243,7 +287,7 @@
raise util.Abort(_("Remote forests cannot be cloned because the "
"other repository doesn't support the forest "
"extension."))
- data = self.do_read("forests", walkhg=("", "True")[walkhg])
+ data = repocall(self, "forests", walkhg=("", "True")[walkhg])
return data.splitlines()
httprepo.httprepository.forests = _httprepo_forests
@@ -409,11 +453,8 @@
This data structure describes the Forest contained within the
current repository. It contains a list of Trees that describe
each sub-repository.
- """
+ """
- class SnapshotError(ConfigParser.NoSectionError):
- pass
-
class Tree(object):
"""Describe a local sub-repository within a forest."""
@@ -634,7 +675,7 @@
elif 'rev' in opts:
revs = opts['rev']
else:
- revs = None
+ revs = []
die_on_numeric_revs(revs)
for tree in self.trees:
rpath = relpath(self.top().root, tree.root)
@@ -674,8 +715,8 @@
"""
if not toppath:
toppath = "."
- cfg = ConfigParser.RawConfigParser()
- if not cfg.read([snapfile]):
+ cfg = readconfig(snapfile)
+ if not cfg:
raise util.Abort("%s: %s" % (snapfile, os.strerror(errno.ENOENT)))
seen_root = False
sections = {}
@@ -711,8 +752,8 @@
revs=[rev],
paths=paths)
if not seen_root:
- raise Forest.SnapshotError("Could not find 'root = .' in '%s'" %
- snapfile)
+ raise SnapshotError("Could not find 'root = .' in '%s'" %
+ snapfile)
self.trees = sections.values()
self.trees.sort(key=(lambda tree: tree.root))
@@ -1130,7 +1171,7 @@
snapfile = snapshot or opts['snapfile']
if not snapfile:
- raise cmdutil.ParseError("fseed", _("invalid arguments"))
+ raise ParseError("fseed", _("invalid arguments"))
forest = Forest(snapfile=snapfile)
tip = opts['tip']
dest = opts['root']
@@ -1206,8 +1247,9 @@
def __init__(self, transform, ui):
self._transform = transform
self._ui = ui
- def write(self, output):
- self._ui.write(self._transform(output))
+ def write(self, *args, **opts):
+ args = [self._transform(a) for a in args]
+ self._ui.write(*args, **opts)
def __getattr__(self, attrname):
return getattr(self._ui, attrname)
@@ -1318,16 +1360,12 @@
snapfile = None
if revision:
- cp = ConfigParser.RawConfigParser()
try:
- if cp.read([revision]):
+ if readconfig(revision):
# Compatibility with old 'hg fupdate SNAPFILE' syntax
snapfile = revision
- except Exception, err:
- if isinstance(err, ConfigParser.Error):
- ui.warn(_("warning: %s\n") % err)
- else:
- raise err
+ except ConfigError, err:
+ ui.warn(_("warning: %s\n") % err)
if snapfile is None:
snapfile = opts['snapfile']
opts['rev'] = revision
@@ -1360,7 +1398,7 @@
prehooks=[lambda tree: check_mq(tree)])
-cmdtable = None
+cmdtable = {}
def uisetup(ui):
global cmdtable
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20110111/5f1a9203/attachment.html>
More information about the macports-changes
mailing list