diff -Nru bzr-loom-2.1+bzr150/branch.py bzr-loom-2.2.0/branch.py --- bzr-loom-2.1+bzr150/branch.py 2012-02-01 14:04:03.000000000 +0000 +++ bzr-loom-2.2.0/branch.py 2012-02-26 16:47:05.000000000 +0000 @@ -52,9 +52,6 @@ EMPTY_REVISION = 'empty:' -# Required for compatibility with bzr < 2.4b2 -InventoryTree = getattr(_mod_tree, "InventoryTree", _mod_tree.Tree) - def create_thread(loom, thread_name): """Create a thread in the branch loom called thread.""" @@ -158,7 +155,7 @@ _fmt = """Cannot combine threads on the bottom thread.""" -class LoomMetaTree(InventoryTree): +class LoomMetaTree(_mod_tree.InventoryTree): """A 'tree' object that is used to commit the loom meta branch.""" def __init__(self, loom_meta_ie, loom_stream, loom_sha1): @@ -780,19 +777,9 @@ def initialize(self, a_bzrdir, name=None, repository=None, append_revisions_only=None): """Create a branch of this format in a_bzrdir.""" - if repository is None and append_revisions_only is None: - super(LoomFormatMixin, self).initialize(a_bzrdir, name=name) - elif append_revisions_only is None: - # The 'repository' optional keyword arg is new in bzr 2.3, so don't - # pass it unless it was passed in. - super(LoomFormatMixin, self).initialize(a_bzrdir, name=name, - repository=repository) - else: - # The 'append_revisions_only' optional keyword arg is new in bzr - # 2.4, so don't pass it unless it was passed in. - super(LoomFormatMixin, self).initialize(a_bzrdir, name=name, - repository=repository, - append_revisions_only=append_revisions_only) + super(LoomFormatMixin, self).initialize(a_bzrdir, name=name, + repository=repository, + append_revisions_only=append_revisions_only) branch_transport = a_bzrdir.get_branch_transport(self) files = [] @@ -953,12 +940,7 @@ @classmethod def _get_branch_formats_to_test(klass): - try: - format_registry = getattr(bzrlib.branch, "format_registry") - except AttributeError: # bzr < 2.4 - default_format = bzrlib.branch.BranchFormat._default_format - else: - default_format = format_registry.get_default() + default_format = bzrlib.branch.format_registry.get_default() return [ (default_format, BzrBranchLoomFormat7()), (BzrBranchLoomFormat7(), default_format), diff -Nru bzr-loom-2.1+bzr150/commands.py bzr-loom-2.2.0/commands.py --- bzr-loom-2.1+bzr150/commands.py 2011-12-20 15:17:57.000000000 +0000 +++ bzr-loom-2.2.0/commands.py 2012-02-26 16:47:05.000000000 +0000 @@ -179,34 +179,6 @@ loom.unlock() -class cmd_status(bzrlib.builtins.cmd_status): - """Show status of a loom.""" - - _original_command = None - - def run(self, show_ids=False, file_list=None, revision=None, short=False, - versioned=False, no_pending=False, verbose=None): - if file_list is None: - path = '.' - else: - path = file_list[0] - (loom, _) = bzrlib.branch.Branch.open_containing(path) - formats.require_loom_branch(loom) - loom.lock_read() - try: - print 'Current thread: %s' % loom.nick - finally: - loom.unlock() - - def run_argv_aliases(self, argv, alias_argv=None): - """Decorate bzr's cmd_status to show status for looms as well.""" - self._original_command().run_argv_aliases(argv, alias_argv) - try: - super(cmd_status, self).run_argv_aliases(list(argv), alias_argv) - except formats.NotALoom: - pass - - class cmd_switch(bzrlib.builtins.cmd_switch): """Set the branch of a checkout and update. diff -Nru bzr-loom-2.1+bzr150/debian/bzr-builddeb.conf bzr-loom-2.2.0/debian/bzr-builddeb.conf --- bzr-loom-2.1+bzr150/debian/bzr-builddeb.conf 2009-12-05 01:23:55.000000000 +0000 +++ bzr-loom-2.2.0/debian/bzr-builddeb.conf 2012-02-26 16:30:10.000000000 +0000 @@ -1,3 +1,6 @@ [BUILDDEB] export-upstream-revision = tag:bzr-loom-$UPSTREAM_VERSION upstream-branch = lp:bzr-loom + +[HOOKS] +merge-upstream = ./debian/update-deps.py diff -Nru bzr-loom-2.1+bzr150/debian/changelog bzr-loom-2.2.0/debian/changelog --- bzr-loom-2.1+bzr150/debian/changelog 2012-02-08 11:15:29.000000000 +0000 +++ bzr-loom-2.2.0/debian/changelog 2012-02-26 16:52:27.000000000 +0000 @@ -1,3 +1,18 @@ +bzr-loom (2.2.0-1) unstable; urgency=low + + * Add script for automatically updating dependencies on merge. + * New upstream release. + + Fixes compatibility with newer versions of bzr. LP: #924521 + + -- Jelmer Vernooij Sun, 26 Feb 2012 17:51:52 +0100 + +bzr-loom (2.1+bzr151-1) unstable; urgency=low + + * New upstream snapshot. + * Add autopkgtest tests. + + -- Jelmer Vernooij Sun, 26 Feb 2012 17:09:55 +0100 + bzr-loom (2.1+bzr150-1) unstable; urgency=low * New upstream snapshot. diff -Nru bzr-loom-2.1+bzr150/debian/control bzr-loom-2.2.0/debian/control --- bzr-loom-2.1+bzr150/debian/control 2011-05-06 01:30:15.000000000 +0000 +++ bzr-loom-2.2.0/debian/control 2012-02-26 16:51:52.000000000 +0000 @@ -5,9 +5,8 @@ Uploaders: Andrew Starr-Bochicchio , Jelmer Vernooij Homepage: https://launchpad.net/bzr-loom -Build-Depends: debhelper (>= 7.0.50~), - python (>= 2.6.6-3) -Build-Depends-Indep: bzr (>= 1.6), +Build-Depends: debhelper (>= 7.0.50~), python (>= 2.6.6-3), python-bzrlib (>= 2.4~) +Build-Depends-Indep: bzr, python-subunit, python-testtools, python-bzrlib.tests | bzr (<< 2.4.0~beta1-2) @@ -18,9 +17,8 @@ Package: bzr-loom Architecture: all -Depends: bzr (>= 1.6), - ${misc:Depends}, - ${python:Depends} +Depends: ${misc:Depends}, ${python:Depends}, python-bzrlib (>= 2.4~) +Recommends: bzr Enhances: bzr Description: Focused patch plugin support for Bazaar Loom is a Bazaar plugin to assist in developing focused patches. It adds a diff -Nru bzr-loom-2.1+bzr150/debian/tests/control bzr-loom-2.2.0/debian/tests/control --- bzr-loom-2.1+bzr150/debian/tests/control 1970-01-01 00:00:00.000000000 +0000 +++ bzr-loom-2.2.0/debian/tests/control 2012-02-24 16:30:12.000000000 +0000 @@ -0,0 +1,3 @@ +Tests: testsuite +Depends: bzr, python-bzrlib.tests +Features: no-build-needed diff -Nru bzr-loom-2.1+bzr150/debian/tests/testsuite bzr-loom-2.2.0/debian/tests/testsuite --- bzr-loom-2.1+bzr150/debian/tests/testsuite 1970-01-01 00:00:00.000000000 +0000 +++ bzr-loom-2.2.0/debian/tests/testsuite 2012-02-26 16:09:15.000000000 +0000 @@ -0,0 +1,4 @@ +#!/bin/sh +# Note that since the installed version of the package has to be tested, +# there is no mucking about with BZR_PLUGINS_AT. +bzr selftest -s bp.loom -v --parallel=fork diff -Nru bzr-loom-2.1+bzr150/debian/update-deps.py bzr-loom-2.2.0/debian/update-deps.py --- bzr-loom-2.1+bzr150/debian/update-deps.py 1970-01-01 00:00:00.000000000 +0000 +++ bzr-loom-2.2.0/debian/update-deps.py 2012-02-26 16:29:15.000000000 +0000 @@ -0,0 +1,47 @@ +#!/usr/bin/python +# Update dependencies based on version.py +# Copyright (C) 2012 Jelmer Vernooij +# Licensed under the GNU GPL, version 2 or later. + +from debian.deb822 import Deb822, PkgRelation +import os, sys +sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..")) + +from version import bzr_minimum_version, bzr_maximum_version + +def update_relation(l, pkg, kind, version): + found = False + for pr in l: + if len(pr) != 1: # only update simple build deps + continue + e = pr[0] + if e["name"] == pkg and e["version"] and e["version"][0] == kind: + e["version"] = (kind, version) + found = True + if not found: + l.append([{"version": (kind, version), "name": pkg, "arch": None}]) + +f = open('debian/control', 'r') + +source = Deb822(f) + +def update_deps(control, field): + bdi = PkgRelation.parse_relations(control[field]) + update_relation(bdi, "python-bzrlib", ">=", "%d.%d~" % bzr_minimum_version[:2]) + if bzr_maximum_version is not None: + update_relation(bdi, "python-bzrlib", "<<", "%d.%d.0" % (bzr_maximum_version[0], bzr_maximum_version[1]+1)) + control[field] = PkgRelation.str(bdi) + +update_deps(source, "Build-Depends") + +binary = Deb822(f) + +update_deps(binary, "Depends") + +f = open("debian/control", "w+") +try: + source.dump(f) + f.write("\n") + binary.dump(f) +finally: + f.close() diff -Nru bzr-loom-2.1+bzr150/debian/watch bzr-loom-2.2.0/debian/watch --- bzr-loom-2.1+bzr150/debian/watch 2010-08-02 19:53:40.000000000 +0000 +++ bzr-loom-2.2.0/debian/watch 2012-02-26 16:50:39.000000000 +0000 @@ -1,2 +1,2 @@ version=3 -https://launchpad.net/bzr-loom/+download http://launchpad.net/bzr-loom/.*/bzr-loom-(.*)\.tar\.gz +https://launchpad.net/bzr-loom/+download https://launchpad.net/bzr-loom/.*/bzr-loom-(.*)\.tar\.gz diff -Nru bzr-loom-2.1+bzr150/formats.py bzr-loom-2.2.0/formats.py --- bzr-loom-2.1+bzr150/formats.py 2011-12-20 15:17:57.000000000 +0000 +++ bzr-loom-2.2.0/formats.py 2012-02-26 16:47:05.000000000 +0000 @@ -44,25 +44,11 @@ } def register_formats(): - if getattr(_mod_branch, 'MetaDirBranchFormatFactory', None): - branch_formats = [_mod_branch.MetaDirBranchFormatFactory(format_string, - "bzrlib.plugins.loom.branch", format_class) for - (format_string, format_class) in _LOOM_FORMATS.iteritems()] - else: - # Compat for folk not running bleeding edge. Like me as I commit this. - import branch - branch_formats = [ - branch.BzrBranchLoomFormat1(), - branch.BzrBranchLoomFormat6(), - branch.BzrBranchLoomFormat7(), - ] - try: - format_registry = getattr(_mod_branch, 'format_registry') - register = format_registry.register - except AttributeError: # bzr < 2.4 - register = _mod_branch.BranchFormat.register_format - - map(register, branch_formats) + branch_formats = [_mod_branch.MetaDirBranchFormatFactory(format_string, + "bzrlib.plugins.loom.branch", format_class) for + (format_string, format_class) in _LOOM_FORMATS.iteritems()] + format_registry = getattr(_mod_branch, 'format_registry') + map(format_registry.register, branch_formats) def require_loom_branch(branch): diff -Nru bzr-loom-2.1+bzr150/__init__.py bzr-loom-2.2.0/__init__.py --- bzr-loom-2.1+bzr150/__init__.py 2011-12-20 15:17:57.000000000 +0000 +++ bzr-loom-2.2.0/__init__.py 2012-02-26 16:47:05.000000000 +0000 @@ -57,11 +57,18 @@ revision specifiers. """ -from bzrlib.plugins.loom.version import bzr_plugin_version as version_info +from bzrlib.plugins.loom.version import ( + bzr_plugin_version as version_info, + bzr_minimum_version, + ) + +import bzrlib +import bzrlib.api + +bzrlib.api.require_api(bzrlib, bzr_minimum_version) import bzrlib.builtins import bzrlib.commands -import bzrlib.revisionspec from bzrlib.plugins.loom import ( commands, @@ -83,7 +90,7 @@ bzrlib.commands.plugin_cmds.register_lazy('cmd_' + command, [], 'bzrlib.plugins.loom.commands') -# XXX: bzr fix needed: for status and switch, we have to register directly, not +# XXX: bzr fix needed: for switch, we have to register directly, not # lazily, because register_lazy does not stack in the same way register_command # does. if not hasattr(bzrlib.builtins, "cmd_switch"): @@ -93,34 +100,26 @@ commands.cmd_switch._original_command = bzrlib.commands.register_command( getattr(commands, 'cmd_switch'), True) -try: - from bzrlib.hooks import install_lazy_named_hook -except ImportError: # bzr < 2.4 - # no post_status hook. Fall back to overriding the status command - commands.cmd_status._original_command = bzrlib.commands.register_command( - commands.cmd_status, True) -else: - def show_loom_summary(params): - try: - formats.require_loom_branch(params.new_tree.branch) - except formats.NotALoom: - return - params.to_file.write('Current thread: %s\n' % - params.new_tree.branch.nick) - - install_lazy_named_hook('bzrlib.status', 'hooks', 'post_status', - show_loom_summary, 'loom status') - -revspec_registry = getattr(bzrlib.revisionspec, 'revspec_registry', None) -if revspec_registry is not None: - revspec_registry.register_lazy('thread:', 'bzrlib.plugins.loom.revspec', - 'RevisionSpecThread') - revspec_registry.register_lazy('below:', 'bzrlib.plugins.loom.revspec', - 'RevisionSpecBelow') -else: - import revspec - bzrlib.revisionspec.SPEC_TYPES.append(revspec.RevisionSpecThread) - bzrlib.revisionspec.SPEC_TYPES.append(revspec.RevisionSpecBelow) +from bzrlib.hooks import install_lazy_named_hook +def show_loom_summary(params): + branch = getattr(params.new_tree, "branch", None) + if branch is None: + # Not a working tree, ignore + return + try: + formats.require_loom_branch(branch) + except formats.NotALoom: + return + params.to_file.write('Current thread: %s\n' % branch.nick) + +install_lazy_named_hook('bzrlib.status', 'hooks', 'post_status', + show_loom_summary, 'loom status') + +from bzrlib.revisionspec import revspec_registry +revspec_registry.register_lazy('thread:', 'bzrlib.plugins.loom.revspec', + 'RevisionSpecThread') +revspec_registry.register_lazy('below:', 'bzrlib.plugins.loom.revspec', + 'RevisionSpecBelow') #register loom formats formats.register_formats() diff -Nru bzr-loom-2.1+bzr150/NEWS bzr-loom-2.2.0/NEWS --- bzr-loom-2.1+bzr150/NEWS 2010-12-16 01:32:05.000000000 +0000 +++ bzr-loom-2.2.0/NEWS 2012-02-26 16:47:05.000000000 +0000 @@ -4,15 +4,14 @@ .. contents:: -IN DEVELOPMENT -============== +2.2 +=== NOTES WHEN UPGRADING -------------------- -* bzr-loom requires bzr 2.2.0 (or very recent 2.2b releases) due to an API - change in bzr needed to fix branching and pulling of looms. On older versions - of bzr bzr-loom will still work for most operations but will fail when making +* bzr-loom requires bzr 2.4.0 due to API changes in bzr. On older versions of + bzr bzr-loom will still work for most operations but will fail when making new branches as part of a push or branch operation. (Robert Collins, #201613) CHANGES @@ -39,6 +38,12 @@ complete degree), reducing the overhead of having it installed. (Robert Collins) +* Loom now registers a ``bzr status`` hook rather than overriding the + ``bzr status`` command. (Jelmer Vernooij) + +* Loom now checks that a compatible version of bzr is being used. + (Jelmer Vernooij, #338214) + BUGFIXES -------- @@ -60,6 +65,9 @@ * The ``thread:`` revision specifier will no longer throw an attribute error when used on a normal branch. (Robert Collins, #231283) +* The ``bzr status`` hook for looms will no longer crash on non-workingtree + trees. (Jelmer Vernooij, #904095) + API BREAKS ---------- diff -Nru bzr-loom-2.1+bzr150/version.py bzr-loom-2.2.0/version.py --- bzr-loom-2.1+bzr150/version.py 2010-06-30 01:56:11.000000000 +0000 +++ bzr-loom-2.2.0/version.py 2012-02-26 16:47:05.000000000 +0000 @@ -23,6 +23,6 @@ 'bzr_maximum_version', ] -bzr_plugin_version = (2, 2, 1, 'dev', 0) -bzr_minimum_version = (2, 2, 0) +bzr_plugin_version = (2, 2, 0, 'final', 0) +bzr_minimum_version = (2, 4, 0) bzr_maximum_version = None