Merge lp:~jameinel/bzr/integration into lp:bzr

Proposed by John A Meinel
Status: Merged
Approved by: John A Meinel
Approved revision: no longer in the source branch.
Merged at revision: 6575
Proposed branch: lp:~jameinel/bzr/integration
Merge into: lp:bzr
Diff against target: 308 lines (+142/-16)
8 files modified
bzrlib/dirstate.py (+10/-7)
bzrlib/osutils.py (+14/-1)
bzrlib/tests/__init__.py (+8/-2)
bzrlib/tests/test_osutils.py (+44/-0)
bzrlib/tests/test_selftest.py (+40/-4)
doc/en/release-notes/bzr-2.4.txt (+8/-0)
doc/en/release-notes/bzr-2.5.txt (+8/-0)
doc/en/release-notes/bzr-2.6.txt (+10/-2)
To merge this branch: bzr merge lp:~jameinel/bzr/integration
Reviewer Review Type Date Requested Status
Richard Wilbur Needs Fixing
Review via email: mp+165333@code.launchpad.net

Commit message

Merge bzr/2.5 into trunk.

Description of the change

Merge bzr/2.5 into trunk.

To post a comment you must log in.
Revision history for this message
John A Meinel (jameinel) wrote :

sent to pqm by email

Revision history for this message
Richard Wilbur (richard-wilbur) wrote :

I like the changes. It seems that, at least for trunk, we might consider moving the trace.mutter from
bzrlib/osutils.py:66

66 + trace.mutter("ignoring error calling fdatasync: %s" % (e,))
67 + if getattr(e, 'errno', None) not in _fdatasync_ignored:
68 + raise

into an 'else' of the test on line 67, since only in that case are we actually ignoring the error. Something like the following:

66 + if getattr(e, 'errno', None) not in _fdatasync_ignored:
67 + raise
68 + else:
69 + trace.mutter("ignoring error calling fdatasync: %s" % (e,))

