Rev 4335: NEWS conflict. in http://people.ubuntu.com/~robertc/baz2.0/integration

Robert Collins robertc at robertcollins.net
Thu May 7 00:59:01 BST 2009


At http://people.ubuntu.com/~robertc/baz2.0/integration

------------------------------------------------------------
revno: 4335 [merge]
revision-id: robertc at robertcollins.net-20090506235856-9g3fgc5m5l5bu3ui
parent: robertc at robertcollins.net-20090506234213-puzjtbd3grzhefer
parent: pqm at pqm.ubuntu.com-20090506094512-vta3no53wohda83x
committer: Robert Collins <robertc at robertcollins.net>
branch nick: integration
timestamp: Thu 2009-05-07 09:58:56 +1000
message:
  NEWS conflict.
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/branch.py               branch.py-20050309040759-e4baf4e0d046576e
  bzrlib/branchbuilder.py        branchbuilder.py-20070427022007-zlxpqz2lannhk6y8-1
  bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
  bzrlib/filters/eol.py          eol.py-20090327060429-todzdjmqt3bpv5r8-1
  bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
  bzrlib/rules.py                properties.py-20080506032617-9k06uqalkf09ck0z-1
  bzrlib/tests/blackbox/test_bound_branches.py test_bound_branches.py-20051109215527-2373188ad566c205
  bzrlib/tests/branch_implementations/test_pull.py test_pull.py-20060410103942-83c35b26657414fc
  bzrlib/tests/per_repository/test_fetch.py test_fetch.py-20070814052151-5cxha9slx4c93uog-1
  bzrlib/tests/test_branchbuilder.py test_branchbuilder.p-20070427022007-zlxpqz2lannhk6y8-2
  bzrlib/tests/test_eol_filters.py test_eol_filters.py-20090327060429-todzdjmqt3bpv5r8-2
  bzrlib/tests/test_fetch.py     testfetch.py-20050825090644-f73e07e7dfb1765a
  bzrlib/tree.py                 tree.py-20050309040759-9d5f2496be663e77
  bzrlib/workingtree.py          workingtree.py-20050511021032-29b6ec0a681e02e3
=== modified file 'NEWS'
--- a/NEWS	2009-05-06 23:42:13 +0000
+++ b/NEWS	2009-05-06 23:58:56 +0000
@@ -35,12 +35,18 @@
 * ``--coverage`` works for code running in threads too.
   (Andrew Bennets, Vincent Ladeuil)
 
