At http://bazaar.launchpad.net/~jameinel/2.5/work/2.4-into-2.5
------------------------------------------------------------ revno: 6500 [merge] revision-id: [email protected] parent: [email protected] parent: [email protected] committer: John Arbash Meinel <[email protected]> branch nick: 2.4-into-2.5 timestamp: Sun 2013-05-19 14:38:07 +0100 message: Try merging 2.4 into 2.5 and resolving the conflicts. modified: INSTALL INSTALL-20051019070340-4b27f2fb240c7943 bzrlib/_walkdirs_win32.pyx _walkdirs_win32.pyx-20080716220454-kweh3tgxez5dvw2l-2 bzrlib/btree_index.py index.py-20080624222253-p0x5f92uyh5hw734-7 bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183 bzrlib/bzrdir.py bzrdir.py-20060131065624-156dfea39c4387cb bzrlib/tests/__init__.py selftest.py-20050531073622-8d0e3c8845c97a64 bzrlib/tests/blackbox/test_testament.py test_testament.py-20060816161839-snq405g3jk15gpax-1 bzrlib/tests/test__walkdirs_win32.py test__walkdirs_win32-20080716220454-kweh3tgxez5dvw2l-3 bzrlib/tests/test_bzrdir.py test_bzrdir.py-20060131065654-deba40eef51cf220 bzrlib/tests/test_selftest.py test_selftest.py-20051202044319-c110a115d8c0456a doc/developers/code-style.txt codestyle.txt-20100515105711-133ealf7ereiq2eq-1 doc/en/admin-guide/introduction.txt introduction.txt-20091205144603-lgpl0e0z6lzk2rdw-7 doc/en/release-notes/bzr-2.4.txt bzr2.4.txt-20110114053217-k7ym9jfz243fddjm-1
=== modified file 'INSTALL' --- a/INSTALL 2010-06-02 05:03:31 +0000 +++ b/INSTALL 2012-08-30 20:36:18 +0000 @@ -4,9 +4,7 @@ Dependencies ------------ -bzr requires Python2.4 and cElementTree: - - http://effbot.org/zone/element-index.htm +bzr requires Python 2.6 or newer. If you wish to access branches over sftp, you will need paramiko and pycrypto: === modified file 'bzrlib/_walkdirs_win32.pyx' --- a/bzrlib/_walkdirs_win32.pyx 2011-04-05 12:15:34 +0000 +++ b/bzrlib/_walkdirs_win32.pyx 2012-03-29 08:34:13 +0000 @@ -1,4 +1,4 @@ -# Copyright (C) 2008-2011 Canonical Ltd +# Copyright (C) 2008-2012 Canonical Ltd # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -95,8 +95,19 @@ return self._st_size # os.stat always returns 0, so we hard code it here - cdef readonly int st_dev - cdef readonly int st_ino + property st_dev: + def __get__(self): + return 0 + property st_ino: + def __get__(self): + return 0 + # st_uid and st_gid required for some external tools like bzr-git & dulwich + property st_uid: + def __get__(self): + return 0 + property st_gid: + def __get__(self): + return 0 def __repr__(self): """Repr is the same as a Stat object. @@ -195,8 +206,6 @@ statvalue.st_mtime = _ftime_to_timestamp(&data.ftLastWriteTime) statvalue.st_atime = _ftime_to_timestamp(&data.ftLastAccessTime) statvalue._st_size = _get_size(data) - statvalue.st_ino = 0 - statvalue.st_dev = 0 return statvalue def read_dir(self, prefix, top): @@ -288,6 +297,4 @@ statvalue.st_mtime = st.st_mtime statvalue.st_atime = st.st_atime statvalue._st_size = st.st_size - statvalue.st_ino = 0 - statvalue.st_dev = 0 return statvalue === modified file 'bzrlib/btree_index.py' --- a/bzrlib/btree_index.py 2011-12-19 13:23:58 +0000 +++ b/bzrlib/btree_index.py 2013-05-19 13:38:07 +0000 @@ -298,6 +298,7 @@ """ new_leaf = False if rows[-1].writer is None: + new_leaf = True # opening a new leaf chunk; new_leaf = True for pos, internal_row in enumerate(rows[:-1]): @@ -324,10 +325,9 @@ optimize_for_size=self._optimize_for_size) rows[-1].writer.write(_LEAF_FLAG) if rows[-1].writer.write(line): - # if we failed to write, despite having an empty page to write to, - # then line is too big. raising the error avoids infinite recursion - # searching for a suitably large page that will not be found. if new_leaf: + # We just created this leaf, and now the line doesn't fit. + # Clearly it will never fit, so punt. raise errors.BadIndexKey(string_key) # this key did not fit in the node: rows[-1].finish_node() === modified file 'bzrlib/builtins.py' --- a/bzrlib/builtins.py 2012-02-16 16:42:43 +0000 +++ b/bzrlib/builtins.py 2013-05-19 13:38:07 +0000 @@ -5096,6 +5096,7 @@ Option('strict', help='Produce a strict-format testament.')] takes_args = ['branch?'] + encoding_type = 'exact' @display_command def run(self, branch=u'.', revision=None, long=False, strict=False): from bzrlib.testament import Testament, StrictTestament @@ -5114,9 +5115,9 @@ rev_id = revision[0].as_revision_id(b) t = testament_class.from_revision(b.repository, rev_id) if long: - sys.stdout.writelines(t.as_text_lines()) + self.outf.writelines(t.as_text_lines()) else: - sys.stdout.write(t.as_short_text()) + self.outf.write(t.as_short_text()) class cmd_annotate(Command): === modified file 'bzrlib/bzrdir.py' --- a/bzrlib/bzrdir.py 2012-01-31 15:43:17 +0000 +++ b/bzrlib/bzrdir.py 2013-05-19 13:38:07 +0000 @@ -77,6 +77,39 @@ ) +# Note: jam 20130519 This function was added in 2.4 as part of +# 6068 Patch Queue Manager 2012-03-27 [merge] +# (jelmer) Add support for feature flags. (Jelmer Vernooij) +# +# However, it doesn't seem to be needed or called in 2.5, which has +# different support for how it handles feature flags in format strings. +# It might be prudent to remove it to avoid confusion. +def extract_format_string(text): + """Read a format string from a file. + + The first line is returned. The other lines can contain + optional features. An exception is raised when a + required feature is present. + """ + lines = text.splitlines(True) + try: + firstline = lines.pop(0) + except IndexError: + raise errors.UnknownFormatError(format=text, kind='') + for lineno, line in enumerate(lines): + try: + (necessity, feature) = line.split(" ", 1) + except ValueError: + raise errors.ParseFormatError(lineno=lineno+2, + line=line, text=text) + else: + if necessity == "optional": + mutter("Ignoring optional feature %s", feature) + else: + raise errors.MissingFeature(feature) + return firstline + + class BzrDir(controldir.ControlDir): """A .bzr control diretory. === modified file 'bzrlib/tests/__init__.py' --- a/bzrlib/tests/__init__.py 2012-04-30 09:50:33 +0000 +++ b/bzrlib/tests/__init__.py 2013-05-19 13:38:07 +0000 @@ -1782,9 +1782,15 @@ :returns: The actual attr value. """ - value = getattr(obj, attr_name) # The actual value is captured by the call below - self.addCleanup(setattr, obj, attr_name, value) + value = getattr(obj, attr_name, _unitialized_attr) + if value is _unitialized_attr: + # When the test completes, the attribute should not exist, but if + # we aren't setting a value, we don't need to do anything. + if new is not _unitialized_attr: + self.addCleanup(delattr, obj, attr_name) + else: + self.addCleanup(setattr, obj, attr_name, value) if new is not _unitialized_attr: setattr(obj, attr_name, new) return value === modified file 'bzrlib/tests/blackbox/test_testament.py' --- a/bzrlib/tests/blackbox/test_testament.py 2009-03-23 14:59:43 +0000 +++ b/bzrlib/tests/blackbox/test_testament.py 2012-06-08 06:59:50 +0000 @@ -16,8 +16,10 @@ """Blackbox tests for the 'bzr testament' command""" +import re from bzrlib.tests.test_testament import ( + osutils, REV_1_SHORT, REV_1_SHORT_STRICT, REV_2_TESTAMENT, @@ -46,3 +48,12 @@ self.assertEqualDiff(err, '') self.assertEqualDiff(out, REV_1_SHORT_STRICT) + def test_testament_non_ascii(self): + self.wt.commit(u"Non \xe5ssci message") + long_out, err = self.run_bzr('testament --long') + self.assertEqualDiff(err, '') + short_out, err = self.run_bzr('testament') + self.assertEqualDiff(err, '') + sha1_re = re.compile('sha1: (?P<sha1>[a-f0-9]+)$', re.M) + sha1 = sha1_re.search(short_out).group('sha1') + self.assertEqual(sha1, osutils.sha_string(long_out)) === modified file 'bzrlib/tests/test__walkdirs_win32.py' --- a/bzrlib/tests/test__walkdirs_win32.py 2011-06-14 01:26:41 +0000 +++ b/bzrlib/tests/test__walkdirs_win32.py 2013-05-19 13:38:07 +0000 @@ -96,3 +96,22 @@ self.assertEqual(errno.ENOENT, e.errno) self.assertEqual(3, e.winerror) self.assertEqual((3, u'no_such_dir/*'), e.args) + + +class Test_Win32Stat(tests.TestCaseInTempDir): + + _test_needs_features = [win32_readdir_feature] + + def setUp(self): + super(Test_Win32Stat, self).setUp() + from bzrlib._walkdirs_win32 import lstat + self.win32_lstat = lstat + + def test_zero_members_present(self): + self.build_tree(['foo']) + st = self.win32_lstat('foo') + # we only want to ensure that some members are present + self.assertEqual(0, st.st_dev) + self.assertEqual(0, st.st_ino) + self.assertEqual(0, st.st_uid) + self.assertEqual(0, st.st_gid) === modified file 'bzrlib/tests/test_bzrdir.py' --- a/bzrlib/tests/test_bzrdir.py 2012-01-28 00:41:30 +0000 +++ b/bzrlib/tests/test_bzrdir.py 2013-05-19 13:38:07 +0000 @@ -1575,3 +1575,25 @@ # spaces are not allowed in feature names self.assertRaises(ValueError, SampleBzrFormat.register_feature, "nested trees") + + +class ExtractFormatStringTests(TestCase): + + def test_normal(self): + self.assertEquals("Bazaar-NG branch, format 0.0.4\n", + bzrdir.extract_format_string("Bazaar-NG branch, format 0.0.4\n")) + + def test_with_optional_feature(self): + self.assertEquals("Bazaar-NG branch, format 0.0.4\n", + bzrdir.extract_format_string("Bazaar-NG branch, format 0.0.4\n" + "optional feature foo\n")) + + def test_with_required_feature(self): + self.assertRaises(errors.MissingFeature, + bzrdir.extract_format_string, "Bazaar-NG branch, format 0.0.4\n" + "required feature foo\n") + + def test_with_invalid_line(self): + self.assertRaises(errors.ParseFormatError, + bzrdir.extract_format_string, "Bazaar-NG branch, format 0.0.4\n" + "requiredfoo\n") === modified file 'bzrlib/tests/test_selftest.py' --- a/bzrlib/tests/test_selftest.py 2011-11-08 17:07:23 +0000 +++ b/bzrlib/tests/test_selftest.py 2013-05-19 13:38:07 +0000 @@ -1623,6 +1623,12 @@ self.assertRaises(AssertionError, self.assertListRaises, _TestException, success_generator) + def _run_successful_test(self, test): + result = testtools.TestResult() + test.run(result) + self.assertTrue(result.wasSuccessful()) + return result + def test_overrideAttr_without_value(self): self.test_attr = 'original' # Define a test attribute obj = self # Make 'obj' visible to the embedded test @@ -1638,8 +1644,7 @@ obj.test_attr = 'modified' self.assertEqual('modified', obj.test_attr) - test = Test('test_value') - test.run(unittest.TestResult()) + self._run_successful_test(Test('test_value')) self.assertEqual('original', obj.test_attr) def test_overrideAttr_with_value(self): @@ -1655,10 +1660,41 @@ self.assertEqual('original', self.orig) self.assertEqual('modified', obj.test_attr) - test = Test('test_value') - test.run(unittest.TestResult()) + self._run_successful_test(Test('test_value')) self.assertEqual('original', obj.test_attr) + def test_overrideAttr_with_no_existing_value_and_value(self): + # Do not define the test_attribute + obj = self # Make 'obj' visible to the embedded test + class Test(tests.TestCase): + + def setUp(self): + tests.TestCase.setUp(self) + self.orig = self.overrideAttr(obj, 'test_attr', new='modified') + + def test_value(self): + self.assertEqual(tests._unitialized_attr, self.orig) + self.assertEqual('modified', obj.test_attr) + + self._run_successful_test(Test('test_value')) + self.assertRaises(AttributeError, getattr, obj, 'test_attr') + + def test_overrideAttr_with_no_existing_value_and_no_value(self): + # Do not define the test_attribute + obj = self # Make 'obj' visible to the embedded test + class Test(tests.TestCase): + + def setUp(self): + tests.TestCase.setUp(self) + self.orig = self.overrideAttr(obj, 'test_attr') + + def test_value(self): + self.assertEqual(tests._unitialized_attr, self.orig) + self.assertRaises(AttributeError, getattr, obj, 'test_attr') + + self._run_successful_test(Test('test_value')) + self.assertRaises(AttributeError, getattr, obj, 'test_attr') + def test_recordCalls(self): from bzrlib.tests import test_selftest calls = self.recordCalls( === modified file 'doc/developers/code-style.txt' --- a/doc/developers/code-style.txt 2011-06-28 21:45:01 +0000 +++ b/doc/developers/code-style.txt 2012-08-30 21:54:35 +0000 @@ -77,20 +77,11 @@ Python versions =============== -Bazaar supports Python from 2.4 through 2.6, and in the future we want to -support Python 2.7 and 3.0. Avoid using language features added in 2.5, -2.6 or 2.7, or features deprecated in Python 3.0. (You can check v3 +Bazaar supports Python from 2.6 through 2.7, and in the future we want to +support Python 3. Avoid using language features added in +2.7, or features deprecated in Python 3.0. (You can check v3 compatibility using the ``-3`` option of Python2.6.) -Specifically: - -* Don't use the ``with`` statement. - -* Don't ``from . import``. - -* Don't use ``try/except/finally``, which is not supported in Python2.4, - use separate nested ``try/except`` and ``try/finally`` blocks. - hasattr and getattr =================== === modified file 'doc/en/admin-guide/introduction.txt' --- a/doc/en/admin-guide/introduction.txt 2010-06-02 05:03:31 +0000 +++ b/doc/en/admin-guide/introduction.txt 2012-08-30 21:21:38 +0000 @@ -31,13 +31,12 @@ environments. For the purposes of this document, we will consider Mac OS X as a type of Unix. -In general, Bazaar requires only Python_ 2.4 or greater and the cElementTree_ -package (included in Python 2.5 and later) to run. If you would *optionally* +In general, Bazaar requires only Python_ 2.6 or greater to run. +If you would *optionally* like to be able to access branches using SFTP, you need `paramiko and pycrypto`_. .. _Python: http://www.python.org/ -.. _cElementTree: http://effbot.org/zone/element-index.htm .. _paramiko and pycrypto: http://www.lag.net/paramiko/ For maximum performance, Bazaar can make use of compiled versions of some === modified file 'doc/en/release-notes/bzr-2.4.txt' --- a/doc/en/release-notes/bzr-2.4.txt 2012-02-27 13:07:18 +0000 +++ b/doc/en/release-notes/bzr-2.4.txt 2013-05-19 13:38:07 +0000 @@ -55,6 +55,14 @@ * Prevent a traceback being printed to stderr when logging has problems and accept utf-8 byte string without breaking. (Martin Packman, #714449) +* Use ``encoding_type='exact'`` for ``bzr testament`` so that on Windows + the sha hash of the long testament matches the sha hash in the short + form. (John Arbash Meinel, #1010339) + +* _Win32Stat object provides members st_uid and st_gid, those are present + in Python's os.stat object. These members required for external tools like + bzr-git and dulwich. (Alexander Belchenko, #967060) + Documentation *************
-- bazaar-commits mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/bazaar-commits