review: Needs Fixing

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bzrlib/dirstate.py'
--- bzrlib/dirstate.py 2012-01-24 01:35:56 +0000
+++ bzrlib/dirstate.py 2013-05-23 10:07:40 +0000
@@ -2566,13 +2566,6 @@
2566 self.update_minimal(('', '', new_id), 'd',2566 self.update_minimal(('', '', new_id), 'd',
2567 path_utf8='', packed_stat=entry[1][0][4])2567 path_utf8='', packed_stat=entry[1][0][4])
2568 self._mark_modified()2568 self._mark_modified()
2569 # XXX: This was added by Ian, we need to make sure there
2570 # are tests for it, because it isn't in bzr.dev TRUNK
2571 # It looks like the only place it is called is in setting the root
2572 # id of the tree. So probably we never had an _id_index when we
2573 # don't even have a root yet.
2574 if self._id_index is not None:
2575 self._add_to_id_index(self._id_index, entry[0])
25762569
2577 def set_parent_trees(self, trees, ghosts):2570 def set_parent_trees(self, trees, ghosts):
2578 """Set the parent trees for the dirstate.2571 """Set the parent trees for the dirstate.
@@ -3285,10 +3278,20 @@
3285 if self._id_index is not None:3278 if self._id_index is not None:
3286 for file_id, entry_keys in self._id_index.iteritems():3279 for file_id, entry_keys in self._id_index.iteritems():
3287 for entry_key in entry_keys:3280 for entry_key in entry_keys:
3281 # Check that the entry in the map is pointing to the same
3282 # file_id
3288 if entry_key[2] != file_id:3283 if entry_key[2] != file_id:
3289 raise AssertionError(3284 raise AssertionError(
3290 'file_id %r did not match entry key %s'3285 'file_id %r did not match entry key %s'
3291 % (file_id, entry_key))3286 % (file_id, entry_key))
3287 # And that from this entry key, we can look up the original
3288 # record
3289 block_index, present = self._find_block_index_from_key(entry_key)
3290 if not present:
3291 raise AssertionError('missing block for entry key: %r', entry_key)
3292 entry_index, present = self._find_entry_index(entry_key, self._dirblocks[block_index][1])
3293 if not present:
3294 raise AssertionError('missing entry for key: %r', entry_key)
3292 if len(entry_keys) != len(set(entry_keys)):3295 if len(entry_keys) != len(set(entry_keys)):
3293 raise AssertionError(3296 raise AssertionError(
3294 'id_index contained non-unique data for %s'3297 'id_index contained non-unique data for %s'
32953298
=== modified file 'bzrlib/osutils.py'
--- bzrlib/osutils.py 2012-09-19 07:58:27 +0000
+++ bzrlib/osutils.py 2013-05-23 10:07:40 +0000
@@ -2554,6 +2554,10 @@
2554else:2554else:
2555 is_local_pid_dead = _posix_is_local_pid_dead2555 is_local_pid_dead = _posix_is_local_pid_dead
25562556
2557_maybe_ignored = ['EAGAIN', 'EINTR', 'ENOTSUP', 'EOPNOTSUPP', 'EACCES']
2558_fdatasync_ignored = [getattr(errno, name) for name in _maybe_ignored
2559 if getattr(errno, name, None) is not None]
2560
25572561
2558def fdatasync(fileno):2562def fdatasync(fileno):
2559 """Flush file contents to disk if possible.2563 """Flush file contents to disk if possible.
@@ -2563,7 +2567,16 @@
2563 """2567 """
2564 fn = getattr(os, 'fdatasync', getattr(os, 'fsync', None))2568 fn = getattr(os, 'fdatasync', getattr(os, 'fsync', None))
2565 if fn is not None:2569 if fn is not None:
2566 fn(fileno)2570 try:
2571 fn(fileno)
2572 except IOError, e:
2573 # See bug #1075108, on some platforms fdatasync exists, but can
2574 # raise ENOTSUP. However, we are calling fdatasync to be helpful
2575 # and reduce the chance of corruption-on-powerloss situations. It
2576 # is not a mandatory call, so it is ok to suppress failures.
2577 trace.mutter("ignoring error calling fdatasync: %s" % (e,))
2578 if getattr(e, 'errno', None) not in _fdatasync_ignored:
2579 raise
25672580
25682581
2569def ensure_empty_directory_exists(path, exception_class):2582def ensure_empty_directory_exists(path, exception_class):
25702583
=== modified file 'bzrlib/tests/__init__.py'
--- bzrlib/tests/__init__.py 2012-08-03 14:23:05 +0000
+++ bzrlib/tests/__init__.py 2013-05-23 10:07:40 +0000
@@ -1780,9 +1780,15 @@
17801780
1781 :returns: The actual attr value.1781 :returns: The actual attr value.
1782 """1782 """
1783 value = getattr(obj, attr_name)
1784 # The actual value is captured by the call below1783 # The actual value is captured by the call below
1785 self.addCleanup(setattr, obj, attr_name, value)1784 value = getattr(obj, attr_name, _unitialized_attr)
1785 if value is _unitialized_attr:
1786 # When the test completes, the attribute should not exist, but if
1787 # we aren't setting a value, we don't need to do anything.
1788 if new is not _unitialized_attr:
1789 self.addCleanup(delattr, obj, attr_name)
1790 else:
1791 self.addCleanup(setattr, obj, attr_name, value)
1786 if new is not _unitialized_attr:1792 if new is not _unitialized_attr:
1787 setattr(obj, attr_name, new)1793 setattr(obj, attr_name, new)
1788 return value1794 return value
17891795
=== modified file 'bzrlib/tests/test_osutils.py'
--- bzrlib/tests/test_osutils.py 2012-09-19 07:58:27 +0000
+++ bzrlib/tests/test_osutils.py 2013-05-23 10:07:40 +0000
@@ -23,6 +23,7 @@
23import select23import select
24import socket24import socket
25import sys25import sys
26import tempfile
26import time27import time
2728
28from bzrlib import (29from bzrlib import (
@@ -436,6 +437,49 @@
436 self.assertTrue(-eighteen_hours < offset < eighteen_hours)437 self.assertTrue(-eighteen_hours < offset < eighteen_hours)
437438
438439
440class TestFdatasync(tests.TestCaseInTempDir):
441
442 def do_fdatasync(self):
443 f = tempfile.NamedTemporaryFile()
444 osutils.fdatasync(f.fileno())
445 f.close()
446
447 @staticmethod
448 def raise_eopnotsupp(*args, **kwargs):
449 raise IOError(errno.EOPNOTSUPP, os.strerror(errno.EOPNOTSUPP))
450
451 @staticmethod
452 def raise_enotsup(*args, **kwargs):
453 raise IOError(errno.ENOTSUP, os.strerror(errno.ENOTSUP))
454
455 def test_fdatasync_handles_system_function(self):
456 self.overrideAttr(os, "fdatasync")
457 self.do_fdatasync()
458
459 def test_fdatasync_handles_no_fdatasync_no_fsync(self):
460 self.overrideAttr(os, "fdatasync")
461 self.overrideAttr(os, "fsync")
462 self.do_fdatasync()
463
464 def test_fdatasync_handles_no_EOPNOTSUPP(self):
465 self.overrideAttr(errno, "EOPNOTSUPP")
466 self.do_fdatasync()
467
468 def test_fdatasync_catches_ENOTSUP(self):
469 enotsup = getattr(errno, "ENOTSUP", None)
470 if enotsup is None:
471 raise tests.TestNotApplicable("No ENOTSUP on this platform")
472 self.overrideAttr(os, "fdatasync", self.raise_enotsup)
473 self.do_fdatasync()
474
475 def test_fdatasync_catches_EOPNOTSUPP(self):
476 enotsup = getattr(errno, "EOPNOTSUPP", None)
477 if enotsup is None:
478 raise tests.TestNotApplicable("No EOPNOTSUPP on this platform")
479 self.overrideAttr(os, "fdatasync", self.raise_eopnotsupp)
480 self.do_fdatasync()
481
482
439class TestLinks(tests.TestCaseInTempDir):483class TestLinks(tests.TestCaseInTempDir):
440484
441 def test_dereference_path(self):485 def test_dereference_path(self):
442486
=== modified file 'bzrlib/tests/test_selftest.py'
--- bzrlib/tests/test_selftest.py 2012-09-19 07:58:27 +0000
+++ bzrlib/tests/test_selftest.py 2013-05-23 10:07:40 +0000
@@ -1654,6 +1654,12 @@
1654 self.assertRaises(AssertionError,1654 self.assertRaises(AssertionError,
1655 self.assertListRaises, _TestException, success_generator)1655 self.assertListRaises, _TestException, success_generator)
16561656
1657 def _run_successful_test(self, test):
1658 result = testtools.TestResult()
1659 test.run(result)
1660 self.assertTrue(result.wasSuccessful())
1661 return result
1662
1657 def test_overrideAttr_without_value(self):1663 def test_overrideAttr_without_value(self):
1658 self.test_attr = 'original' # Define a test attribute1664 self.test_attr = 'original' # Define a test attribute
1659 obj = self # Make 'obj' visible to the embedded test1665 obj = self # Make 'obj' visible to the embedded test
@@ -1669,8 +1675,7 @@
1669 obj.test_attr = 'modified'1675 obj.test_attr = 'modified'
1670 self.assertEqual('modified', obj.test_attr)1676 self.assertEqual('modified', obj.test_attr)
16711677
1672 test = Test('test_value')1678 self._run_successful_test(Test('test_value'))
1673 test.run(unittest.TestResult())
1674 self.assertEqual('original', obj.test_attr)1679 self.assertEqual('original', obj.test_attr)
16751680
1676 def test_overrideAttr_with_value(self):1681 def test_overrideAttr_with_value(self):
@@ -1686,10 +1691,41 @@
1686 self.assertEqual('original', self.orig)1691 self.assertEqual('original', self.orig)
1687 self.assertEqual('modified', obj.test_attr)1692 self.assertEqual('modified', obj.test_attr)
16881693
1689 test = Test('test_value')1694 self._run_successful_test(Test('test_value'))
1690 test.run(unittest.TestResult())
1691 self.assertEqual('original', obj.test_attr)1695 self.assertEqual('original', obj.test_attr)
16921696
1697 def test_overrideAttr_with_no_existing_value_and_value(self):
1698 # Do not define the test_attribute
1699 obj = self # Make 'obj' visible to the embedded test
1700 class Test(tests.TestCase):
1701
1702 def setUp(self):
1703 tests.TestCase.setUp(self)
1704 self.orig = self.overrideAttr(obj, 'test_attr', new='modified')
1705
1706 def test_value(self):
1707 self.assertEqual(tests._unitialized_attr, self.orig)
1708 self.assertEqual('modified', obj.test_attr)
1709
1710 self._run_successful_test(Test('test_value'))
1711 self.assertRaises(AttributeError, getattr, obj, 'test_attr')
1712
1713 def test_overrideAttr_with_no_existing_value_and_no_value(self):
1714 # Do not define the test_attribute
1715 obj = self # Make 'obj' visible to the embedded test
1716 class Test(tests.TestCase):
1717
1718 def setUp(self):
1719 tests.TestCase.setUp(self)
1720 self.orig = self.overrideAttr(obj, 'test_attr')
1721
1722 def test_value(self):
1723 self.assertEqual(tests._unitialized_attr, self.orig)
1724 self.assertRaises(AttributeError, getattr, obj, 'test_attr')
1725
1726 self._run_successful_test(Test('test_value'))
1727 self.assertRaises(AttributeError, getattr, obj, 'test_attr')
1728
1693 def test_recordCalls(self):1729 def test_recordCalls(self):
1694 from bzrlib.tests import test_selftest1730 from bzrlib.tests import test_selftest
1695 calls = self.recordCalls(1731 calls = self.recordCalls(
16961732
=== modified file 'doc/en/release-notes/bzr-2.4.txt'
--- doc/en/release-notes/bzr-2.4.txt 2012-09-05 20:22:17 +0000
+++ doc/en/release-notes/bzr-2.4.txt 2013-05-23 10:07:40 +0000
@@ -35,6 +35,10 @@
35* Cope with Unix filesystems, such as smbfs, where chmod gives 'permission35* Cope with Unix filesystems, such as smbfs, where chmod gives 'permission
36 denied'. (Martin Pool, #606537)36 denied'. (Martin Pool, #606537)
3737
38* Fix a traceback when trying to checkout a tree that also has an entry
39 with file-id `TREE_ROOT` somewhere other than at the root directory.
40 (John Arbash Meinel, #830947)
41
38* When the ``limbo`` or ``pending-deletion`` directories exist, typically42* When the ``limbo`` or ``pending-deletion`` directories exist, typically
39 because of an interrupted tree update, but are empty, bzr no longer43 because of an interrupted tree update, but are empty, bzr no longer
40 errors out, because there is nothing for the user to clean up. Also,44 errors out, because there is nothing for the user to clean up. Also,
@@ -55,6 +59,10 @@
55* Prevent a traceback being printed to stderr when logging has problems and59* Prevent a traceback being printed to stderr when logging has problems and
56 accept utf-8 byte string without breaking. (Martin Packman, #714449)60 accept utf-8 byte string without breaking. (Martin Packman, #714449)
5761
62* Some filesystems give ``EOPNOTSUPP`` when trying to call ``fdatasync``.
63 This shouldn't be treated as a fatal error.
64 (John Arbash Meinel, #1075108)
65
58* Use ``encoding_type='exact'`` for ``bzr testament`` so that on Windows66* Use ``encoding_type='exact'`` for ``bzr testament`` so that on Windows
59 the sha hash of the long testament matches the sha hash in the short67 the sha hash of the long testament matches the sha hash in the short
60 form. (John Arbash Meinel, #1010339)68 form. (John Arbash Meinel, #1010339)
6169
=== modified file 'doc/en/release-notes/bzr-2.5.txt'
--- doc/en/release-notes/bzr-2.5.txt 2012-09-19 07:58:27 +0000
+++ doc/en/release-notes/bzr-2.5.txt 2013-05-23 10:07:40 +0000
@@ -35,6 +35,10 @@
35* ``bzr config`` properly handles aliases and references in the35* ``bzr config`` properly handles aliases and references in the
36 ``--directory`` parameter (Vincent Ladeuil, Wouter van Heyst, #947049)36 ``--directory`` parameter (Vincent Ladeuil, Wouter van Heyst, #947049)
3737
38* Fix a traceback when trying to checkout a tree that also has an entry
39 with file-id `TREE_ROOT` somewhere other than at the root directory.
40 (John Arbash Meinel, #830947)
41
38* Lightweight checkouts of remote repositories had a bug with how they42* Lightweight checkouts of remote repositories had a bug with how they
39 extracted texts from the repository. (Just an ordering constraint on how43 extracted texts from the repository. (Just an ordering constraint on how
40 they consumed the stream.) (John Arbash Meinel, #1046284)44 they consumed the stream.) (John Arbash Meinel, #1046284)
@@ -48,6 +52,10 @@
4852
49* Revert use of --no-tty when gpg signing commits. (Jelmer Vernooij, #1014570)53* Revert use of --no-tty when gpg signing commits. (Jelmer Vernooij, #1014570)
5054
55* Some filesystems give ``EOPNOTSUPP`` when trying to call ``fdatasync``.
56 This shouldn't be treated as a fatal error.
57 (John Arbash Meinel, #1075108)
58
51* Some small bug fixes wrt lightweight checkouts and remote repositories.59* Some small bug fixes wrt lightweight checkouts and remote repositories.
52 A test permutation was added that runs all working tree tests against a60 A test permutation was added that runs all working tree tests against a
53 lightweight checkout. (John Arbash Meinel, #1046697)61 lightweight checkout. (John Arbash Meinel, #1046697)
5462
=== modified file 'doc/en/release-notes/bzr-2.6.txt'
--- doc/en/release-notes/bzr-2.6.txt 2012-12-04 16:36:55 +0000
+++ doc/en/release-notes/bzr-2.6.txt 2013-05-23 10:07:40 +0000
@@ -60,6 +60,13 @@
60 ``BZR_PROGRESS_BAR``. This can be set in ``bazaar.conf`` or specified from60 ``BZR_PROGRESS_BAR``. This can be set in ``bazaar.conf`` or specified from
61 the command line with ``-Oprogress_bar=text``. (Vincent Ladeuil, #388275)61 the command line with ``-Oprogress_bar=text``. (Vincent Ladeuil, #388275)
6262
63* ``Authentication.Config`` now always returns unicode user names and passwords.
64 (Vincent Ladeuil, #514301)
65
66* Fix a traceback when trying to checkout a tree that also has an entry
67 with file-id `TREE_ROOT` somewhere other than at the root directory.
68 (John Arbash Meinel, #830947)
69
63* Fixed a bug where the entire contents of ``/etc/mailname`` is read in.70* Fixed a bug where the entire contents of ``/etc/mailname`` is read in.
64 We only want to read in the first line so that comments could be added71 We only want to read in the first line so that comments could be added
65 and would be ignored.72 and would be ignored.
@@ -69,8 +76,9 @@
69 causes breakage with docutils 0.9.1.76 causes breakage with docutils 0.9.1.
70 (Vincent Ladeuil, Jelmer Vernooij, #1066307)77 (Vincent Ladeuil, Jelmer Vernooij, #1066307)
7178
72* ``Authentication.Config`` now always returns unicode user names and passwords.79* Some filesystems give ``EOPNOTSUPP`` when trying to call ``fdatasync``.
73 (Vincent Ladeuil, #514301)80 This shouldn't be treated as a fatal error.
81 (John Arbash Meinel, #1075108)
7482
75* Warn when ``--show-base`` is used for ``pull`` in a treeless branch83* Warn when ``--show-base`` is used for ``pull`` in a treeless branch
76 instead of failing. It's useless but harmless. (Vincent Ladeuil, #1022160)84 instead of failing. It's useless but harmless. (Vincent Ladeuil, #1022160)