Rev 6129: (jam) Merge 2.4 into trunk, including bugs #825027 and #837293 in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Tue Sep 6 11:01:37 UTC 2011


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

------------------------------------------------------------
revno: 6129 [merge]
revision-id: pqm at pqm.ubuntu.com-20110906110130-8e1m8kc6h1hlt6t5
parent: pqm at pqm.ubuntu.com-20110906101154-46kb97u5tdj9enyi
parent: pqm at pqm.ubuntu.com-20110905094127-hbp8bhniml5epsvd
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2011-09-06 11:01:30 +0000
message:
  (jam) Merge 2.4 into trunk, including bugs #825027 and #837293
modified:
  bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
  bzrlib/remote.py               remote.py-20060720103555-yeeg2x51vn0rbtdp-1
  bzrlib/smart/repository.py     repository.py-20061128022038-vr5wy5bubyb8xttk-1
  bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
  bzrlib/tests/per_repository_reference/__init__.py __init__.py-20080220025549-nnm2s80it1lvcwnc-2
  bzrlib/vf_repository.py        vf_repository.py-20110502151858-yh9nnoxpokg86unk-1
  doc/en/release-notes/bzr-2.3.txt NEWS-20050323055033-4e00b5db738777ff
  doc/en/release-notes/bzr-2.4.txt bzr2.4.txt-20110114053217-k7ym9jfz243fddjm-1
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2011-09-05 14:51:25 +0000
+++ b/bzrlib/builtins.py	2011-09-06 11:01:30 +0000
@@ -3802,6 +3802,9 @@
                                 param_name='starting_with', short_name='s',
                                 help=
                                 'Load only the tests starting with TESTID.'),
+                     Option('sync',
+                            help="By default we disable fsync and fdatasync"
+                                 " while running the test suite.")
                      ]
     encoding_type = 'replace'
 
@@ -3815,7 +3818,8 @@
             first=False, list_only=False,
             randomize=None, exclude=None, strict=False,
             load_list=None, debugflag=None, starting_with=None, subunit=False,
-            parallel=None, lsprof_tests=False):
+            parallel=None, lsprof_tests=False,
+            sync=False):
         from bzrlib import tests
 
         if testspecs_list is not None:
@@ -3850,6 +3854,8 @@
             exclude_pattern = None
         else:
             exclude_pattern = '(' + '|'.join(exclude) + ')'
