changeset 776:f025d00bfc4a

svnexternals: add 'ignore' mode to avoid converting externals
author Patrick Mezard <pmezard@gmail.com>
date Sun, 12 Dec 2010 15:32:25 +0100
parents 7597ea43a37e
children 60948939555d
files hgsubversion/help/subversion.rst hgsubversion/svnexternals.py tests/test_externals.py
diffstat 3 files changed, 14 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgsubversion/help/subversion.rst
+++ b/hgsubversion/help/subversion.rst
@@ -316,7 +316,7 @@ settings:
     Set to ``subrepos`` to switch to subrepos-based externals support
     (requires Mercurial 1.7.1 or later.) Default is ``svnexternals``,
     which uses a custom hgsubversion-specific format and works on
-    older versions of Mercurial.
+    older versions of Mercurial. Use ``ignore`` to avoid converting externals.
 
 The following options only have an effect on the initial clone of a repository:
 
--- a/hgsubversion/svnexternals.py
+++ b/hgsubversion/svnexternals.py
@@ -343,6 +343,8 @@ def getchanges(ui, repo, parentctx, exts
                 hgsubstate.append('%s %s\n' % (rev, path))
             files['.hgsub'] = ''.join(hgsub)
             files['.hgsubstate'] = ''.join(hgsubstate)
+    elif mode == 'ignore':
+        files = {}
     else:
         raise hgutil.Abort(_('unknown externals modes: %s') % mode)
 
@@ -375,6 +377,8 @@ def parse(ui, ctx):
                 rev = 'HEAD'
             line = norevline.replace('{REV}', rev)
             external.setdefault(base, []).append(line)
+    elif mode == 'ignore':
+        pass
     else:
         raise hgutil.Abort(_('unknown externals modes: %s') % mode)
     return external
--- a/tests/test_externals.py
+++ b/tests/test_externals.py
@@ -214,6 +214,15 @@ 2 deps/project2
     def test_hgsub_stupid(self):
         self.test_hgsub(True)
 
+    def test_ignore(self):
+        repo = self._load_fixture_and_fetch('externals.svndump',
+                                            externals='ignore')
+        for rev in repo:
+            ctx = repo[rev]
+            self.assertTrue('.hgsvnexternals' not in ctx)
+            self.assertTrue('.hgsub' not in ctx)
+            self.assertTrue('.hgsubstate' not in ctx)
+
     def test_updatehgsub(self):
         def checkdeps(ui, repo, rev, deps, nodeps):
             commands.update(ui, repo, node=str(rev))