[98008] trunk/dports/devel/hg-forest

ryandesign at macports.org ryandesign at macports.org
Fri Sep 21 18:11:27 PDT 2012


Revision: 98008
          http://trac.macports.org//changeset/98008
Author:   ryandesign at macports.org
Date:     2012-09-21 18:11:27 -0700 (Fri, 21 Sep 2012)
Log Message:
-----------
hg-forest: update to 20111009

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	2012-09-21 23:40:55 UTC (rev 98007)
+++ trunk/dports/devel/hg-forest/Portfile	2012-09-22 01:11:27 UTC (rev 98008)
@@ -3,8 +3,7 @@
 PortSystem          1.0
 PortGroup           python27 1.0
 name                hg-forest
-version             20101118
-revision            1
+version             20111009
 categories          devel mercurial
 maintainers         nomaintainer
 description         Mercurial extension for nested repositories

Modified: trunk/dports/devel/hg-forest/files/forest.py
===================================================================
--- trunk/dports/devel/hg-forest/files/forest.py	2012-09-21 23:40:55 UTC (rev 98007)
+++ trunk/dports/devel/hg-forest/files/forest.py	2012-09-22 01:11:27 UTC (rev 98008)
@@ -262,12 +262,34 @@
 sshserver.sshserver.do_hello = _sshserver_do_hello
 
 
+try:
+    from mercurial import wireproto
+    # Force the lazy importer to trigger
+    wireproto.capabilities
+except ImportError:
+    pass
+else:
+    # hg >= 1.7
+    _old_caps = wireproto.capabilities
+    def _forest_caps(*args, **kwargs):
+        caps = _old_caps(*args, **kwargs)
+        caps += ' forests'
+        return caps
+    wireproto.capabilities = _forest_caps
+
+    def do_forests(repo, proto, walkhg):
+        forests = repo.forests(bool(walkhg))
+        return "\n".join(forests)
+    wireproto.commands['forests'] = (do_forests, 'walkhg')
+
+
+
 def _sshserver_do_forests(self):
     """Shim this function into the sshserver so that it responds to
     the forests command.  It gives a list of roots relative to the
     self.repo repository, sorted lexigraphically.
     """
-    
+    # hg < 1.7
     key, walkhg = self.getarg()
     forests = self.repo.forests(bool(walkhg))
     self.respond("\n".join(forests))
@@ -580,6 +602,16 @@
             parents = ctx.parents()
             return [node.hex(parents[0].node())]
 
+        def rollback(self):
+            if self._repo:
+                try:
+                    self._repo.transaction('forest').__del__()
+                except TypeError, err:
+                    # Wrong number of arguments for hg < 1.6
+                    if '2 given' not in str(err):
+                        raise
+                    self._repo.transaction().__del__()
+
         def __repr__(self):
             return ("<forest.Tree object "
                     "- repo: %s "
@@ -906,6 +938,8 @@
     source = [source]
     try:
         import hgext.fetch as fetch
+        # Force the lazy importer to trigger
+        fetch.cmdtable
     except ImportError:
         raise util.Abort(_("could not import fetch module\n"))
 
@@ -923,10 +957,7 @@
             fetch.fetch(ui, tree.getrepo(ui), srcpath, **opts)
         except Exception, err:
             ui.warn(_("skipped: %s\n") % err)
-            try:
-                tree.repo.transaction().__del__()
-            except AttributeError:
-                pass
+            tree.rollback()
 
     @Forest.Tree.skip
     def check_mq(tree):
@@ -1100,8 +1131,7 @@
             commands.pull(ui, tree.getrepo(ui), srcpath, **opts)
         except Exception, err:
             ui.warn(_("skipped: %s\n") % err)
-            if tree._repo:
-                tree.repo.transaction().__del__()
+            tree.rollback()
 
     @Forest.Tree.skip
     def check_mq(tree):
@@ -1141,10 +1171,7 @@
             commands.push(ui, tree.getrepo(ui), destpath, **opts)
         except Exception, err:
             ui.warn(_("skipped: %s\n") % err)
-            try:
-                tree.repo.transaction().__del__()
-            except AttributeError:
-                pass
+            tree.rollback()
 
     @Forest.Tree.skip
     def check_mq(tree):
@@ -1316,7 +1343,7 @@
             commands.tag(ui, tree.getrepo(ui), name, rev_=None, **opts)
         except Exception, err:
             ui.warn(_("skipped: %s\n") % err)
-            tree.repo.transaction().__del__()
+            tree.rollback()
 
     @Forest.Tree.skip
     def check_mq(tree):
@@ -1388,7 +1415,7 @@
                                 clean=opts['clean'], date=opts['date'])
         except Exception, err:
             ui.warn(_("skipped: %s\n") % err)
-            tree.repo.transaction().__del__()
+            tree.rollback()
 
     @Forest.Tree.skip
     def check_mq(tree):
@@ -1475,6 +1502,8 @@
 
     try:
         import hgext.fetch
+        # Force the lazy importer to trigger
+        hgext.fetch.cmdtable
     except ImportError:
         return
     try:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20120921/9a2a38ca/attachment.html>


More information about the macports-changes mailing list