# HG changeset patch
# User Augie Fackler <durin42@gmail.com>
# Date 1317420095 18000
# Node ID 033b86e0f56dd2e522415afb6c08b274a6f98fa0
# Parent  f28e0f54a6ef30f6eef007e69c1736f667592a9b
stupid/filemap: disable this since it doesn't currently work

hg 1.9 dramatically cleaned up patch application, but unfortunately
this breaks stupid mode with filemaps. In the name of getting a
release out the door, disabling this feature for now. There will be
changes required in hg to make this work again, so we may just drop
the feature entirely if nobody's interested.

diff --git a/hgsubversion/maps.py b/hgsubversion/maps.py
--- a/hgsubversion/maps.py
+++ b/hgsubversion/maps.py
@@ -290,6 +290,10 @@ class FileMap(object):
             return False
         return True
 
+    # Needed so empty filemaps are false
+    def __len__(self):
+        return len(self.include) + len(self.exclude)
+
     def add(self, fn, map, path):
         mapping = getattr(self, map)
         if path in mapping:
diff --git a/hgsubversion/stupid.py b/hgsubversion/stupid.py
--- a/hgsubversion/stupid.py
+++ b/hgsubversion/stupid.py
@@ -2,10 +2,11 @@ import cStringIO
 import errno
 import re
 
-from mercurial import patch
-from mercurial import node
 from mercurial import context
+from mercurial import node
+from mercurial import patch
 from mercurial import revlog
+from mercurial import util as hgutil
 
 import svnwrap
 import svnexternals
@@ -589,6 +590,9 @@ def branches_in_paths(meta, tbdelta, pat
 def convert_rev(ui, meta, svn, r, tbdelta, firstrun):
     # this server fails at replay
 
+    if meta.filemap:
+        raise hgutil.Abort('filemaps currently unsupported with stupid replay.')
+
     branches = branches_in_paths(meta, tbdelta, r.paths, r.revnum,
                                  svn.checkpath, svn.list_files)
     brpaths = branches.values()
diff --git a/tests/test_fetch_mappings.py b/tests/test_fetch_mappings.py
--- a/tests/test_fetch_mappings.py
+++ b/tests/test_fetch_mappings.py
@@ -26,7 +26,7 @@ class MapTests(test_util.TestBase):
     @property
     def branchmap(self):
         return os.path.join(self.tmpdir, 'branchmap')
-	
+
     @property
     def tagmap(self):
         return os.path.join(self.tmpdir, 'tagmap')
@@ -112,7 +112,8 @@ class MapTests(test_util.TestBase):
         self.assertEqual(node.hex(self.repo['default'].node()), 'e524296152246b3837fe9503c83b727075835155')
 
     def test_file_map_stupid(self):
-        self.test_file_map(True)
+        # TODO: re-enable test if we ever reinstate this feature
+        self.assertRaises(hgutil.Abort, self.test_file_map, True)
 
     def test_file_map_exclude(self, stupid=False):
         test_util.load_svndump_fixture(self.repo_path, 'replace_trunk_with_branch.svndump')
@@ -127,7 +128,8 @@ class MapTests(test_util.TestBase):
         self.assertEqual(node.hex(self.repo['default'].node()), 'b37a3c0297b71f989064d9b545b5a478bbed7cc1')
 
     def test_file_map_exclude_stupid(self):
-        self.test_file_map_exclude(True)
+        # TODO: re-enable test if we ever reinstate this feature
+        self.assertRaises(hgutil.Abort, self.test_file_map_exclude, True)
 
     def test_branchmap(self, stupid=False):
         test_util.load_svndump_fixture(self.repo_path, 'branchmap.svndump')