+* ``bzr pull`` now has a ``--local`` option to only make changes to the
+  local branch, and not the bound master branch.
+  (Gary van der Merwe, #194716)
+
 Bug Fixes
 *********
 
 * Adding now works properly when path contains a symbolic link.
   (Geoff Bache, #183831)
 
+* An error is now raised for unknown eol values. (Brian de Alwis, #358199)
+
 * ``bzr merge --weave`` will now generate a conflict if one side deletes a
   line, and the other side modifies the line. (John Arbash Meinel, #328171)
 
@@ -85,6 +91,10 @@
   content in the stacked-on branch, and thus will handle the situation
   implicitly.  (Robert Collins, #360791)
 
+* Upgrading to, or fetching into a 'rich-root' format will now correctly
+  set the root data the same way that reconcile does.
+  (Robert Collins, #368921)
+
 Documentation
 *************
 

=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py	2009-05-05 12:55:37 +0000
+++ b/bzrlib/branch.py	2009-05-06 06:36:03 +0000
@@ -846,7 +846,8 @@
         return history[revno - 1]
 
     def pull(self, source, overwrite=False, stop_revision=None,
-             possible_transports=None, _override_hook_target=None):
+             possible_transports=None, _override_hook_target=None,
+             local=False):
         """Mirror source into this branch.
 
         This branch is considered to be 'local', having low latency.
@@ -2180,7 +2181,7 @@
     @needs_write_lock
     def pull(self, source, overwrite=False, stop_revision=None,
              _hook_master=None, run_hooks=True, possible_transports=None,
-             _override_hook_target=None):
+             _override_hook_target=None, local=False):
         """See Branch.pull.
 
         :param _hook_master: Private parameter - set the branch to
@@ -2190,7 +2191,12 @@
             so it should not run its hooks.
         :param _override_hook_target: Private parameter - set the branch to be
             supplied as the target_branch to pull hooks.
+        :param local: Only update the local branch, and not the bound branch.
         """
+        # This type of branch can't be bound.
+        if local:
+            raise errors.LocalRequiresBoundBranch()
+        
         result = PullResult()
         result.source_branch = source
         if _override_hook_target is None:
@@ -2278,7 +2284,7 @@
     @needs_write_lock
     def pull(self, source, overwrite=False, stop_revision=None,
              run_hooks=True, possible_transports=None,
-             _override_hook_target=None):
+             _override_hook_target=None, local=False):
         """Pull from source into self, updating my master if any.
 
         :param run_hooks: Private parameter - if false, this branch
@@ -2286,8 +2292,10 @@
             so it should not run its hooks.
         """
         bound_location = self.get_bound_location()
+        if local and not bound_location:
+            raise errors.LocalRequiresBoundBranch()
         master_branch = None
-        if bound_location and source.base != bound_location:
+        if not local and bound_location and source.base != bound_location:
             # not pulling from master, so we need to update master.
             master_branch = self.get_master_branch(possible_transports)
             master_branch.lock_write()

=== modified file 'bzrlib/branchbuilder.py'
--- a/bzrlib/branchbuilder.py	2009-04-18 20:41:29 +0000
+++ b/bzrlib/branchbuilder.py	2009-05-05 03:13:58 +0000
@@ -111,17 +111,23 @@
             reporter=reporter,
             **kwargs)
 
-    def _move_branch_pointer(self, new_revision_id):
+    def _move_branch_pointer(self, new_revision_id,
+        allow_leftmost_as_ghost=False):
         """Point self._branch to a different revision id."""
         self._branch.lock_write()
         try:
             # We don't seem to have a simple set_last_revision(), so we
             # implement it here.
             cur_revno, cur_revision_id = self._branch.last_revision_info()
-            g = self._branch.repository.get_graph()
-            new_revno = g.find_distance_to_null(new_revision_id,
-                                                [(cur_revision_id, cur_revno)])
-            self._branch.set_last_revision_info(new_revno, new_revision_id)
+            try:
+                g = self._branch.repository.get_graph()
+                new_revno = g.find_distance_to_null(new_revision_id,
+                    [(cur_revision_id, cur_revno)])
+                self._branch.set_last_revision_info(new_revno, new_revision_id)
+            except errors.GhostRevisionsHaveNoRevno:
+                if not allow_leftmost_as_ghost:
+                    raise
+                new_revno = 1
         finally:
             self._branch.unlock()
         if self._tree is not None:
@@ -155,7 +161,7 @@
         self._tree = None
 
     def build_snapshot(self, revision_id, parent_ids, actions,
-                       message=None, timestamp=None):
+        message=None, timestamp=None, allow_leftmost_as_ghost=False):
         """Build a commit, shaped in a specific way.
 
         :param revision_id: The handle for the new commit, can be None
@@ -170,12 +176,15 @@
             commit message will be written.
         :param timestamp: If non-None, set the timestamp of the commit to this
             value.
+        :param allow_leftmost_as_ghost: True if the leftmost parent should be
+            permitted to be a ghost.
         :return: The revision_id of the new commit
         """
         if parent_ids is not None:
             base_id = parent_ids[0]
             if base_id != self._branch.last_revision():
-                self._move_branch_pointer(base_id)
+                self._move_branch_pointer(base_id,
+                    allow_leftmost_as_ghost=allow_leftmost_as_ghost)
 
         if self._tree is not None:
             tree = self._tree
@@ -184,7 +193,8 @@
         tree.lock_write()
         try:
             if parent_ids is not None:
-                tree.set_parent_ids(parent_ids)
+                tree.set_parent_ids(parent_ids,
+                    allow_leftmost_as_ghost=allow_leftmost_as_ghost)
             # Unfortunately, MemoryTree.add(directory) just creates an
             # inventory entry. And the only public function to create a
             # directory is MemoryTree.mkdir() which creates the directory, but

=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2009-04-29 20:31:34 +0000
+++ b/bzrlib/builtins.py	2009-05-06 06:36:03 +0000
@@ -882,13 +882,18 @@
             short_name='d',
             type=unicode,
             ),
+        Option('local',
+            help="Perform a local pull in a bound "
+                 "branch.  Local pulls are not applied to "
+                 "the master branch."
+            ),
         ]
     takes_args = ['location?']
     encoding_type = 'replace'
 
     def run(self, location=None, remember=False, overwrite=False,
             revision=None, verbose=False,
-            directory=None):
+            directory=None, local=False):
         # FIXME: too much stuff is in the command class
         revision_id = None
         mergeable = None
@@ -900,6 +905,9 @@
         except errors.NoWorkingTree:
             tree_to = None
             branch_to = Branch.open_containing(directory)[0]
+        
+        if local and not branch_to.get_bound_location():
+            raise errors.LocalRequiresBoundBranch()
 
         possible_transports = []
         if location is not None:
@@ -948,9 +956,11 @@
                     unversioned_filter=tree_to.is_ignored, view_info=view_info)
                 result = tree_to.pull(branch_from, overwrite, revision_id,
                                       change_reporter,
-                                      possible_transports=possible_transports)
+                                      possible_transports=possible_transports,
+                                      local=local)
             else:
-                result = branch_to.pull(branch_from, overwrite, revision_id)
+                result = branch_to.pull(branch_from, overwrite, revision_id,
+                                      local=local)
 
             result.report(self.outf)
             if verbose and result.old_revid != result.new_revid:

=== modified file 'bzrlib/filters/eol.py'
--- a/bzrlib/filters/eol.py	2009-04-20 08:37:32 +0000
+++ b/bzrlib/filters/eol.py	2009-05-06 05:31:47 +0000
@@ -22,6 +22,8 @@
 
 import re, sys
 
+from bzrlib.errors import BzrError
+
 
 # Real Linux/Unix/OSX newline - \n without \r before it
 _LINUX_NL_RE = re.compile(r'(?<!\r)\n')
@@ -66,5 +68,8 @@
             [ContentFilter(_to_crlf_converter, _to_crlf_converter)],
         }
     def eol_lookup(key):
-        return _eol_filter_stack_map.get(key)
+        filter = _eol_filter_stack_map.get(key)
+        if filter is None:
+            raise BzrError("Unknown eol value '%s'" % key)
+        return filter
     register_filter_stack_map('eol', eol_lookup)

=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py	2009-05-01 07:59:02 +0000
+++ b/bzrlib/repository.py	2009-05-05 03:13:58 +0000
@@ -3557,7 +3557,7 @@
         """Get the parent keys for a given root id."""
         root_id, rev_id = root_key
         # Include direct parents of the revision, but only if they used
-        # the same root_id.
+        # the same root_id and are heads.
         parent_keys = []
         for parent_id in parent_map[rev_id]:
             if parent_id == _mod_revision.NULL_REVISION:
@@ -3577,9 +3577,32 @@
                 self._revision_id_to_root_id[parent_id] = None
             else:
                 parent_root_id = self._revision_id_to_root_id[parent_id]
-            if root_id == parent_root_id or parent_root_id is None:
-                parent_keys.append((root_id, parent_id))
-        return tuple(parent_keys)
+            if root_id == parent_root_id:
+                # With stacking we _might_ want to refer to a non-local
+                # revision, but this code path only applies when we have the
+                # full content available, so ghosts really are ghosts, not just
+                # the edge of local data.
+                parent_keys.append((parent_id,))
+            else:
+                # root_id may be in the parent anyway.
+                try:
+                    tree = self.source.revision_tree(parent_id)
+                except errors.NoSuchRevision:
+                    # ghost, can't refer to it.
+                    pass
+                else:
+                    try:
+                        parent_keys.append((tree.inventory[root_id].revision,))
+                    except errors.NoSuchId:
+                        # not in the tree
+                        pass
+        g = graph.Graph(self.source.revisions)
+        heads = g.heads(parent_keys)
+        selected_keys = []
+        for key in parent_keys:
+            if key in heads and key not in selected_keys:
+                selected_keys.append(key)
+        return tuple([(root_id,)+ key for key in selected_keys])
 
     def _new_root_data_stream(self, root_keys_to_create, parent_map):
         for root_key in root_keys_to_create:

=== modified file 'bzrlib/rules.py'
--- a/bzrlib/rules.py	2009-03-23 14:59:43 +0000
+++ b/bzrlib/rules.py	2009-05-02 21:26:05 +0000
@@ -36,6 +36,9 @@
 FILE_PREFS_PREFIX = 'name '
 FILE_PREFS_PREFIX_LEN = len(FILE_PREFS_PREFIX)
 
+# The object providing default rules
+_per_user_searcher = None
+
 
 class _RulesSearcher(object):
     """An object that provides rule-based preferences."""
@@ -146,5 +149,8 @@
     return osutils.pathjoin(config.config_dir(), 'rules')
 
 
-# The object providing default rules
-_per_user_searcher = _IniBasedRulesSearcher(rules_filename())
+def reset_rules():
+    global _per_user_searcher
+    _per_user_searcher = _IniBasedRulesSearcher(rules_filename())
+
+reset_rules()

=== modified file 'bzrlib/tests/blackbox/test_bound_branches.py'
--- a/bzrlib/tests/blackbox/test_bound_branches.py	2009-03-23 14:59:43 +0000
+++ b/bzrlib/tests/blackbox/test_bound_branches.py	2009-05-06 06:36:03 +0000
@@ -228,6 +228,21 @@
 
         self.check_revno(2, '../base')
 
+    def test_pull_local_updates_local(self):
+        base_tree = self.create_branches()[0]
+        newchild_tree = base_tree.bzrdir.sprout('newchild').open_workingtree()
+        self.build_tree_contents([('newchild/b', 'newchild b contents\n')])
+        newchild_tree.commit(message='newchild')
+        self.check_revno(2, 'newchild')
+
+        os.chdir('child')
+        # The pull should succeed, and update
+        # the bound parent branch
+        self.run_bzr('pull ../newchild --local')
+        self.check_revno(2)
+
+        self.check_revno(1, '../base')
+
     def test_bind_diverged(self):
         base_tree, child_tree = self.create_branches()
         base_branch = base_tree.branch

=== modified file 'bzrlib/tests/branch_implementations/test_pull.py'
--- a/bzrlib/tests/branch_implementations/test_pull.py	2009-03-23 14:59:43 +0000
+++ b/bzrlib/tests/branch_implementations/test_pull.py	2009-05-06 06:36:03 +0000
@@ -70,6 +70,32 @@
         self.assertEqual([rev1, rev2], checkout.branch.revision_history())
         self.assertEqual([rev1, rev2], master_tree.branch.revision_history())
 
+    def test_pull_local_updates_checkout_only(self):
+        """Pulling --local into a checkout updates the checkout and not the
+        master branch"""
+        master_tree = self.make_branch_and_tree('master')
+        rev1 = master_tree.commit('master')
+        checkout = master_tree.branch.create_checkout('checkout')
+
+        other = master_tree.branch.bzrdir.sprout('other').open_workingtree()
+        rev2 = other.commit('other commit')
+        # now pull local, which should update checkout but not master.
+        checkout.branch.pull(other.branch, local = True)
+        self.assertEqual([rev1, rev2], checkout.branch.revision_history())
+        self.assertEqual([rev1], master_tree.branch.revision_history())
+
+    def test_pull_local_raises_LocalRequiresBoundBranch_on_unbound(self):
+        """Pulling --local into a branch that is not bound should fail."""
+        master_tree = self.make_branch_and_tree('branch')
+        rev1 = master_tree.commit('master')
+
+        other = master_tree.branch.bzrdir.sprout('other').open_workingtree()
+        rev2 = other.commit('other commit')
+        # now pull --local, which should raise LocalRequiresBoundBranch error.
+        self.assertRaises(errors.LocalRequiresBoundBranch,
+                          master_tree.branch.pull, other.branch, local = True)
+        self.assertEqual([rev1], master_tree.branch.revision_history())
+
     def test_pull_raises_specific_error_on_master_connection_error(self):
         master_tree = self.make_branch_and_tree('master')
         checkout = master_tree.branch.create_checkout('checkout')

=== modified file 'bzrlib/tests/per_repository/test_fetch.py'
--- a/bzrlib/tests/per_repository/test_fetch.py	2009-03-23 14:59:43 +0000
+++ b/bzrlib/tests/per_repository/test_fetch.py	2009-05-06 01:04:25 +0000
@@ -20,8 +20,10 @@
     bzrdir,
     errors,
     gpg,
+    remote,
     repository,
     )
+from bzrlib.inventory import ROOT_ID
 from bzrlib.tests import TestSkipped
 from bzrlib.tests.per_repository import TestCaseWithRepository
 from bzrlib.transport import get_transport
@@ -99,6 +101,136 @@
         rev2_tree = knit3_repo.revision_tree('rev2')
         self.assertEqual('rev1', rev2_tree.inventory.root.revision)
 
+    def do_test_fetch_to_rich_root_sets_parents_correctly(self, result,
+        snapshots, root_id=ROOT_ID, allow_lefthand_ghost=False):
+        """Assert that result is the parents of 'tip' after fetching snapshots.
+
+        This helper constructs a 1.9 format source, and a test-format target
+        and fetches the result of building snapshots in the source, then
+        asserts that the parents of tip are result.
+
+        :param result: A parents list for the inventories.get_parent_map call.
+        :param snapshots: An iterable of snapshot parameters for
+            BranchBuilder.build_snapshot.
+        '"""
+        # This overlaps slightly with the tests for commit builder about graph
+        # consistency.
+        # Cases:
+        repo = self.make_repository('target')
+        remote_format = isinstance(repo, remote.RemoteRepository)
+        if not repo._format.rich_root_data and not remote_format:
+            return # not relevant
+        builder = self.make_branch_builder('source', format='1.9')
+        builder.start_series()
+        for revision_id, parent_ids, actions in snapshots:
+            builder.build_snapshot(revision_id, parent_ids, actions,
+            allow_leftmost_as_ghost=allow_lefthand_ghost)
+        builder.finish_series()
+        source = builder.get_branch()
+        if remote_format and not repo._format.rich_root_data:
+            # use a manual rich root format to ensure the code path is tested.
+            repo = self.make_repository('remote-target',
+                format='1.9-rich-root')
+        repo.lock_write()
+        self.addCleanup(repo.unlock)
+        repo.fetch(source.repository)
+        self.assertEqual(result,
+            repo.texts.get_parent_map([(root_id, 'tip')])[(root_id, 'tip')])
+
+    def test_fetch_to_rich_root_set_parent_no_parents(self):
+        # No parents rev -> No parents
+        self.do_test_fetch_to_rich_root_sets_parents_correctly((),
+            [('tip', None, [('add', ('', ROOT_ID, 'directory', ''))]),
+            ])
+
+    def test_fetch_to_rich_root_set_parent_1_parent(self):
+        # 1 parent rev -> 1 parent 
+        self.do_test_fetch_to_rich_root_sets_parents_correctly(
+            ((ROOT_ID, 'base'),),
+            [('base', None, [('add', ('', ROOT_ID, 'directory', ''))]),
+             ('tip', None, []),
+            ])
+
+    def test_fetch_to_rich_root_set_parent_1_ghost_parent(self):
+        # 1 ghost parent -> No parents
+        self.do_test_fetch_to_rich_root_sets_parents_correctly((),
+            [('tip', ['ghost'], [('add', ('', ROOT_ID, 'directory', ''))]),
+            ], allow_lefthand_ghost=True)
+
+    def test_fetch_to_rich_root_set_parent_2_head_parents(self):
+        # 2 parents both heads -> 2 parents
+        self.do_test_fetch_to_rich_root_sets_parents_correctly(
+            ((ROOT_ID, 'left'), (ROOT_ID, 'right')),
+            [('base', None, [('add', ('', ROOT_ID, 'directory', ''))]),
+             ('left', None, []),
+             ('right', ['base'], []),
+             ('tip', ['left', 'right'], []),
+            ])
+
+    def test_fetch_to_rich_root_set_parent_2_parents_1_head(self):
+        # 2 parents one head -> 1 parent
+        self.do_test_fetch_to_rich_root_sets_parents_correctly(
+            ((ROOT_ID, 'right'),),
+            [('left', None, [('add', ('', ROOT_ID, 'directory', ''))]),
+             ('right', None, []),
+             ('tip', ['left', 'right'], []),
+            ])
+
+    def test_fetch_to_rich_root_set_parent_1_parent_different_id_gone(self):
+        # 1 parent different fileid, ours missing -> no parents
+        self.do_test_fetch_to_rich_root_sets_parents_correctly(
+            (),
+            [('base', None, [('add', ('', ROOT_ID, 'directory', ''))]),
+             ('tip', None, [('unversion', ROOT_ID),
+                            ('add', ('', 'my-root', 'directory', '')),
+                            ]),
+            ], root_id='my-root')
+
+    def test_fetch_to_rich_root_set_parent_1_parent_different_id_moved(self):
+        # 1 parent different fileid, ours moved -> 1 parent
+        # (and that parent honours the changing revid of the other location)
+        self.do_test_fetch_to_rich_root_sets_parents_correctly(
+            (('my-root', 'origin'),),
+            [('origin', None, [('add', ('', ROOT_ID, 'directory', '')),
+                             ('add', ('child', 'my-root', 'directory', ''))]),
+             ('base', None, []),
+             ('tip', None, [('unversion', 'my-root'),
+                            ('unversion', ROOT_ID),
+                            ('add', ('', 'my-root', 'directory', '')),
+                            ]),
+            ], root_id='my-root')
+
+    def test_fetch_to_rich_root_set_parent_2_parent_1_different_id_gone(self):
+        # 2 parents, 1 different fileid, our second missing -> 1 parent
+        self.do_test_fetch_to_rich_root_sets_parents_correctly(
+            (('my-root', 'right'),),
+            [('base', None, [('add', ('', ROOT_ID, 'directory', ''))]),
+             ('right', None, [('unversion', ROOT_ID),
+                              ('add', ('', 'my-root', 'directory', ''))]),
+             ('tip', ['base', 'right'], [('unversion', ROOT_ID),
+                            ('add', ('', 'my-root', 'directory', '')),
+                            ]),
+            ], root_id='my-root')
+
+    def test_fetch_to_rich_root_set_parent_2_parent_2_different_id_moved(self):
+        # 2 parents, 1 different fileid, our second moved -> 2 parent
+        # (and that parent honours the changing revid of the other location)
+        self.do_test_fetch_to_rich_root_sets_parents_correctly(
+            (('my-root', 'right'),),
+            # 'my-root' at 'child'.
+            [('origin', None, [('add', ('', ROOT_ID, 'directory', '')),
+                             ('add', ('child', 'my-root', 'directory', ''))]),
+             ('base', None, []),
+            # 'my-root' at root
+             ('right', None, [('unversion', 'my-root'),
+                              ('unversion', ROOT_ID),
+                              ('add', ('', 'my-root', 'directory', ''))]),
+             ('tip', ['base', 'right'], [('unversion', 'my-root'),
+                            ('unversion', ROOT_ID),
+                            ('add', ('', 'my-root', 'directory', '')),
+                            ]),
+            ], root_id='my-root')
+
     def test_fetch_all_from_self(self):
         tree = self.make_branch_and_tree('.')
         rev_id = tree.commit('one')

=== modified file 'bzrlib/tests/test_branchbuilder.py'
--- a/bzrlib/tests/test_branchbuilder.py	2009-03-23 14:59:43 +0000
+++ b/bzrlib/tests/test_branchbuilder.py	2009-05-05 03:13:58 +0000
@@ -326,3 +326,18 @@
             builder.finish_series()
         self.assertIs(None, builder._tree)
         self.assertFalse(builder._branch.is_locked())
+
+    def test_ghost_mainline_history(self):
+        builder = BranchBuilder(self.get_transport().clone('foo'))
+        builder.start_series()
+        try:
+            builder.build_snapshot('tip', ['ghost'],
+                [('add', ('', 'ROOT_ID', 'directory', ''))],
+                allow_leftmost_as_ghost=True)
+        finally:
+            builder.finish_series()
+        b = builder.get_branch()
+        b.lock_read()
+        self.addCleanup(b.unlock)
+        self.assertEqual(('ghost',),
+            b.repository.get_graph().get_parent_map(['tip'])['tip'])

=== modified file 'bzrlib/tests/test_eol_filters.py'
--- a/bzrlib/tests/test_eol_filters.py	2009-04-02 04:12:11 +0000
+++ b/bzrlib/tests/test_eol_filters.py	2009-05-06 05:31:47 +0000
@@ -17,6 +17,11 @@
 """Tests for eol conversion."""
 
 
+from bzrlib import (
+    errors,
+    rules,
+    )
+from bzrlib.filters import _get_filter_stack_for
 from bzrlib.filters.eol import (
     _to_crlf_converter,
     _to_lf_converter,
@@ -37,3 +42,27 @@
     def test_to_crlf(self):
         result = _to_crlf_converter([_sample_file1])
         self.assertEqual(["hello\r\nworld\r\n"], result)
+
+
+class TestEolRulesSpecifications(TestCase):
+
+    def test_exact_value(self):
+        """'eol = exact' should have no content filters"""
+        prefs = (('eol','exact'),)
+        self.assertEqual([], _get_filter_stack_for(prefs))
+
+    def test_other_known_values(self):
+        """These known eol values have corresponding filters."""
+        known_values = ('lf', 'crlf', 'native',
+            'native-with-crlf-in-repo', 'lf-with-crlf-in-repo',
+            'crlf-with-crlf-in-repo')
+        for value in known_values:
+            prefs = (('eol',value),)
+            self.assertNotEqual([], _get_filter_stack_for(prefs))
+
+    def test_unknown_value(self):
+        """
+        Unknown eol values should raise an error.
+        """
+        prefs = (('eol','unknown-value'),)
+        self.assertRaises(errors.BzrError, _get_filter_stack_for,  prefs)

=== modified file 'bzrlib/tests/test_fetch.py'
--- a/bzrlib/tests/test_fetch.py	2009-05-01 07:59:02 +0000
+++ b/bzrlib/tests/test_fetch.py	2009-05-06 02:22:53 +0000
@@ -578,8 +578,7 @@
         self.repo.fetch(self.tree.branch.repository, 'second-id')
         root_id = self.tree.get_root_id()
         self.assertEqual(
-            ((root_id, 'left-parent'), (root_id, 'ghost-parent'),
-             (root_id, 'not-ghost-parent')),
+            ((root_id, 'left-parent'), (root_id, 'not-ghost-parent')),
             self.get_parents(root_id, 'second-id'))
 
     def make_two_commits(self, change_root, fetch_twice):

=== modified file 'bzrlib/tree.py'
--- a/bzrlib/tree.py	2009-04-09 20:23:07 +0000
+++ b/bzrlib/tree.py	2009-05-02 21:26:05 +0000
@@ -657,7 +657,7 @@
             return None
 
     def iter_search_rules(self, path_names, pref_names=None,
-        _default_searcher=rules._per_user_searcher):
+        _default_searcher=None):
         """Find the preferences for filenames in a tree.
 
         :param path_names: an iterable of paths to find attributes for.
@@ -667,6 +667,8 @@
         :return: an iterator of tuple sequences, one per path-name.
           See _RulesSearcher.get_items for details on the tuple sequence.
         """
+        if _default_searcher is None:
+            _default_searcher = rules._per_user_searcher
         searcher = self._get_rules_searcher(_default_searcher)
         if searcher is not None:
             if pref_names is not None:

=== modified file 'bzrlib/workingtree.py'
--- a/bzrlib/workingtree.py	2009-04-17 12:52:36 +0000
+++ b/bzrlib/workingtree.py	2009-05-06 06:36:03 +0000
@@ -1561,7 +1561,7 @@
 
     @needs_write_lock
     def pull(self, source, overwrite=False, stop_revision=None,
-             change_reporter=None, possible_transports=None):
+             change_reporter=None, possible_transports=None, local=False):
         top_pb = bzrlib.ui.ui_factory.nested_progress_bar()
         source.lock_read()
         try:
@@ -1570,7 +1570,8 @@
             old_revision_info = self.branch.last_revision_info()
             basis_tree = self.basis_tree()
             count = self.branch.pull(source, overwrite, stop_revision,
-                                     possible_transports=possible_transports)
+                                     possible_transports=possible_transports,
+                                     local=local)
             new_revision_info = self.branch.last_revision_info()
             if new_revision_info != old_revision_info:
                 pp.next_phase()




More information about the bazaar-commits mailing list