Fix tests.
authorJelmer Vernooij <jelmer@samba.org>
Sat, 6 Nov 2010 17:06:28 +0000 (18:06 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Sat, 6 Nov 2010 17:06:28 +0000 (18:06 +0100)
fastimport/commands.py
fastimport/processors/filter_processor.py
fastimport/tests/test_head_tracking.py
fastimport/tests/test_parser.py

index 5c68a76df1e80869219dc55b9de3c7bc1b076f87..fe2379bfccb9af7825b8f8c3d130b976d53b207b 100644 (file)
@@ -208,8 +208,7 @@ class CommitCommand(ImportCommand):
         # file_iter may be a callable or an iterator
         if callable(self.file_iter):
             return self.file_iter()
-        elif self.file_iter:
-            return iter(self.file_iter)
+        return iter(self.file_iter)
 
 
 class FeatureCommand(ImportCommand):
index 0228132a2bf0a564a805db6266dc267073465a59..4f254baacb7f7e824da6af535be158e01828ce6f 100644 (file)
@@ -91,7 +91,7 @@ class FilterProcessor(processor.ImportProcessor):
     def commit_handler(self, cmd):
         """Process a CommitCommand."""
         # These pass through if they meet the filtering conditions
-        interesting_filecmds = self._filter_filecommands(cmd.file_iter)
+        interesting_filecmds = self._filter_filecommands(cmd.iter_files)
         if interesting_filecmds:
             # If all we have is a single deleteall, skip this commit
             if len(interesting_filecmds) == 1 and isinstance(
index 7a1ba644a574b0179d8bd1008bfb55837f2e2a6e..4a2a01843bf832b4951df5b87ed4735826cb3c13 100644 (file)
@@ -227,7 +227,7 @@ class TestHeadTracking(testtools.TestCase):
             if isinstance(cmd, commands.CommitCommand):
                 reftracker.track_heads(cmd)
                 # eat the file commands
-                list(cmd.file_iter())
+                list(cmd.iter_files())
             elif isinstance(cmd, commands.ResetCommand):
                 if cmd.from_ is not None:
                     reftracker.track_heads_for_ref(cmd.ref, cmd.from_)
index 6c0e009290519fbfb0ce135ac3109e504b38dded..6832df3c46afa589a8dfc42f8ede3980cfc5721e 100644 (file)
@@ -153,7 +153,7 @@ class TestImportParser(testtools.TestCase):
         for cmd in p.iter_commands():
             result.append(cmd)
             if cmd.name == 'commit':
-                for fc in cmd.file_iter():
+                for fc in cmd.iter_files():
                     result.append(fc)
         self.assertEqual(len(result), 17)
         cmd1 = result.pop(0)