Rev 5054: (mbp) prepare 2.2b2 in file:///home/pqm/archives/thelove/bzr/2.2/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Fri Apr 16 13:21:51 BST 2010


At file:///home/pqm/archives/thelove/bzr/2.2/

------------------------------------------------------------
revno: 5054 [merge]
revision-id: pqm at pqm.ubuntu.com-20100416122147-xbcy3av3fd34hpho
parent: pqm at pqm.ubuntu.com-20100415164645-foqjrnwr68mv4miw
parent: mbp at sourcefrog.net-20100416080350-2p4swqousekhof7x
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: 2.2
timestamp: Fri 2010-04-16 13:21:47 +0100
message:
  (mbp) prepare 2.2b2
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/__init__.py             __init__.py-20050309040759-33e65acf91bbcd5d
  bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
  bzrlib/diff.py                 diff.py-20050309040759-26944fbbf2ebbf36
  bzrlib/export/tar_exporter.py  tar_exporter.py-20051114235828-1f6349a2f090a5d0
  bzrlib/log.py                  log.py-20050505065812-c40ce11702fe5fb1
  bzrlib/mutabletree.py          mutabletree.py-20060906023413-4wlkalbdpsxi2r4y-2
  bzrlib/osutils.py              osutils.py-20050309040759-eeaff12fbf77ac86
  bzrlib/tests/blackbox/test_export.py test_export.py-20051229024010-e6c26658e460fb1c
  bzrlib/tests/blackbox/test_info.py test_info.py-20060215045507-bbdd2d34efab9e0a
  bzrlib/tests/blackbox/test_push.py test_push.py-20060329002750-929af230d5d22663
  bzrlib/tests/blackbox/test_update.py test_update.py-20060212125639-c4dad1a5c56d5919
  bzrlib/tests/test_diff.py      testdiff.py-20050727164403-d1a3496ebb12e339
=== modified file 'NEWS'
--- a/NEWS	2010-04-15 14:50:17 +0000
+++ b/NEWS	2010-04-16 08:03:50 +0000
@@ -8,10 +8,13 @@
 bzr 2.2b2
 #########
 
-:2.2b2: NOT RELEASED YET
-
-Compatibility Breaks
-********************
+:2.2b2: 2010-04-16
+
+This is a somewhat early second beta of the 2.2 series, to fix a python2.4
+incompatibility in the 2.2b1 release.  It also includes a swag of
+performance, usability and correctness improvements: test feedback on all
+of these would be welcome.
+
 
 New Features
 ************
