diff __init__.py @ 326:33736e2e25f0

alternate approach for supporting svn schemes for repository paths We now intercept the operations in the local repo class, and handle the relevant operation ourselves. This frees us from wrapping all relevant commands and replicating their functionality. The implementation is incomplete; only one test has been modified to use the standard Mercurial API with the changed URLs. Once changed, those tests will likely reveal bugs or missing features in the new wrappers. Also, new wrappers will be needed for handling conversion flags such as -A/--authormap.
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Thu, 07 May 2009 20:50:53 +0200
parents ce676eff002b
children 48ec2d62dc29
line wrap: on
line diff
--- a/__init__.py
+++ b/__init__.py
@@ -18,6 +18,7 @@ import traceback
 
 from mercurial import commands
 from mercurial import extensions
+from mercurial import hg
 from mercurial import util as hgutil
 
 from svn import core
@@ -28,12 +29,6 @@ import util
 import wrappers
 import svnexternals
 
-def reposetup(ui, repo):
-    if not util.is_svn_repo(repo):
-        return
-
-    repo.__class__ = tag_repo.generate_repo_class(ui, repo)
-
 def uisetup(ui):
     """Do our UI setup.
 
@@ -55,20 +50,6 @@ def uisetup(ui):
                                    wrappers.push)
     entry[1].append(('', 'svn', None, "push to subversion"))
     entry[1].append(('', 'svn-stupid', None, "use stupid replay during push to svn"))
-    entry = extensions.wrapcommand(commands.table, 'pull',
-                                   wrappers.pull)
-    entry[1].append(('', 'svn', None, "pull from subversion"))
-    entry[1].append(('', 'svn-stupid', None, "use stupid replay during pull from svn"))
-
-    entry = extensions.wrapcommand(commands.table, 'clone',
-                                   wrappers.clone)
-    entry[1].extend([#('', 'skipto-rev', '0', 'skip commits before this revision.'),
-                     ('', 'svn-stupid', False, 'be stupid and use diffy replay.'),
-                     ('', 'svn-tag-locations', 'tags', 'Relative path to Subversion tags.'),
-                     ('', 'svn-authors', '', 'username mapping filename'),
-                     ('', 'svn-filemap', '',
-                      'remap file to exclude paths or include only certain paths'),
-                     ])
 
     try:
         rebase = extensions.find('rebase')
@@ -115,7 +96,12 @@ def svn(ui, repo, subcommand, *args, **o
         else:
             raise
 
+def reposetup(ui, repo):
+    if repo.local():
+       tag_repo.generate_repo_class(ui, repo)
 
+for scheme in ('svn', 'svn+ssh', 'svn+http', 'svn+file'):
+    hg.schemes[scheme] = tag_repo
 
 cmdtable = {
     "svn":