Rev 3782: PreviewTree.iter_changes accepts all standard parameters (abentley) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Thu Oct 16 22:31:38 BST 2008


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 3782
revision-id: pqm at pqm.ubuntu.com-20081016213135-0115pw9c95l2dyxq
parent: pqm at pqm.ubuntu.com-20081016204321-ayg99pvl7sr7y6qu
parent: aaron at aaronbentley.com-20081016190501-rvjm4em0kmlilhyf
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2008-10-16 22:31:35 +0100
message:
  PreviewTree.iter_changes accepts all standard parameters (abentley)
modified:
  bzrlib/tests/test_transform.py test_transaction.py-20060105172520-b3ffb3946550e6c4
  bzrlib/transform.py            transform.py-20060105172343-dd99e54394d91687
    ------------------------------------------------------------
    revno: 3363.19.4
    revision-id: aaron at aaronbentley.com-20081016190501-rvjm4em0kmlilhyf
    parent: aaron at aaronbentley.com-20081014030954-g0ht1o6t40v7ecdp
    parent: aaron at aaronbentley.com-20081016190448-2a4ilw7bqsw08190
    committer: Aaron Bentley <aaron at aaronbentley.com>
    branch nick: fix-iter-changes
    timestamp: Thu 2008-10-16 15:05:01 -0400
    message:
      Merge direct-patching into fix-iter-changes
    modified:
      bzrlib/patches.py              patches.py-20050727183609-378c1cc5972ce908
    ------------------------------------------------------------
    revno: 3363.19.3
    revision-id: aaron at aaronbentley.com-20081014030954-g0ht1o6t40v7ecdp
    parent: aaron at aaronbentley.com-20081014025056-dlyb96nmtv4aenuj
    parent: aaron at aaronbentley.com-20081014030136-8h0rtrxhq8q1d1zu
    committer: Aaron Bentley <aaron at aaronbentley.com>
    branch nick: fix-iter-changes
    timestamp: Mon 2008-10-13 23:09:54 -0400
    message:
      Merge direct-patching into fix-iter-changes
    modified:
      bzrlib/patches.py              patches.py-20050727183609-378c1cc5972ce908
      bzrlib/tests/test_patches.py   test_patches.py-20051231203844-f4974d20f6aea09c
    ------------------------------------------------------------
    revno: 3363.19.2
    revision-id: aaron at aaronbentley.com-20081014025056-dlyb96nmtv4aenuj
    parent: aaron at aaronbentley.com-20081013150916-fq1vm0mvw72jcc3n
    parent: aaron at aaronbentley.com-20081014025051-hd8sbbq3yeqrb49t
    committer: Aaron Bentley <aaron at aaronbentley.com>
    branch nick: fix-iter-changes
    timestamp: Mon 2008-10-13 22:50:56 -0400
    message:
      Merge direct-patching into fix-iter-changes
    added:
      bzrlib/tests/blackbox/test_dump_btree.py test_dump_btree.py-20081008203335-zkpcq230b6vubszz-1
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
      bzrlib/knit.py                 knit.py-20051212171256-f056ac8f0fbe1bd9
      bzrlib/tests/blackbox/__init__.py __init__.py-20051128053524-eba30d8255e08dc3
      bzrlib/transform.py            transform.py-20060105172343-dd99e54394d91687
      bzrlib/tree.py                 tree.py-20050309040759-9d5f2496be663e77
      doc/developers/ppa.txt         ppa.txt-20080722055539-606u7t2z32t3ae4w-1
      setup.py                       setup.py-20050314065409-02f8a0a6e3f9bc70
    ------------------------------------------------------------
    revno: 3363.19.1
    revision-id: aaron at aaronbentley.com-20081013150916-fq1vm0mvw72jcc3n
    parent: aaron at aaronbentley.com-20081010231442-6be32m59zo304a90
    committer: Aaron Bentley <aaron at aaronbentley.com>
    branch nick: merge-into2
    timestamp: Mon 2008-10-13 11:09:16 -0400
    message:
      Make PreviewTree.iter_changes accept all options.
    modified:
      bzrlib/tests/test_transform.py test_transaction.py-20060105172520-b3ffb3946550e6c4
      bzrlib/transform.py            transform.py-20060105172343-dd99e54394d91687
