Merge lp:~jameinel/bzr/2.5-merges-2.4 into lp:bzr/2.5

Proposed by John A Meinel
Status: Merged
Approved by: John A Meinel
Approved revision: no longer in the source branch.
Merged at revision: 6513
Proposed branch: lp:~jameinel/bzr/2.5-merges-2.4
Merge into: lp:bzr/2.5
Diff against target: 185 lines (+84/-8)
5 files modified
bzrlib/dirstate.py (+10/-7)
bzrlib/osutils.py (+14/-1)
bzrlib/tests/test_osutils.py (+44/-0)
doc/en/release-notes/bzr-2.4.txt (+8/-0)
doc/en/release-notes/bzr-2.5.txt (+8/-0)
To merge this branch: bzr merge lp:~jameinel/bzr/2.5-merges-2.4
Reviewer Review Type Date Requested Status
Richard Wilbur Approve
Review via email: mp+165326@code.launchpad.net

Commit message

Merge bzr-2.4 to bring in bugfixes for bug #830947 and bug #1075108.

Description of the change

This just brings in the next round of changes from the 2.4 branch.

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 :

Thanks for bringing the good stuff forward to 2.5! (I already approved this earlier on 2.4;>)
+1

review: Approve

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-05 11:16:45 +0000
+++ bzrlib/dirstate.py 2013-05-23 09:32:44 +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-11 08:39:14 +0000
+++ bzrlib/osutils.py 2013-05-23 09:32:44 +0000
@@ -2532,6 +2532,10 @@
2532else:2532else:
2533 is_local_pid_dead = _posix_is_local_pid_dead2533 is_local_pid_dead = _posix_is_local_pid_dead
25342534
2535_maybe_ignored = ['EAGAIN', 'EINTR', 'ENOTSUP', 'EOPNOTSUPP', 'EACCES']
2536_fdatasync_ignored = [getattr(errno, name) for name in _maybe_ignored
2537 if getattr(errno, name, None) is not None]
2538
25352539
2536def fdatasync(fileno):2540def fdatasync(fileno):
2537 """Flush file contents to disk if possible.2541 """Flush file contents to disk if possible.
@@ -2541,7 +2545,16 @@
2541 """2545 """
2542 fn = getattr(os, 'fdatasync', getattr(os, 'fsync', None))2546 fn = getattr(os, 'fdatasync', getattr(os, 'fsync', None))
2543 if fn is not None:2547 if fn is not None:
2544 fn(fileno)2548 try:
2549 fn(fileno)
2550 except IOError, e:
2551 # See bug #1075108, on some platforms fdatasync exists, but can
2552 # raise ENOTSUP. However, we are calling fdatasync to be helpful
2553 # and reduce the chance of corruption-on-powerloss situations. It
2554 # is not a mandatory call, so it is ok to suppress failures.
2555 trace.mutter("ignoring error calling fdatasync: %s" % (e,))
2556 if getattr(e, 'errno', None) not in _fdatasync_ignored:
2557 raise
25452558
25462559
2547def ensure_empty_directory_exists(path, exception_class):2560def ensure_empty_directory_exists(path, exception_class):
25482561
=== modified file 'bzrlib/tests/test_osutils.py'
--- bzrlib/tests/test_osutils.py 2012-09-11 08:39:14 +0000
+++ bzrlib/tests/test_osutils.py 2013-05-23 09:32:44 +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 (
@@ -427,6 +428,49 @@
427 self.assertTrue(-eighteen_hours < offset < eighteen_hours)428 self.assertTrue(-eighteen_hours < offset < eighteen_hours)
428429
429430
431class TestFdatasync(tests.TestCaseInTempDir):
432
433 def do_fdatasync(self):
434 f = tempfile.NamedTemporaryFile()
435 osutils.fdatasync(f.fileno())
436 f.close()
437
438 @staticmethod
439 def raise_eopnotsupp(*args, **kwargs):
440 raise IOError(errno.EOPNOTSUPP, os.strerror(errno.EOPNOTSUPP))
441
442 @staticmethod
443 def raise_enotsup(*args, **kwargs):
444 raise IOError(errno.ENOTSUP, os.strerror(errno.ENOTSUP))
445
446 def test_fdatasync_handles_system_function(self):
447 self.overrideAttr(os, "fdatasync")
448 self.do_fdatasync()
449
450 def test_fdatasync_handles_no_fdatasync_no_fsync(self):
451 self.overrideAttr(os, "fdatasync")
452 self.overrideAttr(os, "fsync")
453 self.do_fdatasync()
454
455 def test_fdatasync_handles_no_EOPNOTSUPP(self):
456 self.overrideAttr(errno, "EOPNOTSUPP")
457 self.do_fdatasync()
458
459 def test_fdatasync_catches_ENOTSUP(self):
460 enotsup = getattr(errno, "ENOTSUP", None)
461 if enotsup is None:
462 raise tests.TestNotApplicable("No ENOTSUP on this platform")
463 self.overrideAttr(os, "fdatasync", self.raise_enotsup)
464 self.do_fdatasync()
465
466 def test_fdatasync_catches_EOPNOTSUPP(self):
467 enotsup = getattr(errno, "EOPNOTSUPP", None)
468 if enotsup is None:
469 raise tests.TestNotApplicable("No EOPNOTSUPP on this platform")
470 self.overrideAttr(os, "fdatasync", self.raise_eopnotsupp)
471 self.do_fdatasync()
472
473
430class TestLinks(tests.TestCaseInTempDir):474class TestLinks(tests.TestCaseInTempDir):
431475
432 def test_dereference_path(self):476 def test_dereference_path(self):
433477
=== modified file 'doc/en/release-notes/bzr-2.4.txt'
--- doc/en/release-notes/bzr-2.4.txt 2013-05-19 14:29:37 +0000
+++ doc/en/release-notes/bzr-2.4.txt 2013-05-23 09:32:44 +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-07 13:15:02 +0000
+++ doc/en/release-notes/bzr-2.5.txt 2013-05-23 09:32:44 +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)

Subscribers

People subscribed via source and target branches