+        if not sync:
+            self._disable_fsync()
         selftest_kwargs = {"verbose": verbose,
                           "pattern": pattern,
                           "stop_on_failure": one,
@@ -3877,6 +3883,15 @@
             cleanup()
         return int(not result)
 
+    def _disable_fsync(self):
+        """Change the 'os' functionality to not synchronize."""
+        self._orig_fsync = getattr(os, 'fsync', None)
+        if self._orig_fsync is not None:
+            os.fsync = lambda filedes: None
+        self._orig_fdatasync = getattr(os, 'fdatasync', None)
+        if self._orig_fdatasync is not None:
+            os.fdatasync = lambda filedes: None
+
 
 class cmd_version(Command):
     __doc__ = """Show version of bzr."""

=== modified file 'bzrlib/remote.py'
--- a/bzrlib/remote.py	2011-08-26 11:35:50 +0000
+++ b/bzrlib/remote.py	2011-09-06 11:01:30 +0000
@@ -1509,12 +1509,13 @@
         # We need to accumulate additional repositories here, to pass them in
         # on various RPC's.
         #
+        # Make the check before we lock: this raises an exception.
+        self._check_fallback_repository(repository)
         if self.is_locked():
             # We will call fallback.unlock() when we transition to the unlocked
             # state, so always add a lock here. If a caller passes us a locked
             # repository, they are responsible for unlocking it later.
             repository.lock_read()
-        self._check_fallback_repository(repository)
         self._fallback_repositories.append(repository)
         # If self._real_repository was parameterised already (e.g. because a
         # _real_branch had its get_stacked_on_url method called), then the

=== modified file 'bzrlib/smart/repository.py'
--- a/bzrlib/smart/repository.py	2010-11-26 06:31:54 +0000
+++ b/bzrlib/smart/repository.py	2011-09-02 23:13:18 +0000
@@ -238,7 +238,7 @@
                 next_revs = set()
                 break
             # don't query things we've already queried
-            next_revs.difference_update(queried_revs)
+            next_revs = next_revs.difference(queried_revs)
             first_loop_done = True
 
         # sorting trivially puts lexographically similar revision ids together.

=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py	2011-08-20 22:42:34 +0000
+++ b/bzrlib/tests/__init__.py	2011-09-06 11:01:30 +0000
@@ -2561,7 +2561,16 @@
         real branch.
         """
         root = TestCaseWithMemoryTransport.TEST_ROOT
-        wt = bzrdir.BzrDir.create_standalone_workingtree(root)
+        try:
+            # Make sure we get a readable and accessible home for .bzr.log
+            # and/or config files, and not fallback to weird defaults (see
+            # http://pad.lv/825027).
+            self.assertIs(None, os.environ.get('BZR_HOME', None))
+            os.environ['BZR_HOME'] = root
+            wt = bzrdir.BzrDir.create_standalone_workingtree(root)
+            del os.environ['BZR_HOME']
+        except Exception, e:
+            self.fail("Fail to initialize the safety net: %r\nExiting\n" % (e,))
         # Hack for speed: remember the raw bytes of the dirstate file so that
         # we don't need to re-open the wt to check it hasn't changed.
         TestCaseWithMemoryTransport._SAFETY_NET_PRISTINE_DIRSTATE = (

=== modified file 'bzrlib/tests/per_repository_reference/__init__.py'
--- a/bzrlib/tests/per_repository_reference/__init__.py	2011-05-04 03:43:03 +0000
+++ b/bzrlib/tests/per_repository_reference/__init__.py	2011-08-30 10:54:28 +0000
@@ -66,18 +66,37 @@
 
 class TestIncompatibleStacking(TestCaseWithRepository):
 
-    def test_add_fallback_repository_rejects_incompatible(self):
-        # Repository.add_fallback_repository raises IncompatibleRepositories if
-        # you take two repositories in different serializations and try to
-        # stack them.
-        if self.make_repository('test')._format.supports_chks:
+    def make_repo_and_incompatible_fallback(self):
+        referring = self.make_repository('referring')
+        if referring._format.supports_chks:
             different_fmt = '1.9'
         else:
             different_fmt = '2a'
-        repo = self.make_repository('repo', format=different_fmt)
-        referring = self.make_repository('referring')
-        self.assertRaises(errors.IncompatibleRepositories,
-                referring.add_fallback_repository, repo)
+        fallback = self.make_repository('fallback', format=different_fmt)
+        return referring, fallback
+
+    def test_add_fallback_repository_rejects_incompatible(self):
+        # Repository.add_fallback_repository raises IncompatibleRepositories
+        # if you take two repositories in different serializations and try to
+        # stack them.
+        referring, fallback = self.make_repo_and_incompatible_fallback()
+        self.assertRaises(errors.IncompatibleRepositories,
+                referring.add_fallback_repository, fallback)
+
+    def test_add_fallback_doesnt_leave_fallback_locked(self):
+        # Bug #835035. If the referring repository is locked, it wants to lock
+        # the fallback repository. But if they are incompatible, the referring
+        # repository won't take ownership of the fallback, and thus should not
+        # leave the repository in a locked state.
+        referring, fallback = self.make_repo_and_incompatible_fallback()
+        self.addCleanup(referring.lock_read().unlock)
+        # Assert precondition.
+        self.assertFalse(fallback.is_locked())
+        # Assert action.
+        self.assertRaises(errors.IncompatibleRepositories,
+                referring.add_fallback_repository, fallback)
+        # Assert postcondition.
+        self.assertFalse(fallback.is_locked())
 
 
 def external_reference_test_scenarios():

=== modified file 'bzrlib/vf_repository.py'
--- a/bzrlib/vf_repository.py	2011-08-25 07:51:37 +0000
+++ b/bzrlib/vf_repository.py	2011-09-06 11:01:30 +0000
@@ -918,11 +918,13 @@
         """
         if not self._format.supports_external_lookups:
             raise errors.UnstackableRepositoryFormat(self._format, self.base)
+        # This can raise an exception, so should be done before we lock the
+        # fallback repository.
+        self._check_fallback_repository(repository)
         if self.is_locked():
             # This repository will call fallback.unlock() when we transition to
             # the unlocked state, so we make sure to increment the lock count
             repository.lock_read()
-        self._check_fallback_repository(repository)
         self._fallback_repositories.append(repository)
         self.texts.add_fallback_versioned_files(repository.texts)
         self.inventories.add_fallback_versioned_files(repository.inventories)

=== modified file 'doc/en/release-notes/bzr-2.3.txt'
--- a/doc/en/release-notes/bzr-2.3.txt	2011-08-20 18:29:34 +0000
+++ b/doc/en/release-notes/bzr-2.3.txt	2011-09-02 23:13:18 +0000
@@ -87,6 +87,11 @@
 .. Improvements to existing commands, especially improved performance 
    or memory usage, or better results.
 
+* Tweak an RPC implementation for ``Repository.get_parent_map``, it was
+  doing an inefficient ``small_set.difference_update(large_set)`` when we
+  can do ``small_set = small_set.difference(large_set)``. This speeds up
+  discovery time by about 10%. (John Arbash Meinel)
+
 Bug Fixes
 *********
 

=== modified file 'doc/en/release-notes/bzr-2.4.txt'
--- a/doc/en/release-notes/bzr-2.4.txt	2011-08-29 12:59:56 +0000
+++ b/doc/en/release-notes/bzr-2.4.txt	2011-09-06 11:01:30 +0000
@@ -38,6 +38,10 @@
 * ``dirstate.fdatasync`` and ``repository.fdatasync`` can now properly be
   disabled. (Vincent Ladeuil, #824513)
 
+* Disable ``os.fsync`` and ``os.fdatasync`` by default when running
+  ``bzr selftest``. You can use ``--sync`` to re-enable them.
+  (John Arbash Meinel, #837293)
+
 * Fix i18n use when no environment variables are set. (Jelmer Vernooij, #810701)
 
 * Avoid UnicodeDecode error when reporting EINVAL from transports.
@@ -70,6 +74,10 @@
    suite.  This can include new facilities for writing tests, fixes to 
    spurious test failures and changes to the way things should be tested.
 
+* The test suite should now be able to run under weird environments where
+  ``/etc/passwd`` doesn't contain the ``uid`` for the user running selftest
+  or where ``fakeroot`` is used but ``/root`` is inacessible.
+  (Vincent Ladeuil, #825027)
 
 bzr 2.4.0
 #########




More information about the bazaar-commits mailing list