changeset 39:62227d7f2d23

use hg.repository() directly instead of a wrapper The wrapper is not needed because: o symbolic links to repositories do not work since enumerate_repos() rely util.walkrepos() o localrepo.__init__() dreferences symbolic links
author Robin Farine <robin.farine@terminus.org>
date Fri, 22 Dec 2006 22:01:50 +0100
parents b29f327bdc10
children 34704814569f
files forest.py
diffstat 1 files changed, 5 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/forest.py	Fri Dec 22 02:14:02 2006 +0100
+++ b/forest.py	Fri Dec 22 22:01:50 2006 +0100
@@ -101,15 +101,6 @@
     return False
 
 
-def repository(ui, rpath):
-    while os.path.islink(rpath):
-        path = os.readlink(rpath)
-        if not os.path.isabs(path):
-            path = os.path.join(os.path.dirname(rpath), path)
-        rpath = path
-    return hg.repository(ui, rpath)
-
-
 class ForestSnapshot(object):
 
     class Tree(object):
@@ -174,8 +165,8 @@
                 repo = toprepo
             else:
                 try:
-                    repo = repository(ui,
-                                      os.path.join(pfx, util.localpath(root)))
+                    rpath = os.path.join(pfx, util.localpath(root))
+                    repo = hg.repository(ui, rpath)
                 except RepoError:
                     ui.write(_("skipped, no valid repo found\n\n"))
                     continue
@@ -202,7 +193,7 @@
             if root == '':
                 root = '.'
             else:
-                repo = repository(ui, rpath)
+                repo = hg.repository(ui, rpath)
             if mq_fatal and mq_patches_applied(rpath):
                 raise util.Abort(_("'%s' has mq patches applied") % root)
             if tip:
@@ -245,7 +236,7 @@
         commands.clone(ui, repo.root, destpath, **opts)
 
     snapshot = ForestSnapshot()
-    repo = repository(ui, source)
+    repo = hg.repository(ui, source)
     snapshot.update(ui, repo, True)
     snapshot(ui, repo, doit, mq_check=False)
 
@@ -326,7 +317,7 @@
         if not opts['tip']:
             rev = cfg.get(section, 'revision')
             if rev and rev != 'tip' and rev != node.nullid:
-                repo = repository(ui, dest)
+                repo = hg.repository(ui, dest)
                 commands.update(repo.ui, repo, node=rev)
         ui.write("\n")