Rev 3779: (mbp) merge 1.8final back to trunk in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Thu Oct 16 05:35:58 BST 2008
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 3779
revision-id: pqm at pqm.ubuntu.com-20081016043554-38i4ho6svnlyba65
parent: pqm at pqm.ubuntu.com-20081015214444-ztwoizx180edy73v
parent: mbp at sourcefrog.net-20081016035842-77pczqghpnd5rxkt
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2008-10-16 05:35:54 +0100
message:
(mbp) merge 1.8final back to trunk
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/branch.py branch.py-20050309040759-e4baf4e0d046576e
bzrlib/tests/test_branch.py test_branch.py-20060116013032-97819aa07b8ab3b5
setup.py setup.py-20050314065409-02f8a0a6e3f9bc70
------------------------------------------------------------
revno: 3778.1.1
revision-id: mbp at sourcefrog.net-20081016035842-77pczqghpnd5rxkt
parent: pqm at pqm.ubuntu.com-20081015214444-ztwoizx180edy73v
parent: pqm at pqm.ubuntu.com-20081016023607-p9j30et9foqm0wa7
committer: Martin Pool <mbp at sourcefrog.net>
branch nick: integration
timestamp: Thu 2008-10-16 14:58:42 +1100
message:
merge 1.8final back to trunk
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/branch.py branch.py-20050309040759-e4baf4e0d046576e
bzrlib/tests/test_branch.py test_branch.py-20060116013032-97819aa07b8ab3b5
setup.py setup.py-20050314065409-02f8a0a6e3f9bc70
------------------------------------------------------------
revno: 3763.3.3
revision-id: pqm at pqm.ubuntu.com-20081016023607-p9j30et9foqm0wa7
parent: pqm at pqm.ubuntu.com-20081009001122-ftxm8443zmis8vm4
parent: mbp at sourcefrog.net-20081016015506-kr5oefh484xj90aw
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: 1.8
timestamp: Thu 2008-10-16 03:36:07 +0100
message:
(mbp) prepare 1.8final
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/__init__.py __init__.py-20050309040759-33e65acf91bbcd5d
bzrlib/branch.py branch.py-20050309040759-e4baf4e0d046576e
bzrlib/tests/test_branch.py test_branch.py-20060116013032-97819aa07b8ab3b5
------------------------------------------------------------
revno: 3763.7.2
revision-id: mbp at sourcefrog.net-20081016015506-kr5oefh484xj90aw
parent: mbp at sourcefrog.net-20081016015304-6rq775qvvlxtadk4
committer: Martin Pool <mbp at sourcefrog.net>
branch nick: prepare-1.8
timestamp: Thu 2008-10-16 12:55:06 +1100
message:
Release bzr 1.8 final
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/__init__.py __init__.py-20050309040759-33e65acf91bbcd5d
------------------------------------------------------------
revno: 3763.7.1
revision-id: mbp at sourcefrog.net-20081016015304-6rq775qvvlxtadk4
parent: pqm at pqm.ubuntu.com-20081009001122-ftxm8443zmis8vm4
parent: andrew.bennetts at canonical.com-20081010070446-mqf1sj2g3fy7u6j1
committer: Martin Pool <mbp at sourcefrog.net>
branch nick: prepare-1.8
timestamp: Thu 2008-10-16 12:53:04 +1100
message:
Merge Andrew's fix for 230902
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/branch.py branch.py-20050309040759-e4baf4e0d046576e
bzrlib/tests/test_branch.py test_branch.py-20060116013032-97819aa07b8ab3b5
------------------------------------------------------------
revno: 3763.6.1
revision-id: andrew.bennetts at canonical.com-20081010070446-mqf1sj2g3fy7u6j1
parent: pqm at pqm.ubuntu.com-20081009001122-ftxm8443zmis8vm4
parent: andrew.bennetts at canonical.com-20081007115411-uq38cuumnrw0trsm
committer: Andrew Bennetts <andrew.bennetts at canonical.com>
branch nick: push-unlock-1.8
timestamp: Fri 2008-10-10 18:04:46 +1100
message:
Merge fix for #230902, adding NEWS entry.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/branch.py branch.py-20050309040759-e4baf4e0d046576e
bzrlib/tests/test_branch.py test_branch.py-20060116013032-97819aa07b8ab3b5
------------------------------------------------------------
revno: 3758.1.1
revision-id: andrew.bennetts at canonical.com-20081007115411-uq38cuumnrw0trsm
parent: pqm at pqm.ubuntu.com-20081001235145-nh3r3qcg0nwwmvdg
committer: Andrew Bennetts <andrew.bennetts at canonical.com>
branch nick: push-unlock
timestamp: Tue 2008-10-07 22:54:11 +1100
message:
Fix #230902 by being more careful not to squash a pre-existing exception when calling foo.unlock()
modified:
bzrlib/branch.py branch.py-20050309040759-e4baf4e0d046576e
bzrlib/tests/test_branch.py test_branch.py-20060116013032-97819aa07b8ab3b5
------------------------------------------------------------
revno: 3763.3.2
revision-id: pqm at pqm.ubuntu.com-20081009001122-ftxm8443zmis8vm4
parent: pqm at pqm.ubuntu.com-20081007091257-ec2725q2xsrji7dn
parent: mbp at sourcefrog.net-20081008225502-ekthueaqnz3cutg3
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: 1.8
timestamp: Thu 2008-10-09 01:11:22 +0100
message:
(mbp) define -DWIN32 for pyrex
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
setup.py setup.py-20050314065409-02f8a0a6e3f9bc70
------------------------------------------------------------
revno: 3763.5.4
revision-id: mbp at sourcefrog.net-20081008225502-ekthueaqnz3cutg3
parent: mbp at sourcefrog.net-20081008053353-aqjccu3zsifjz0f1
committer: Martin Pool <mbp at sourcefrog.net>
branch nick: 277481-win32-pyrex
timestamp: Thu 2008-10-09 09:55:02 +1100
message:
News for 277481
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
------------------------------------------------------------
revno: 3763.5.3
revision-id: mbp at sourcefrog.net-20081008053353-aqjccu3zsifjz0f1
parent: mbp at sourcefrog.net-20081008011605-tzgv9owfn2wde4cg
committer: Martin Pool <mbp at sourcefrog.net>
branch nick: 277481-win32-pyrex
timestamp: Wed 2008-10-08 16:33:53 +1100
message:
Review feedback on add_pyrex_extension
modified:
setup.py setup.py-20050314065409-02f8a0a6e3f9bc70
------------------------------------------------------------
revno: 3763.5.2
revision-id: mbp at sourcefrog.net-20081008011605-tzgv9owfn2wde4cg
parent: mbp at sourcefrog.net-20081008011111-z68x2eto2j52648n
committer: Martin Pool <mbp at sourcefrog.net>
branch nick: prepare-1.8
timestamp: Wed 2008-10-08 12:16:05 +1100
message:
Set -DWIN32 for all pyrex extensions, not one by one
modified:
setup.py setup.py-20050314065409-02f8a0a6e3f9bc70
------------------------------------------------------------
revno: 3763.5.1
revision-id: mbp at sourcefrog.net-20081008011111-z68x2eto2j52648n
parent: pqm at pqm.ubuntu.com-20081007091257-ec2725q2xsrji7dn
committer: Martin Pool <mbp at sourcefrog.net>
branch nick: prepare-1.8
timestamp: Wed 2008-10-08 12:11:11 +1100
message:
WIN32 must be defined when building all Pyrex extensions on Windows (#277481, from bialix)
modified:
setup.py setup.py-20050314065409-02f8a0a6e3f9bc70
=== modified file 'NEWS'
--- a/NEWS 2008-10-15 19:07:11 +0000
+++ b/NEWS 2008-10-16 03:58:42 +0000
@@ -21,6 +21,16 @@
BUG FIXES:
+ * A failure to load a plugin due to an IncompatibleAPI exception is
+ now correctly reported. (Robert Collins, #279451)
+
+ * API versioning support now has a multiple-version checking api
+ ``require_any_api``. (Robert Collins, #279447)
+
+ * ``bzr co`` uses less memory. It used to unpack the entire WT into
+ memory before writing it to disk. This was a little bit faster, but
+ consumed lots of memory. (John Arbash Meinel, #269456)
+
DOCUMENTATION:
API CHANGES:
@@ -29,17 +39,32 @@
INTERNALS:
+ PORTABILITY:
+
+
+bzr 1.8 2008-10-16
+------------------
+
+Bazaar 1.8 includes several fixes that improve working tree performance,
+display of revision logs, and merges. The bzr testsuite now passes on OS
+X and Python 2.6, and almost completely passes on Windows. The
+smartserver code has gained several bug fixes and performance
+improvements, and can now run server-side hooks within an http server.
+
+ BUG FIXES:
+
+ * Fix "Must end write group" error when another error occurs during
+ ``bzr push``. (Andrew Bennetts, #230902)
+
+ PORTABILITY:
+
+ * Some Pyrex versions require the WIN32 macro defined to compile on
+ that platform. (Alexander Belchenko, Martin Pool, #277481)
+
bzr 1.8rc1 2008-10-07
---------------------
-Bazaar 1.8 includes several fixes that improve working tree performance,
-display of revision logs, and merges. We've also fixed, and the bzr
-testsuite now passes on OS X and Python 2.6, and almost completely passes
-on Windows. The smartserver code has gained several bug fixes and
-performance improvements, and can now run server-side hooks within an http
-server.
-
CHANGES:
* ``bzr log file`` has been changed. It now uses a different method
@@ -112,24 +137,14 @@
BUG FIXES:
- * API versioning support now has a multiple-version checking api
- ``require_any_api``. (Robert Collins, #279447)
-
* Avoid random failures arising from misinterpreted ``errno`` values
in ``_readdir_pyx.read_dir``.
(Martin Pool, #279381)
- * A failure to load a plugin due to an IncompatibleAPI exception is
- now correctly reported. (Robert Collins, #279451)
-
* Branching from a shared repository on a smart server into a new
repository now preserves the repository format.
(Andrew Bennetts, #269214)
- * ``bzr co`` uses less memory. It used to unpack the entire WT into
- memory before writing it to disk. This was a little bit faster, but
- consumed lots of memory. (John Arbash Meinel, #269456)
-
* ``bzr log`` now accepts a ``--change`` option.
(Vincent Ladeuil, #248427)
=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py 2008-09-25 22:25:09 +0000
+++ b/bzrlib/branch.py 2008-10-07 11:54:11 +0000
@@ -1743,14 +1743,10 @@
"""
# TODO: Public option to disable running hooks - should be trivial but
# needs tests.
- target.lock_write()
- try:
- result = self._push_with_bound_branches(target, overwrite,
- stop_revision,
- _override_hook_source_branch=_override_hook_source_branch)
- return result
- finally:
- target.unlock()
+ return _run_with_write_locked_target(
+ target, self._push_with_bound_branches, target, overwrite,
+ stop_revision,
+ _override_hook_source_branch=_override_hook_source_branch)
def _push_with_bound_branches(self, target, overwrite,
stop_revision,
@@ -2445,3 +2441,37 @@
branch._set_config_location('stacked_on_location', '')
# update target format
branch._transport.put_bytes('format', format.get_format_string())
+
+
+
+def _run_with_write_locked_target(target, callable, *args, **kwargs):
+ """Run ``callable(*args, **kwargs)``, write-locking target for the
+ duration.
+
+ _run_with_write_locked_target will attempt to release the lock it acquires.
+
+ If an exception is raised by callable, then that exception *will* be
+ propagated, even if the unlock attempt raises its own error. Thus
+ _run_with_write_locked_target should be preferred to simply doing::
+
+ target.lock_write()
+ try:
+ return callable(*args, **kwargs)
+ finally:
+ target.unlock()
+
+ """
+ # This is very similar to bzrlib.decorators.needs_write_lock. Perhaps they
+ # should share code?
+ target.lock_write()
+ try:
+ result = callable(*args, **kwargs)
+ except:
+ exc_info = sys.exc_info()
+ try:
+ target.unlock()
+ finally:
+ raise exc_info[0], exc_info[1], exc_info[2]
+ else:
+ target.unlock()
+ return result
=== modified file 'bzrlib/tests/test_branch.py'
--- a/bzrlib/tests/test_branch.py 2008-07-22 19:48:40 +0000
+++ b/bzrlib/tests/test_branch.py 2008-10-07 11:54:11 +0000
@@ -41,6 +41,7 @@
BzrBranchFormat5,
BzrBranchFormat6,
PullResult,
+ _run_with_write_locked_target,
)
from bzrlib.bzrdir import (BzrDirMetaFormat1, BzrDirMeta1,
BzrDir, BzrDirFormat)
@@ -438,3 +439,70 @@
# it's still supported
a = "%d revisions pulled" % r
self.assertEqual(a, "10 revisions pulled")
+
+
+
+class _StubLockable(object):
+ """Helper for TestRunWithWriteLockedTarget."""
+
+ def __init__(self, calls, unlock_exc=None):
+ self.calls = calls
+ self.unlock_exc = unlock_exc
+
+ def lock_write(self):
+ self.calls.append('lock_write')
+
+ def unlock(self):
+ self.calls.append('unlock')
+ if self.unlock_exc is not None:
+ raise self.unlock_exc
+
+
+class _ErrorFromCallable(Exception):
+ """Helper for TestRunWithWriteLockedTarget."""
+
+
+class _ErrorFromUnlock(Exception):
+ """Helper for TestRunWithWriteLockedTarget."""
+
+
+class TestRunWithWriteLockedTarget(TestCase):
+ """Tests for _run_with_write_locked_target."""
+
+ def setUp(self):
+ self._calls = []
+
+ def func_that_returns_ok(self):
+ self._calls.append('func called')
+ return 'ok'
+
+ def func_that_raises(self):
+ self._calls.append('func called')
+ raise _ErrorFromCallable()
+
+ def test_success_unlocks(self):
+ lockable = _StubLockable(self._calls)
+ result = _run_with_write_locked_target(
+ lockable, self.func_that_returns_ok)
+ self.assertEqual('ok', result)
+ self.assertEqual(['lock_write', 'func called', 'unlock'], self._calls)
+
+ def test_exception_unlocks_and_propagates(self):
+ lockable = _StubLockable(self._calls)
+ self.assertRaises(_ErrorFromCallable,
+ _run_with_write_locked_target, lockable, self.func_that_raises)
+ self.assertEqual(['lock_write', 'func called', 'unlock'], self._calls)
+
+ def test_callable_succeeds_but_error_during_unlock(self):
+ lockable = _StubLockable(self._calls, unlock_exc=_ErrorFromUnlock())
+ self.assertRaises(_ErrorFromUnlock,
+ _run_with_write_locked_target, lockable, self.func_that_returns_ok)
+ self.assertEqual(['lock_write', 'func called', 'unlock'], self._calls)
+
+ def test_error_during_unlock_does_not_mask_original_error(self):
+ lockable = _StubLockable(self._calls, unlock_exc=_ErrorFromUnlock())
+ self.assertRaises(_ErrorFromCallable,
+ _run_with_write_locked_target, lockable, self.func_that_raises)
+ self.assertEqual(['lock_write', 'func called', 'unlock'], self._calls)
+
+
=== modified file 'setup.py'
--- a/setup.py 2008-10-10 19:41:44 +0000
+++ b/setup.py 2008-10-16 03:58:42 +0000
@@ -224,7 +224,7 @@
unavailable_files = []
-def add_pyrex_extension(module_name, **kwargs):
+def add_pyrex_extension(module_name, libraries=None):
"""Add a pyrex module to build.
This will use Pyrex to auto-generate the .c file if it is available.
@@ -240,26 +240,29 @@
path = module_name.replace('.', '/')
pyrex_name = path + '.pyx'
c_name = path + '.c'
+ define_macros = []
+ if sys.platform == 'win32':
+ # pyrex uses the macro WIN32 to detect the platform, even though it should
+ # be using something like _WIN32 or MS_WINDOWS, oh well, we can give it the
+ # right value.
+ define_macros.append(('WIN32', None))
if have_pyrex:
- ext_modules.append(Extension(module_name, [pyrex_name], **kwargs))
+ ext_modules.append(Extension(module_name, [pyrex_name],
+ define_macros=define_macros, libraries=libraries))
else:
if not os.path.isfile(c_name):
unavailable_files.append(c_name)
else:
- ext_modules.append(Extension(module_name, [c_name], **kwargs))
+ ext_modules.append(Extension(module_name, [c_name],
+ define_macros=define_macros, libraries=libraries))
add_pyrex_extension('bzrlib._btree_serializer_c')
add_pyrex_extension('bzrlib._knit_load_data_c')
if sys.platform == 'win32':
add_pyrex_extension('bzrlib._dirstate_helpers_c',
- libraries=['Ws2_32']
- )
- # pyrex uses the macro WIN32 to detect the platform, even though it should
- # be using something like _WIN32 or MS_WINDOWS, oh well, we can give it the
- # right value.
- add_pyrex_extension('bzrlib._walkdirs_win32',
- define_macros=[('WIN32', None)])
+ libraries=['Ws2_32'])
+ add_pyrex_extension('bzrlib._walkdirs_win32')
else:
if have_pyrex and pyrex_version == '0.9.4.1':
# Pyrex 0.9.4.1 fails to compile this extension correctly
More information about the bazaar-commits
mailing list