@@ -28,9 +31,24 @@
   True explicitly to get the previous behaviour.  
   (Vincent Ladeuil, #519319)
 
+* ``bzr export`` to tar file does not fail if any parent directory
+  contains unicode characters. This works around upstream Python bug
+  http://bugs.python.org/issue8396 .
+  (Parth Malwankar, #413406)
+
+* ``bzr update`` when a pending merge in the working tree has been merged
+  into the master branch will no longer claim that old commits have become
+  pending merges. (Robert Collins, #562079)
+
 * ``bzrlib.mutabletree.MutableTree.commit`` will now support a passed in
   config as in previous versions of bzrlib. (Robert Collins)
 
+* Fix glitch in the warning about unclean trees display.
+  (Vincent Ladeuil, #562665)
+
+* Fixed Python2.4 incompatibilities in the bzr2.2b1 source tarball.
+  (Martin Pool)
+
 * Help messages generated by ``RegistryOption.from_kwargs`` list the
   switches in alphabetical order, rather than in an undefined order.
   (Martin von Gagern, #559409)
@@ -40,6 +58,12 @@
   which is not installed any more" error.
   (Martin Pool, James Westby, #528114)
 
+* Reset ``siginterrupt`` flag to False every time we handle a signal
+  installed with ``set_signal_handler(..., restart_syscall=True)`` (from
+  ``bzrlib.osutils``.  Reduces the likelihood of "Interrupted System Call"
+  errors after two window resizes.
+  (Andrew Bennetts)
+
 * When invoked with a range revision, ``bzr log`` doesn't show revisions
   that are not part of the ancestry anymore.
   (Vincent Ladeuil, #474807)
@@ -51,6 +75,10 @@
   generated by a template and not edited by the user.
   (Robert Collins, #530265)
 
+* ``bzr diff`` read-locks the trees and branches only once, saving about
+  10-20ms on ``bzr diff`` in a bzr.dev tree.
+  (Andrew Bennetts)
+
 * ``bzr missing`` read-locks the branches only once.
   (Andrew Bennetts)
   
@@ -71,12 +99,13 @@
   less.)
   (Martin Pool, #553017)
 
-Documentation
-*************
-
 API Changes
 ***********
 
+* ``bzrlib.diff.get_trees_and_branches_to_diff`` is deprecated.  Use
+  ``get_trees_and_branches_to_diff_locked`` instead.
+  (Andrew Bennetts)
+  
 Internals
 *********
 
@@ -86,14 +115,11 @@
   Command is now transient and only exists for the duration of ``run()``.
   (Robert Collins)
 
-Testing
-*******
-
 
 bzr 2.2.0b1
 ###########
 
-:2.2.0b1: Not released yet
+:2.2.0b1: 2010-04-01
 
 Compatibility Breaks
 ********************

=== modified file 'bzrlib/__init__.py'
--- a/bzrlib/__init__.py	2010-04-15 14:50:17 +0000
+++ b/bzrlib/__init__.py	2010-04-16 08:03:50 +0000
@@ -44,7 +44,7 @@
 # Python version 2.0 is (2, 0, 0, 'final', 0)."  Additionally we use a
 # releaselevel of 'dev' for unreleased under-development code.
 
-version_info = (2, 2, 0, 'dev', 1)
+version_info = (2, 2, 0, 'beta', 2)
 
 # API compatibility version
 api_minimum_version = (2, 2, 0)
@@ -68,7 +68,7 @@
     >>> print _format_version_tuple((1, 1, 1, 'candidate', 2))
     1.1.1rc2
     >>> print bzrlib._format_version_tuple((2, 1, 0, 'beta', 1))
-    2.1.0b1
+    2.1b1
     >>> print _format_version_tuple((1, 4, 0))
     1.4.0
     >>> print _format_version_tuple((1, 4))
@@ -100,6 +100,8 @@
     elif release_type == 'dev':
         sub_string = 'dev' + str(sub)
     elif release_type in ('alpha', 'beta'):
+        if version_info[2] == 0:
+            main_version = '%d.%d' % version_info[:2]
         sub_string = release_type[0] + str(sub)
     elif release_type == 'candidate':
         sub_string = 'rc' + str(sub)

=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2010-04-15 14:50:17 +0000
+++ b/bzrlib/builtins.py	2010-04-16 07:56:51 +0000
@@ -1462,7 +1462,8 @@
             _mod_revision.ensure_null(tree.last_revision()))
         note('Updated to revision %s of branch %s' %
              ('.'.join(map(str, revno)), branch_location))
-        if tree.get_parent_ids()[1:] != existing_pending_merges:
+        parent_ids = tree.get_parent_ids()
+        if parent_ids[1:] and parent_ids[1:] != existing_pending_merges:
             note('Your local commits will now show as pending merges with '
                  "'bzr status', and can be committed with 'bzr commit'.")
         if conflicts != 0:
@@ -1955,7 +1956,7 @@
     @display_command
     def run(self, revision=None, file_list=None, diff_options=None,
             prefix=None, old=None, new=None, using=None, format=None):
-        from bzrlib.diff import (get_trees_and_branches_to_diff,
+        from bzrlib.diff import (get_trees_and_branches_to_diff_locked,
             show_diff_trees)
 
         if (prefix is None) or (prefix == '0'):
@@ -1982,8 +1983,8 @@
 
         (old_tree, new_tree,
          old_branch, new_branch,
-         specific_files, extra_trees) = get_trees_and_branches_to_diff(
-            file_list, revision, old, new, apply_view=True)
+         specific_files, extra_trees) = get_trees_and_branches_to_diff_locked(
+            file_list, revision, old, new, self.add_cleanup, apply_view=True)
         return show_diff_trees(old_tree, new_tree, sys.stdout,
                                specific_files=specific_files,
                                external_diff_options=diff_options,

=== modified file 'bzrlib/diff.py'
--- a/bzrlib/diff.py	2010-04-05 21:56:39 +0000
+++ b/bzrlib/diff.py	2010-04-13 13:24:12 +0000
@@ -32,6 +32,7 @@
     branch as _mod_branch,
     bzrdir,
     cmdline,
+    cleanup,
     errors,
     osutils,
     patiencediff,
@@ -48,6 +49,7 @@
     )
 from bzrlib.symbol_versioning import (
     deprecated_function,
+    deprecated_in,
     )
 from bzrlib.trace import mutter, note, warning
 
@@ -289,6 +291,7 @@
                         new_abspath, e)
 
 
+ at deprecated_function(deprecated_in((2, 2, 0)))
 def get_trees_and_branches_to_diff(path_list, revision_specs, old_url, new_url,
                                    apply_view=True):
     """Get the trees and specific files to diff given a list of paths.
@@ -313,7 +316,44 @@
     :returns:
         a tuple of (old_tree, new_tree, old_branch, new_branch,
         specific_files, extra_trees) where extra_trees is a sequence of
-        additional trees to search in for file-ids.
+        additional trees to search in for file-ids.  The trees and branches
+        are not locked.
+    """
+    op = cleanup.OperationWithCleanups(get_trees_and_branches_to_diff_locked)
+    return op.run_simple(path_list, revision_specs, old_url, new_url,
+            op.add_cleanup, apply_view=apply_view)
+    
+
+def get_trees_and_branches_to_diff_locked(
+    path_list, revision_specs, old_url, new_url, add_cleanup, apply_view=True):
+    """Get the trees and specific files to diff given a list of paths.
+
+    This method works out the trees to be diff'ed and the files of
+    interest within those trees.
+
+    :param path_list:
+        the list of arguments passed to the diff command
+    :param revision_specs:
+        Zero, one or two RevisionSpecs from the diff command line,
+        saying what revisions to compare.
+    :param old_url:
+        The url of the old branch or tree. If None, the tree to use is
+        taken from the first path, if any, or the current working tree.
+    :param new_url:
+        The url of the new branch or tree. If None, the tree to use is
+        taken from the first path, if any, or the current working tree.
+    :param add_cleanup:
+        a callable like Command.add_cleanup.  get_trees_and_branches_to_diff
+        will register cleanups that must be run to unlock the trees, etc.
+    :param apply_view:
+        if True and a view is set, apply the view or check that the paths
+        are within it
+    :returns:
+        a tuple of (old_tree, new_tree, old_branch, new_branch,
+        specific_files, extra_trees) where extra_trees is a sequence of
+        additional trees to search in for file-ids.  The trees and branches
+        will be read-locked until the cleanups registered via the add_cleanup
+        param are run.
     """
     # Get the old and new revision specs
     old_revision_spec = None
@@ -342,12 +382,21 @@
         default_location = path_list[0]
         other_paths = path_list[1:]
 
+    def lock_tree_or_branch(wt, br):
+        if wt is not None:
+            wt.lock_read()
+            add_cleanup(wt.unlock)
+        elif br is not None:
+            br.lock_read()
+            add_cleanup(br.unlock)
+
     # Get the old location
     specific_files = []
     if old_url is None:
         old_url = default_location
     working_tree, branch, relpath = \
         bzrdir.BzrDir.open_containing_tree_or_branch(old_url)
+    lock_tree_or_branch(working_tree, branch)
     if consider_relpath and relpath != '':
         if working_tree is not None and apply_view:
             views.check_path_in_view(working_tree, relpath)
@@ -361,6 +410,7 @@
     if new_url != old_url:
         working_tree, branch, relpath = \
             bzrdir.BzrDir.open_containing_tree_or_branch(new_url)
+        lock_tree_or_branch(working_tree, branch)
         if consider_relpath and relpath != '':
             if working_tree is not None and apply_view:
                 views.check_path_in_view(working_tree, relpath)

=== modified file 'bzrlib/export/tar_exporter.py'
--- a/bzrlib/export/tar_exporter.py	2010-03-25 09:39:03 +0000
+++ b/bzrlib/export/tar_exporter.py	2010-04-14 10:12:22 +0000
@@ -48,7 +48,14 @@
     else:
         if root is None:
             root = export.get_root_name(dest)
-        ball = tarfile.open(dest, 'w:' + compression)
+
+        # tarfile.open goes on to do 'os.getcwd() + dest' for opening
+        # the tar file. With dest being unicode, this throws UnicodeDecodeError
+        # unless we encode dest before passing it on. This works around
+        # upstream python bug http://bugs.python.org/issue8396
+        # (fixed in Python 2.6.5 and 2.7b1)
+        ball = tarfile.open(dest.encode(osutils._fs_enc), 'w:' + compression)
+
     for dp, ie in _export_iter_entries(tree, subdir):
         filename = osutils.pathjoin(root, dp).encode('utf8')
         item = tarfile.TarInfo(filename)

=== modified file 'bzrlib/log.py'
--- a/bzrlib/log.py	2010-04-01 00:40:31 +0000
+++ b/bzrlib/log.py	2010-04-14 10:38:57 +0000
@@ -455,8 +455,10 @@
         generate_merge_revisions = rqst.get('levels') != 1
         delayed_graph_generation = not rqst.get('specific_fileids') and (
                 rqst.get('limit') or self.start_rev_id or self.end_rev_id)
-        view_revisions = _calc_view_revisions(self.branch, self.start_rev_id,
-            self.end_rev_id, rqst.get('direction'), generate_merge_revisions,
+        view_revisions = _calc_view_revisions(
+            self.branch, self.start_rev_id, self.end_rev_id,
+            rqst.get('direction'),
+            generate_merge_revisions=generate_merge_revisions,
             delayed_graph_generation=delayed_graph_generation)
 
         # Apply the other filters
@@ -470,8 +472,9 @@
         # Note that we always generate the merge revisions because
         # filter_revisions_touching_file_id() requires them ...
         rqst = self.rqst
-        view_revisions = _calc_view_revisions(self.branch, self.start_rev_id,
-            self.end_rev_id, rqst.get('direction'), True)
+        view_revisions = _calc_view_revisions(
+            self.branch, self.start_rev_id, self.end_rev_id,
+            rqst.get('direction'), generate_merge_revisions=True)
         if not isinstance(view_revisions, list):
             view_revisions = list(view_revisions)
         view_revisions = _filter_revisions_touching_file_id(self.branch,
@@ -488,23 +491,30 @@
     :return: An iterator of (revision_id, dotted_revno, merge_depth) tuples OR
              a list of the same tuples.
     """
+    if direction not in ('reverse', 'forward'):
+        raise ValueError('invalid direction %r' % direction)
     br_revno, br_rev_id = branch.last_revision_info()
     if br_revno == 0:
         return []
 
-    # If a single revision is requested, check we can handle it
-    generate_single_revision = (end_rev_id and start_rev_id == end_rev_id and
-        (not generate_merge_revisions or not _has_merges(branch, end_rev_id)))
-    if generate_single_revision:
-        return _generate_one_revision(branch, end_rev_id, br_rev_id, br_revno)
-
-    # If we only want to see linear revisions, we can iterate ...
-    if not generate_merge_revisions:
-        return _generate_flat_revisions(branch, start_rev_id, end_rev_id,
-            direction)
+    if (end_rev_id and start_rev_id == end_rev_id
+        and (not generate_merge_revisions
+             or not _has_merges(branch, end_rev_id))):
+        # If a single revision is requested, check we can handle it
+        iter_revs = _generate_one_revision(branch, end_rev_id, br_rev_id,
+                                           br_revno)
+    elif not generate_merge_revisions:
+        # If we only want to see linear revisions, we can iterate ...
+        iter_revs = _generate_flat_revisions(branch, start_rev_id, end_rev_id,
+                                             direction)
+        if direction == 'forward':
+            iter_revs = reversed(iter_revs)
     else:
-        return _generate_all_revisions(branch, start_rev_id, end_rev_id,
-            direction, delayed_graph_generation)
+        iter_revs = _generate_all_revisions(branch, start_rev_id, end_rev_id,
+                                            direction, delayed_graph_generation)
+        if direction == 'forward':
+            iter_revs = _rebase_merge_depth(reverse_by_depth(list(iter_revs)))
+    return iter_revs
 
 
 def _generate_one_revision(branch, rev_id, br_rev_id, br_revno):
@@ -528,8 +538,6 @@
         except _StartNotLinearAncestor:
             raise errors.BzrCommandError('Start revision not found in'
                 ' left-hand history of end revision.')
-    if direction == 'forward':
-        result = reversed(result)
     return result
 
 
@@ -569,12 +577,7 @@
                     initial_revisions.append((rev_id, revno, depth))
             else:
                 # No merged revisions found
-                if direction == 'reverse':
-                    return initial_revisions
-                elif direction == 'forward':
-                    return reversed(initial_revisions)
-                else:
-                    raise ValueError('invalid direction %r' % direction)
+                return initial_revisions
         except _StartNotLinearAncestor:
             # A merge was never detected so the lower revision limit can't
             # be nested down somewhere
@@ -592,14 +595,7 @@
     view_revisions = chain(iter(initial_revisions),
         _graph_view_revisions(branch, start_rev_id, end_rev_id,
                               rebase_initial_depths=(direction == 'reverse')))
-    if direction == 'reverse':
-        return view_revisions
-    elif direction == 'forward':
-        # Forward means oldest first, adjusting for depth.
-        view_revisions = reverse_by_depth(list(view_revisions))
-        return _rebase_merge_depth(view_revisions)
-    else:
-        raise ValueError('invalid direction %r' % direction)
+    return view_revisions
 
 
 def _has_merges(branch, rev_id):

=== modified file 'bzrlib/mutabletree.py'
--- a/bzrlib/mutabletree.py	2010-04-12 16:54:35 +0000
+++ b/bzrlib/mutabletree.py	2010-04-15 06:47:06 +0000
@@ -286,7 +286,7 @@
                 if strict is None:
                     # We don't want to interrupt the user if he expressed no
                     # preference about strict.
-                    trace.warning('%s', (err._format(),))
+                    trace.warning('%s', err._format())
                 else:
                     raise err
 

=== modified file 'bzrlib/osutils.py'
--- a/bzrlib/osutils.py	2010-03-26 04:47:45 +0000
+++ b/bzrlib/osutils.py	2010-04-14 06:47:18 +0000
@@ -1365,15 +1365,25 @@
         False)`).  May be ignored if the feature is not available on this
         platform or Python version.
     """
-    old_handler = signal.signal(signum, handler)
+    try:
+        siginterrupt = signal.siginterrupt
+    except AttributeError:
+        # siginterrupt doesn't exist on this platform, or for this version
+        # of Python.
+        siginterrupt = lambda signum, flag: None
     if restart_syscall:
-        try:
-            siginterrupt = signal.siginterrupt
-        except AttributeError: # siginterrupt doesn't exist on this platform, or for this version of
-            # Python.
-            pass
-        else:
+        def sig_handler(*args):
+            # Python resets the siginterrupt flag when a signal is
+            # received.  <http://bugs.python.org/issue8354>
+            # As a workaround for some cases, set it back the way we want it.
             siginterrupt(signum, False)
+            # Now run the handler function passed to set_signal_handler.
+            handler(*args)
+    else:
+        sig_handler = handler
+    old_handler = signal.signal(signum, sig_handler)
+    if restart_syscall:
+        siginterrupt(signum, False)
     return old_handler
 
 

=== modified file 'bzrlib/tests/blackbox/test_export.py'
--- a/bzrlib/tests/blackbox/test_export.py	2010-03-08 02:23:17 +0000
+++ b/bzrlib/tests/blackbox/test_export.py	2010-04-14 08:09:45 +0000
@@ -85,6 +85,15 @@
         self.assertEqual(['test/' + fname.encode('utf8')],
                          sorted(ball.getnames()))
 
+    def test_tar_export_unicode_basedir(self):
+        """Test for bug #413406"""
+        basedir = u'\N{euro sign}'
+        os.mkdir(basedir)
+        os.chdir(basedir)
+        self.run_bzr(['init', 'branch'])
+        os.chdir('branch')
+        self.run_bzr(['export', '--format', 'tgz', u'test.tar.gz'])
+
     def test_zip_export(self):
         tree = self.make_branch_and_tree('zip')
         self.build_tree(['zip/a'])

=== modified file 'bzrlib/tests/blackbox/test_info.py'
--- a/bzrlib/tests/blackbox/test_info.py	2010-03-02 22:25:58 +0000
+++ b/bzrlib/tests/blackbox/test_info.py	2010-04-14 09:57:01 +0000
@@ -1325,7 +1325,7 @@
 
     def test_info_locking_oslocks(self):
         if sys.platform == "win32":
-            raise TestSkipped("don't use oslocks on win32 in unix manner")
+            self.skip("don't use oslocks on win32 in unix manner")
         # This test tests old (all-in-one, OS lock using) behaviour which
         # simply cannot work on windows (and is indeed why we changed our
         # design. As such, don't try to remove the thisFailsStrictLockCheck

=== modified file 'bzrlib/tests/blackbox/test_push.py'
--- a/bzrlib/tests/blackbox/test_push.py	2010-04-12 16:41:03 +0000
+++ b/bzrlib/tests/blackbox/test_push.py	2010-04-15 06:47:06 +0000
@@ -673,8 +673,9 @@
             error_regexes = self._default_errors
         else:
             error_regexes = []
-        self.run_bzr(self._default_command + args,
-                     working_dir=self._default_wd, error_regexes=error_regexes)
+        ret = self.run_bzr(self._default_command + args,
+                           working_dir=self._default_wd,
+                           error_regexes=error_regexes)
         if pushed_revid is None:
             pushed_revid = self._default_pushed_revid
         tree_to = workingtree.WorkingTree.open('to')

=== modified file 'bzrlib/tests/blackbox/test_update.py'
--- a/bzrlib/tests/blackbox/test_update.py	2010-03-31 18:11:51 +0000
+++ b/bzrlib/tests/blackbox/test_update.py	2010-04-14 04:48:00 +0000
@@ -241,6 +241,47 @@
         tree.commit('empty commit')
         self.run_bzr('update checkout')
 
+    def test_update_with_merge_merged_to_master(self):
+        # Test that 'bzr update' works correctly when you have
+        # an update in the master tree, and a [lightweight or otherwise]
+        # checkout which has merge a revision merged to master already.
+        master = self.make_branch_and_tree('master')
+        self.build_tree(['master/file'])
+        master.add(['file'])
+        master.commit('one', rev_id='m1')
+
+        self.build_tree(['checkout1/'])
+        checkout_dir = bzrdir.BzrDirMetaFormat1().initialize('checkout1')
+        branch.BranchReferenceFormat().initialize(checkout_dir,
+            target_branch=master.branch)
+        checkout1 = checkout_dir.create_workingtree('m1')
+
+        # Create a second branch, with an extra commit
+        other = master.bzrdir.sprout('other').open_workingtree()
+        self.build_tree(['other/file2'])
+        other.add(['file2'])
+        other.commit('other2', rev_id='o2')
+
+        # Merge the other branch into checkout -  'start reviewing a patch'
+        checkout1.merge_from_branch(other.branch)
+        self.assertEqual(['o2'], checkout1.get_parent_ids()[1:])
+
+        # Create a new commit in the master branch - 'someone else lands its'
+        master.merge_from_branch(other.branch)
+        master.commit('f3', rev_id='m2')
+
+        # This should not report about local commits being pending
+        # merges, because they were real merges (but are now gone).
+        # It should perhaps report on them.
+        out, err = self.run_bzr('update', working_dir='checkout1')
+        self.assertEqual('', out)
+        self.assertEqualDiff('''All changes applied successfully.
+Updated to revision 2 of branch %s
+''' % osutils.pathjoin(self.test_dir, 'master',),
+                         err)
+        # The pending merges should still be there
+        self.assertEqual([], checkout1.get_parent_ids()[1:])
+
     def test_update_dash_r(self):
         master = self.make_branch_and_tree('master')
         os.chdir('master')

=== modified file 'bzrlib/tests/test_diff.py'
--- a/bzrlib/tests/test_diff.py	2010-02-23 07:43:11 +0000
+++ b/bzrlib/tests/test_diff.py	2010-04-14 03:18:37 +0000
@@ -17,7 +17,6 @@
 import os
 import os.path
 from cStringIO import StringIO
-import errno
 import subprocess
 import sys
 from tempfile import TemporaryFile
@@ -33,6 +32,7 @@
     internal_diff,
     show_diff_trees,
     get_trees_and_branches_to_diff,
+    get_trees_and_branches_to_diff_locked,
     )
 from bzrlib.errors import BinaryFile, NoDiff, ExecutableMissing
 import bzrlib.osutils as osutils
@@ -44,6 +44,7 @@
                           TestCaseInTempDir, TestSkipped)
 from bzrlib.revisiontree import RevisionTree
 from bzrlib.revisionspec import RevisionSpec
+from bzrlib.symbol_versioning import deprecated_in
 
 from bzrlib.tests.test_win32utils import BackslashDirSeparatorFeature
 
@@ -1394,17 +1395,23 @@
         diff_obj._prepare_files('file2-id', 'oldname2', 'newname2')
 
 
-class TestGetTreesAndBranchesToDiff(TestCaseWithTransport):
+class TestGetTreesAndBranchesToDiffLocked(TestCaseWithTransport):
+
+    def call_gtabtd(self, path_list, revision_specs, old_url, new_url):
+        """Call get_trees_and_branches_to_diff_locked.  Overridden by
+        TestGetTreesAndBranchesToDiff.
+        """
+        return get_trees_and_branches_to_diff_locked(
+            path_list, revision_specs, old_url, new_url, self.addCleanup)
 
     def test_basic(self):
         tree = self.make_branch_and_tree('tree')
         (old_tree, new_tree,
          old_branch, new_branch,
-         specific_files, extra_trees) = \
-            get_trees_and_branches_to_diff(['tree'], None, None, None)
+         specific_files, extra_trees) = self.call_gtabtd(
+             ['tree'], None, None, None)
 
         self.assertIsInstance(old_tree, RevisionTree)
-        #print dir (old_tree)
         self.assertEqual(_mod_revision.NULL_REVISION, old_tree.get_revision_id())
         self.assertEqual(tree.basedir, new_tree.basedir)
         self.assertEqual(tree.branch.base, old_branch.base)
@@ -1424,8 +1431,8 @@
                      RevisionSpec.from_string('2')]
         (old_tree, new_tree,
          old_branch, new_branch,
-         specific_files, extra_trees) = \
-            get_trees_and_branches_to_diff(['tree'], revisions, None, None)
+         specific_files, extra_trees) = self.call_gtabtd(
+            ['tree'], revisions, None, None)
 
         self.assertIsInstance(old_tree, RevisionTree)
         self.assertEqual("old-id", old_tree.get_revision_id())
@@ -1435,3 +1442,15 @@
         self.assertEqual(tree.branch.base, new_branch.base)
         self.assertIs(None, specific_files)
         self.assertEqual(tree.basedir, extra_trees[0].basedir)
+
+
+class TestGetTreesAndBranchesToDiff(TestGetTreesAndBranchesToDiffLocked):
+    """Apply the tests for get_trees_and_branches_to_diff_locked to the
+    deprecated get_trees_and_branches_to_diff function.
+    """
+
+    def call_gtabtd(self, path_list, revision_specs, old_url, new_url):
+        return self.applyDeprecated(
+            deprecated_in((2, 2, 0)), get_trees_and_branches_to_diff,
+            path_list, revision_specs, old_url, new_url)
+




More information about the bazaar-commits mailing list