Rev 2573: * ``bzrlib.add.FastPath`` is now private and moved to in sftp://rookery/~/public_html/baz2.0/add

Robert Collins robertc at robertcollins.net
Tue Jul 3 03:38:49 BST 2007


At sftp://rookery/~/public_html/baz2.0/add

------------------------------------------------------------
revno: 2573
revision-id: robertc at robertcollins.net-20070703023836-etkrpxm2rmbhqgaj
parent: robertc at robertcollins.net-20070703023332-jz0qdt2dwhzjuhlc
committer: Robert Collins <robertc at robertcollins.net>
branch nick: add
timestamp: Tue 2007-07-03 12:38:36 +1000
message:
  * ``bzrlib.add.FastPath`` is now private and moved to 
    ``bzrlib.mutabletree._FastPath``. (Robert Collins, Martin Pool)
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/mutabletree.py          mutabletree.py-20060906023413-4wlkalbdpsxi2r4y-2
  bzrlib/tests/test_smart_add.py test_smart_add.py-20050824235919-c60dcdb0c8e999ce
=== modified file 'NEWS'
--- a/NEWS	2007-07-03 02:33:32 +0000
+++ b/NEWS	2007-07-03 02:38:36 +0000
@@ -84,11 +84,14 @@
 
     * ``bzrlib.add.smart_add_tree`` will no longer perform glob expansion on
       win32. Callers of the function should do this and use the new
-      ``MutableTree.smart_add`` method instead.(Robert Collins)
+      ``MutableTree.smart_add`` method instead. (Robert Collins)
 
     * ``bzrlib.add.glob_expand_for_win32`` is now
       ``bzrlib.win32utils.glob_expand``.  (Robert Collins)
 
+    * ``bzrlib.add.FastPath`` is now private and moved to 
+      ``bzrlib.mutabletree._FastPath``. (Robert Collins, Martin Pool)
+
   INTERNALS:
 
     * New SMTPConnection class to unify email handling.  (Adeodato Simó)

=== modified file 'bzrlib/mutabletree.py'
--- a/bzrlib/mutabletree.py	2007-07-03 02:33:32 +0000
+++ b/bzrlib/mutabletree.py	2007-07-03 02:38:36 +0000
@@ -310,7 +310,7 @@
         # relative : its cheaper to make a tree relative path an abspath
         # than to convert an abspath to tree relative.
         for filepath in file_list:
-            rf = FastPath(self.relpath(filepath))
+            rf = _FastPath(self.relpath(filepath))
             # validate user parameters. Our recursive code avoids adding new files
             # that need such validation 
             if self.is_control_filename(rf.raw_path):
@@ -428,7 +428,7 @@
                         mutter("skip control directory %r", subp)
                     elif subf in this_ie.children:
                         # recurse into this already versioned subdir.
-                        dirs_to_add.append((FastPath(subp, subf), this_ie))
+                        dirs_to_add.append((_FastPath(subp, subf), this_ie))
                     else:
                         # user selection overrides ignoes
                         # ignore while selecting files - if we globbed in the
@@ -439,14 +439,14 @@
                             ignored.setdefault(ignore_glob, []).append(subp)
                         else:
                             #mutter("queue to add sub-file %r", subp)
-                            dirs_to_add.append((FastPath(subp, subf), this_ie))
+                            dirs_to_add.append((_FastPath(subp, subf), this_ie))
 
         if len(added) > 0 and save:
             self._write_inventory(inv)
         return added, ignored
 
 
-class FastPath(object):
+class _FastPath(object):
     """A path object with fast accessors for things like basename."""
 
     __slots__ = ['raw_path', 'base_path']
@@ -491,7 +491,8 @@
         # note that the dirname use leads to some extra str copying etc but as
         # there are a limited number of dirs we can be nested under, it should
         # generally find it very fast and not recurse after that.
-        added = _add_one_and_parent(tree, inv, None, FastPath(dirname(path.raw_path)), 'directory', action)
+        added = _add_one_and_parent(tree, inv, None,
+            _FastPath(dirname(path.raw_path)), 'directory', action)
         parent_id = inv.path2id(dirname(path.raw_path))
         parent_ie = inv[parent_id]
     _add_one(tree, inv, parent_ie, path, kind, action)

=== modified file 'bzrlib/tests/test_smart_add.py'
--- a/bzrlib/tests/test_smart_add.py	2007-07-03 02:33:32 +0000
+++ b/bzrlib/tests/test_smart_add.py	2007-07-03 02:38:36 +0000
@@ -154,10 +154,11 @@
 
     def run_action(self, output):
         from bzrlib.add import AddAction
-        from bzrlib.mutabletree import FastPath
+        from bzrlib.mutabletree import _FastPath
         inv = Inventory()
         stdout = StringIO()
         action = AddAction(to_file=stdout, should_print=bool(output))
 
-        self.apply_redirected(None, stdout, None, action, inv, None, FastPath('path'), 'file')
+        self.apply_redirected(None, stdout, None, action, inv, None,
+            _FastPath('path'), 'file')
         self.assertEqual(stdout.getvalue(), output)



More information about the bazaar-commits mailing list