=== modified file 'bzrlib/tests/test_transform.py'
--- a/bzrlib/tests/test_transform.py	2008-10-10 11:55:03 +0000
+++ b/bzrlib/tests/test_transform.py	2008-10-13 15:09:16 +0000
@@ -2013,6 +2013,13 @@
         resolve_conflicts(tt)
 
 
+A_ENTRY = ('a-id', ('a', 'a'), True, (True, True),
+                  ('TREE_ROOT', 'TREE_ROOT'), ('a', 'a'), ('file', 'file'),
+                  (False, False))
+ROOT_ENTRY = ('TREE_ROOT', ('', ''), False, (True, True), (None, None),
+              ('', ''), ('directory', 'directory'), (False, None))
+
+
 class TestTransformPreview(tests.TestCaseWithTransport):
 
     def create_tree(self):
@@ -2090,23 +2097,25 @@
                           (False, False))],
                           list(preview_tree.iter_changes(revision_tree)))
 
-    def test_include_unchanged_value_error(self):
+    def test_include_unchanged_succeeds(self):
         revision_tree, preview_tree = self.get_tree_and_preview_tree()
-        e = self.assertRaises(ValueError, preview_tree.iter_changes,
-                              revision_tree, include_unchanged=True)
-        self.assertEqual('include_unchanged is not supported', str(e))
+        changes = preview_tree.iter_changes(revision_tree,
+                                            include_unchanged=True)
+        root = revision_tree.inventory.root.file_id
+
+        self.assertEqual([ROOT_ENTRY, A_ENTRY], list(changes))
 
     def test_specific_files(self):
         revision_tree, preview_tree = self.get_tree_and_preview_tree()
-        e = self.assertRaises(ValueError, preview_tree.iter_changes,
-                              revision_tree, specific_files=['pete'])
-        self.assertEqual('specific_files is not supported', str(e))
+        changes = preview_tree.iter_changes(revision_tree,
+                                            specific_files=[''])
+        self.assertEqual([ROOT_ENTRY, A_ENTRY], list(changes))
 
-    def test_want_unversioned_value_error(self):
+    def test_want_unversioned(self):
         revision_tree, preview_tree = self.get_tree_and_preview_tree()
-        e = self.assertRaises(ValueError, preview_tree.iter_changes,
-                              revision_tree, want_unversioned=True)
-        self.assertEqual('want_unversioned is not supported', str(e))
+        changes = preview_tree.iter_changes(revision_tree,
+                                            want_unversioned=True)
+        self.assertEqual([ROOT_ENTRY, A_ENTRY], list(changes))
 
     def test_ignore_extra_trees_no_specific_files(self):
         # extra_trees is harmless without specific_files, so we'll silently

=== modified file 'bzrlib/transform.py'
--- a/bzrlib/transform.py	2008-10-14 02:34:56 +0000
+++ b/bzrlib/transform.py	2008-10-14 02:50:56 +0000
@@ -1753,11 +1753,11 @@
                       require_versioned=True, want_unversioned=False):
         """See InterTree.iter_changes.
 
-        This implementation does not support include_unchanged, specific_files,
-        or want_unversioned.  extra_trees, require_versioned, and pb are
-        ignored.
+        This has a fast path that is only used when the from_tree matches
+        the transform tree, and no fancy options are supplied.
         """
-        if from_tree is not self._transform._tree:
+        if (from_tree is not self._transform._tree or include_unchanged or
+            specific_files or want_unversioned):
             return tree.InterTree(from_tree, self).iter_changes(
                 include_unchanged=include_unchanged,
                 specific_files=specific_files,
@@ -1765,10 +1765,6 @@
                 extra_trees=extra_trees,
                 require_versioned=require_versioned,
                 want_unversioned=want_unversioned)
-        if include_unchanged:
-            raise ValueError('include_unchanged is not supported')
-        if specific_files is not None:
-            raise ValueError('specific_files is not supported')
         if want_unversioned:
             raise ValueError('want_unversioned is not supported')
         return self._transform.iter_changes()




More information about the bazaar-commits mailing list