Rev 5136: (jelmer) Add basic support for feature flags. (Jelmer Vernooij) in file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/2.2/
Patch Queue Manager
pqm at pqm.ubuntu.com
Wed Mar 28 01:54:43 UTC 2012
At file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/2.2/
------------------------------------------------------------
revno: 5136 [merge]
revision-id: pqm at pqm.ubuntu.com-20120328015443-eyed372ro7kc7yl6
parent: pqm at pqm.ubuntu.com-20110820090216-xrqcq4me2nstw4to
parent: jelmer at samba.org-20120328001555-z422j3ow4od2ihtr
committer: Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: 2.2
timestamp: Wed 2012-03-28 01:54:43 +0000
message:
(jelmer) Add basic support for feature flags. (Jelmer Vernooij)
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzr bzr.py-20050313053754-5485f144c7006fa6
bzrlib/__init__.py __init__.py-20050309040759-33e65acf91bbcd5d
bzrlib/branch.py branch.py-20050309040759-e4baf4e0d046576e
bzrlib/bzrdir.py bzrdir.py-20060131065624-156dfea39c4387cb
bzrlib/errors.py errors.py-20050309040759-20512168c4e14fbd
bzrlib/repository.py rev_storage.py-20051111201905-119e9401e46257e3
bzrlib/tests/test_bzrdir.py test_bzrdir.py-20060131065654-deba40eef51cf220
bzrlib/workingtree.py workingtree.py-20050511021032-29b6ec0a681e02e3
doc/en/whats-new/whats-new-in-2.2.txt whatsnewin2.2.txt-20100304041442-cj7jdn23zakcw08l-1
=== modified file 'NEWS'
--- a/NEWS 2011-08-20 07:45:34 +0000
+++ b/NEWS 2012-03-15 14:37:25 +0000
@@ -5,18 +5,57 @@
.. contents:: List of Releases
:depth: 1
+
+bzr 2.2.6
+#########
+
+:2.2.6: NOT RELEASED YET
+
+Compatibility Breaks
+********************
+
+New Features
+************
+
+Bug Fixes
+*********
+
+Improvements
+************
+
+Documentation
+*************
+
+API Changes
+***********
+
+Internals
+*********
+
+Testing
+*******
+
+
bzr 2.2.5
#########
-:Codename: Suggestions welcome
-:2.2.5: NOT RELEASED YET
+:2.2.5: 2011-09-01
+
+This is a bugfix release. One regression introduced in 2.2b1 has been fixed
+for some rare conflict resolutions. Also a warning is now emmitted when
+branching an out-of-date ubuntu packaging branch. Upgrading is recommended
+for all users on earlier 2.2 releases.
Compatibility Breaks
********************
+None.
+
New Features
************
+None.
+
Bug Fixes
*********
@@ -27,15 +66,6 @@
* Don't crash while merging and encountering obscure path conflicts
involving different root-ids. (Vincent Ladeuil, #805809)
-Improvements
-************
-
-Documentation
-*************
-
-API Changes
-***********
-
Internals
*********
@@ -43,10 +73,6 @@
in the value string. Fix suggested by ConfigObj's author Michael Foord.
(Alexander Belchenko, #710410)
-Testing
-*******
-
-
bzr 2.1.5
#########
@@ -89,6 +115,10 @@
Improvements
************
+ * When opening formats with feature flags, optional features are
+ ignored and an improved error is printed for non-optional features.
+ (Jelmer Vernooij)
+
Documentation
*************
=== modified file 'bzr'
--- a/bzr 2011-05-17 09:57:58 +0000
+++ b/bzr 2011-09-02 18:47:36 +0000
@@ -23,7 +23,7 @@
import warnings
# update this on each release
-_script_version = (2, 2, 5)
+_script_version = (2, 2, 6)
try:
version_info = sys.version_info
=== modified file 'bzrlib/__init__.py'
--- a/bzrlib/__init__.py 2011-05-17 09:57:58 +0000
+++ b/bzrlib/__init__.py 2011-09-02 18:47:36 +0000
@@ -52,7 +52,7 @@
# Python version 2.0 is (2, 0, 0, 'final', 0)." Additionally we use a
# releaselevel of 'dev' for unreleased under-development code.
-version_info = (2, 2, 5, 'dev', 0)
+version_info = (2, 2, 6, 'dev', 0)
# API compatibility version
api_minimum_version = (2, 2, 0)
=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py 2010-08-13 07:32:06 +0000
+++ b/bzrlib/branch.py 2012-03-15 14:37:25 +0000
@@ -1549,7 +1549,8 @@
"""Return the format for the branch object in a_bzrdir."""
try:
transport = a_bzrdir.get_branch_transport(None, name=name)
- format_string = transport.get_bytes("format")
+ format_string = bzrdir.extract_format_string(
+ transport.get_bytes("format"))
format = klass._formats[format_string]
if isinstance(format, MetaDirBranchFormatFactory):
return format()
=== modified file 'bzrlib/bzrdir.py'
--- a/bzrlib/bzrdir.py 2010-11-26 18:13:30 +0000
+++ b/bzrlib/bzrdir.py 2012-03-28 00:15:55 +0000
@@ -86,8 +86,34 @@
registry,
symbol_versioning,
)
-
-
+
+
+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 ControlComponent(object):
"""Abstract base class for control directory components.
@@ -1959,6 +1985,8 @@
format_string = transport.get_bytes(".bzr/branch-format")
except errors.NoSuchFile:
raise errors.NotBranchError(path=transport.base)
+ format_string = extract_format_string(format_string)
+
try:
return klass._formats[format_string]
except KeyError:
=== modified file 'bzrlib/errors.py'
--- a/bzrlib/errors.py 2011-01-19 22:26:11 +0000
+++ b/bzrlib/errors.py 2012-03-15 14:37:25 +0000
@@ -3194,3 +3194,22 @@
def __init__(self, branch_url):
self.branch_url = branch_url
+
+class MissingFeature(BzrError):
+
+ _fmt = ("Missing feature %(feature)s not provided by this "
+ "version of Bazaar or any plugin.")
+
+ def __init__(self, feature):
+ self.feature = feature
+
+
+class ParseFormatError(BzrError):
+
+ _fmt = "Parse error on line %(lineno)d of format name: %(line)s"
+
+ def __init__(self, lineno, line, text):
+ BzrError.__init__(self)
+ self.lineno = lineno
+ self.line = line
+ self.text = text
=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py 2010-12-02 09:23:10 +0000
+++ b/bzrlib/repository.py 2012-03-15 14:37:25 +0000
@@ -3108,6 +3108,7 @@
try:
transport = a_bzrdir.get_repository_transport(None)
format_string = transport.get_bytes("format")
+ format_string = bzrdir.extract_format_string(format_string)
return format_registry.get(format_string)
except errors.NoSuchFile:
raise errors.NoRepositoryPresent(a_bzrdir)
=== modified file 'bzrlib/tests/test_bzrdir.py'
--- a/bzrlib/tests/test_bzrdir.py 2010-08-13 07:43:51 +0000
+++ b/bzrlib/tests/test_bzrdir.py 2012-03-15 14:37:25 +0000
@@ -1411,3 +1411,24 @@
param_repr = param_reprs[0]
self.assertStartsWith(param_repr, '<RepoInitHookParams for ')
+
+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/workingtree.py'
--- a/bzrlib/workingtree.py 2010-08-17 02:28:46 +0000
+++ b/bzrlib/workingtree.py 2012-03-15 14:37:25 +0000
@@ -2811,6 +2811,7 @@
try:
transport = a_bzrdir.get_workingtree_transport(None)
format_string = transport.get_bytes("format")
+ format_string = bzrdir.extract_format_string(format_string)
return klass._formats[format_string]
except errors.NoSuchFile:
raise errors.NoWorkingTree(base=transport.base)
=== modified file 'doc/en/whats-new/whats-new-in-2.2.txt'
--- a/doc/en/whats-new/whats-new-in-2.2.txt 2011-07-05 11:48:32 +0000
+++ b/doc/en/whats-new/whats-new-in-2.2.txt 2011-09-01 14:27:58 +0000
@@ -38,6 +38,9 @@
Bazaar 2.2.4 fixed a regression for some interactions with the launchpad
server.
+Bazaar 2.2.5 fixed a regression in some rare conflict resolutions and warns
+when branching an out-of-date ubuntu packaging branch.
+
See the :doc:`../release-notes/index` for details.
Bazaar 2.2 is fully compatible both locally and on the network with 2.0
More information about the bazaar-commits
mailing list