[cig-commits] commit: fpull should work when remote repositories don't support Forest.

Mercurial hg at geodynamics.org
Mon Nov 24 11:27:14 PST 2008


changeset:   73:6dd6e6b166b2
user:        Simon Law <simon at akoha.org>
date:        Tue Sep 04 12:40:03 2007 -0400
files:       forest.py
description:
fpull should work when remote repositories don't support Forest.


diff -r 1c916e260ece -r 6dd6e6b166b2 forest.py
--- a/forest.py	Wed Aug 29 12:10:35 2007 -0400
+++ b/forest.py	Tue Sep 04 12:40:03 2007 -0400
@@ -949,22 +949,30 @@ def pull(ui, top, source="default", path
     source = [source]
     walkhg = walkhgenabled(ui, opts['walkhg'])
     forest = Forest(top=top, snapfile=snapfile, walkhg=walkhg)
+    toproot = forest.top().root
     if not snapfile:
         # Look for new remote paths from source
         srcrepo = hg.repository(ui, forest.top().getpath(source))
-        newrepos = [util.localpath(root) for root in srcrepo.forests(walkhg)]
-        toproot = forest.top().root
-        for tree in forest.trees:
-            try:
-                newrepos.remove(relpath(toproot, tree.root))
-            except Exception, err:
-                pass
-        forest.trees.extend([Forest.Tree(root=os.path.join(toproot, new))
-                             for new in newrepos])
-        forest.trees.sort(key=(lambda tree: tree.root))
-        opts['pull'] = True
-        opts['uncompressed'] = None
-        opts['noupdate'] = not opts['update']
+        srcforests = None
+        try:
+            srcforests = srcrepo.forests(walkhg)
+        except util.Abort, err:
+            ui.note(_("skipped new forests: %s\n") % err)
+        if srcforests:
+            ui.note(_("looking for new forests\n"))
+            newrepos = [util.localpath(root) for root in srcforests]
+            for tree in forest.trees:
+                try:
+                    newrepos.remove(relpath(toproot, tree.root))
+                except Exception, err:
+                    pass
+            ui.note(_("found new forests: %s\n") % newrepos)
+            forest.trees.extend([Forest.Tree(root=os.path.join(toproot, new))
+                                 for new in newrepos])
+            forest.trees.sort(key=(lambda tree: tree.root))
+    opts['pull'] = True
+    opts['uncompressed'] = None
+    opts['noupdate'] = not opts['update']
 
     def function(tree, srcpath, opts):
         if snapfile:



More information about the CIG-COMMITS mailing list