Rev 2525: Fix botched merge in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Tue Jun 12 18:28:42 BST 2007
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 2525
revision-id: pqm at pqm.ubuntu.com-20070612172839-mr0bjmyfguskc0tg
parent: pqm at pqm.ubuntu.com-20070612155157-j1juioefu5w946ph
parent: abentley at panoramicfeedback.com-20070612162423-vm2vm5kzla75m4a9
committer: Canonical.com Patch Queue Manager<pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2007-06-12 18:28:39 +0100
message:
Fix botched merge
added:
bzrlib/tests/branch_implementations/test_sprout.py test_sprout.py-20070521151739-b8t8p7axw1h966ws-1
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
README README-20050309040720-8f368abf9f346b9d
bzr bzr.py-20050313053754-5485f144c7006fa6
bzrlib/__init__.py __init__.py-20050309040759-33e65acf91bbcd5d
bzrlib/branch.py branch.py-20050309040759-e4baf4e0d046576e
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/symbol_versioning.py symbol_versioning.py-20060105104851-9ecf8af605d15a80
bzrlib/tests/blackbox/test_init.py test_init.py-20060309032856-a292116204d86eb7
bzrlib/tests/branch_implementations/__init__.py __init__.py-20060123013057-b12a52c3f361daf4
bzrlib/tests/branch_implementations/test_branch.py testbranch.py-20050711070244-121d632bc37d7253
------------------------------------------------------------
revno: 1551.2.49.1.40.1.22.1.42.1.31.1.39.1.17.1.22
merged: abentley at panoramicfeedback.com-20070612162423-vm2vm5kzla75m4a9
parent: abentley at panoramicfeedback.com-20070612162245-uotkgkgozzf5bp9w
committer: Aaron Bentley <abentley at panoramicfeedback.com>
branch nick: Aaron's mergeable stuff
timestamp: Tue 2007-06-12 12:24:23 -0400
message:
Redo test skip
------------------------------------------------------------
revno: 1551.2.49.1.40.1.22.1.42.1.31.1.39.1.17.1.21
merged: abentley at panoramicfeedback.com-20070612162245-uotkgkgozzf5bp9w
parent: abentley at panoramicfeedback.com-20070612145249-1izjczqhnfp71s9k
parent: abentley at panoramicfeedback.com-20070612162140-vea2zg1sbw6kckic
committer: Aaron Bentley <abentley at panoramicfeedback.com>
branch nick: Aaron's mergeable stuff
timestamp: Tue 2007-06-12 12:22:45 -0400
message:
Merge bzr.dev
------------------------------------------------------------
revno: 2524.1.1
merged: abentley at panoramicfeedback.com-20070612162140-vea2zg1sbw6kckic
parent: pqm at pqm.ubuntu.com-20070612155157-j1juioefu5w946ph
committer: Aaron Bentley <abentley at panoramicfeedback.com>
branch nick: bzr.dev
timestamp: Tue 2007-06-12 12:21:40 -0400
message:
Revert broken changes
=== added file 'bzrlib/tests/branch_implementations/test_sprout.py'
--- a/bzrlib/tests/branch_implementations/test_sprout.py 1970-01-01 00:00:00 +0000
+++ b/bzrlib/tests/branch_implementations/test_sprout.py 2007-06-12 16:21:40 +0000
@@ -0,0 +1,99 @@
+# Copyright (C) 2007 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
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+"""Tests for Branch.sprout()"""
+
+from bzrlib import (
+ remote,
+ revision as _mod_revision,
+ tests,
+ )
+from bzrlib.tests.branch_implementations import TestCaseWithBranch
+
+
+class TestSprout(TestCaseWithBranch):
+
+ def test_sprout_branch_nickname(self):
+ # test the nick name is reset always
+ raise tests.TestSkipped('XXX branch sprouting is not yet tested..')
+
+ def test_sprout_branch_parent(self):
+ source = self.make_branch('source')
+ target = source.bzrdir.sprout(self.get_url('target')).open_branch()
+ self.assertEqual(source.bzrdir.root_transport.base, target.get_parent())
+
+ def test_sprout_preserves_kind(self):
+ branch1 = self.make_branch('branch1')
+ target_repo = self.make_repository('branch2')
+ target_repo.fetch(branch1.repository)
+ branch2 = branch1.sprout(target_repo.bzrdir)
+ if isinstance(branch1, remote.RemoteBranch):
+ branch1._ensure_real()
+ target_class = branch1._real_branch.__class__
+ else:
+ target_class = branch1.__class__
+ self.assertIsInstance(branch2, target_class)
+
+ def test_sprout_partial(self):
+ # test sprouting with a prefix of the revision-history.
+ # also needs not-on-revision-history behaviour defined.
+ wt_a = self.make_branch_and_tree('a')
+ self.build_tree(['a/one'])
+ wt_a.add(['one'])
+ wt_a.commit('commit one', rev_id='1')
+ self.build_tree(['a/two'])
+ wt_a.add(['two'])
+ wt_a.commit('commit two', rev_id='2')
+ repo_b = self.make_repository('b')
+ repo_a = wt_a.branch.repository
+ repo_a.copy_content_into(repo_b)
+ br_b = wt_a.branch.sprout(repo_b.bzrdir, revision_id='1')
+ self.assertEqual('1', br_b.last_revision())
+
+ def test_sprout_partial_not_in_revision_history(self):
+ """We should be able to sprout from any revision in ancestry."""
+ wt = self.make_branch_and_tree('source')
+ self.build_tree(['source/a'])
+ wt.add('a')
+ wt.commit('rev1', rev_id='rev1')
+ wt.commit('rev2-alt', rev_id='rev2-alt')
+ wt.set_parent_ids(['rev1'])
+ wt.branch.set_last_revision_info(1, 'rev1')
+ wt.commit('rev2', rev_id='rev2')
+ wt.set_parent_ids(['rev2', 'rev2-alt'])
+ wt.commit('rev3', rev_id='rev3')
+
+ repo = self.make_repository('target')
+ repo.fetch(wt.branch.repository)
+ branch2 = wt.branch.sprout(repo.bzrdir, revision_id='rev2-alt')
+ self.assertEqual((2, 'rev2-alt'), branch2.last_revision_info())
+ self.assertEqual(['rev1', 'rev2-alt'], branch2.revision_history())
+
+ def test_sprout_from_any_repo_revision(self):
+ """We should be able to sprout from any revision."""
+ wt = self.make_branch_and_tree('source')
+ self.build_tree(['source/a'])
+ wt.add('a')
+ wt.commit('rev1a', rev_id='rev1a')
+ # simulated uncommit
+ wt.branch.set_last_revision_info(0, _mod_revision.NULL_REVISION)
+ wt.set_last_revision(None)
+ wt.revert([])
+ wt.commit('rev1b', rev_id='rev1b')
+ wt2 = wt.bzrdir.sprout('target',
+ revision_id='rev1a').open_workingtree()
+ self.assertEqual('rev1a', wt2.last_revision())
+ self.failUnlessExists('target/a')
=== modified file 'NEWS'
--- a/NEWS 2007-06-12 13:40:01 +0000
+++ b/NEWS 2007-06-12 16:21:40 +0000
@@ -1,5 +1,7 @@
IN DEVELOPMENT
+bzr 0.17rc1 2007-06-12
+
NOTES WHEN UPGRADING:
* The kind() and is_executable() APIs on the WorkingTree interface no
@@ -54,6 +56,9 @@
66 seconds to 32 seconds. For a small tree of 600 files, commit of a
small change is 33% faster. (Ian Clatworthy)
+ * New --create-prefix option to bzr init, like for push. (Daniel Watkins,
+ #56322)
+
BUGFIXES:
* ``bzr push`` should only connect to the remote location one time.
@@ -88,6 +93,10 @@
* Tests no longer fail when BZR_REMOTE_PATH is set in the environment.
(Daniel Watkins, #111958)
+ * ``bzr branch -r revid:foo`` can be used to branch any revision in
+ your repository. (Previously Branch6 only supported revisions in your
+ mainline). (John Arbash Meinel, #115343)
+
bzr 0.16 2007-05-07
BUGFIXES:
=== modified file 'README'
--- a/README 2007-06-12 13:40:01 +0000
+++ b/README 2007-06-12 16:21:40 +0000
@@ -1,5 +1,5 @@
==========================
-README for Bazaar 0.17-dev
+README for Bazaar 0.18-dev
==========================
Bazaar is a decentralized revision control system, designed to be easy
=== modified file 'bzr'
--- a/bzr 2007-06-12 13:40:01 +0000
+++ b/bzr 2007-06-12 16:21:40 +0000
@@ -88,7 +88,7 @@
import bzrlib.commands
import bzrlib.trace
-if bzrlib.version_info[:3] != (0, 17, 0):
+if bzrlib.version_info[:3] != (0, 18, 0):
sys.stderr.write("bzr: WARNING: bzrlib version doesn't match the bzr program.\n"
"This may indicate an installation problem.\n"
"bzrlib from %s is version %r\n"
=== modified file 'bzrlib/__init__.py'
--- a/bzrlib/__init__.py 2007-06-12 13:40:01 +0000
+++ b/bzrlib/__init__.py 2007-06-12 16:21:40 +0000
@@ -35,7 +35,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 = (0, 17, 0, 'dev', 0)
+version_info = (0, 18, 0, 'dev', 0)
if version_info[3] == 'final':
version_string = '%d.%d.%d' % version_info[:3]
=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py 2007-06-12 13:40:01 +0000
+++ b/bzrlib/branch.py 2007-06-12 16:21:40 +0000
@@ -2077,7 +2077,14 @@
if revision_id is None:
revno, revision_id = self.last_revision_info()
else:
- revno = self.revision_id_to_revno(revision_id)
+ # To figure out the revno for a random revision, we need to build
+ # the revision history, and count its length.
+ # We don't care about the order, just how long it is.
+ # Alternatively, we could start at the current location, and count
+ # backwards. But there is no guarantee that we will find it since
+ # it may be a merged revision.
+ revno = len(list(self.repository.iter_reverse_revision_history(
+ revision_id)))
destination.set_last_revision_info(revno, revision_id)
def _make_tags(self):
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py 2007-06-12 13:40:01 +0000
+++ b/bzrlib/builtins.py 2007-06-12 16:21:40 +0000
@@ -755,27 +755,7 @@
" leading parent directories."
% location)
- cur_transport = to_transport
- needed = [cur_transport]
- # Recurse upwards until we can create a directory successfully
- while True:
- new_transport = cur_transport.clone('..')
- if new_transport.base == cur_transport.base:
- raise errors.BzrCommandError("Failed to create path"
- " prefix for %s."
- % location)
- try:
- new_transport.mkdir('.')
- except errors.NoSuchFile:
- needed.append(new_transport)
- cur_transport = new_transport
- else:
- break
-
- # Now we only need to create child directories
- while needed:
- cur_transport = needed.pop()
- cur_transport.ensure_base()
+ _create_prefix(to_transport)
# Now the target directory exists, but doesn't have a .bzr
# directory. So we need to create it, along with any work to create
@@ -1270,6 +1250,9 @@
_see_also = ['init-repo', 'branch', 'checkout']
takes_args = ['location?']
takes_options = [
+ Option('create-prefix',
+ help='Create the path leading up to the branch '
+ 'if it does not already exist'),
RegistryOption('format',
help='Specify a format for this branch. '
'See "help formats".',
@@ -1282,7 +1265,8 @@
help='Never change revnos or the existing log.'
' Append revisions to it only.')
]
- def run(self, location=None, format=None, append_revisions_only=False):
+ def run(self, location=None, format=None, append_revisions_only=False,
+ create_prefix=False):
if format is None:
format = bzrdir.format_registry.make_bzrdir('default')
if location is None:
@@ -1295,8 +1279,16 @@
# Just using os.mkdir, since I don't
# believe that we want to create a bunch of
# locations if the user supplies an extended path
- # TODO: create-prefix
- to_transport.ensure_base()
+ try:
+ to_transport.ensure_base()
+ except errors.NoSuchFile:
+ if not create_prefix:
+ raise errors.BzrCommandError("Parent directory of %s"
+ " does not exist."
+ "\nYou may supply --create-prefix to create all"
+ " leading parent directories."
+ % location)
+ _create_prefix(to_transport)
try:
existing_bzrdir = bzrdir.BzrDir.open(location)
@@ -3774,6 +3766,28 @@
return conflicts
+def _create_prefix(cur_transport):
+ needed = [cur_transport]
+ # Recurse upwards until we can create a directory successfully
+ while True:
+ new_transport = cur_transport.clone('..')
+ if new_transport.base == cur_transport.base:
+ raise errors.BzrCommandError("Failed to create path"
+ " prefix for %s."
+ % location)
+ try:
+ new_transport.mkdir('.')
+ except errors.NoSuchFile:
+ needed.append(new_transport)
+ cur_transport = new_transport
+ else:
+ break
+
+ # Now we only need to create child directories
+ while needed:
+ cur_transport = needed.pop()
+ cur_transport.ensure_base()
+
# Compatibility
merge = _merge_helper
=== modified file 'bzrlib/symbol_versioning.py'
--- a/bzrlib/symbol_versioning.py 2007-06-12 13:40:01 +0000
+++ b/bzrlib/symbol_versioning.py 2007-06-12 16:21:40 +0000
@@ -36,6 +36,7 @@
'zero_fifteen',
'zero_sixteen',
'zero_seventeen',
+ 'zero_eighteen',
]
from warnings import warn
@@ -53,6 +54,7 @@
zero_fifteen = "%s was deprecated in version 0.15."
zero_sixteen = "%s was deprecated in version 0.16."
zero_seventeen = "%s was deprecated in version 0.17."
+zero_eighteen = "%s was deprecated in version 0.18."
def set_warning_method(method):
=== modified file 'bzrlib/tests/blackbox/test_init.py'
--- a/bzrlib/tests/blackbox/test_init.py 2007-06-12 13:40:01 +0000
+++ b/bzrlib/tests/blackbox/test_init.py 2007-06-12 16:21:40 +0000
@@ -73,11 +73,10 @@
self.assertEqual('', err)
WorkingTree.open('subdir1')
+ self.run_bzr_error(['Parent directory of subdir2/nothere does not exist'],
+ 'init', 'subdir2/nothere')
out, err = self.run_bzr('init', 'subdir2/nothere', retcode=3)
self.assertEqual('', out)
- self.assertContainsRe(err,
- r'^bzr: ERROR: No such file: .*'
- '\[Err(no|or) 2\]')
os.mkdir('subdir2')
out, err = self.run_bzr('init', 'subdir2')
@@ -120,6 +119,24 @@
# try to init unicode dir
self.run_bzr('init', u'mu-\xb5')
+ def create_simple_tree(self):
+ tree = self.make_branch_and_tree('tree')
+ self.build_tree(['tree/a'])
+ tree.add(['a'], ['a-id'])
+ tree.commit('one', rev_id='r1')
+ return tree
+
+ def test_init_create_prefix(self):
+ """'bzr init --create-prefix; will create leading directories."""
+ tree = self.create_simple_tree()
+
+ self.run_bzr_error(['Parent directory of ../new/tree does not exist'],
+ 'init', '../new/tree',
+ working_dir='tree')
+ self.run_bzr('init', '../new/tree', '--create-prefix',
+ working_dir='tree')
+ self.failUnlessExists('new/tree/.bzr')
+
class TestSFTPInit(TestCaseWithSFTPServer):
=== modified file 'bzrlib/tests/branch_implementations/__init__.py'
--- a/bzrlib/tests/branch_implementations/__init__.py 2007-06-12 13:40:01 +0000
+++ b/bzrlib/tests/branch_implementations/__init__.py 2007-06-12 16:21:40 +0000
@@ -119,6 +119,7 @@
'bzrlib.tests.branch_implementations.test_push',
'bzrlib.tests.branch_implementations.test_revision_history',
'bzrlib.tests.branch_implementations.test_revision_id_to_revno',
+ 'bzrlib.tests.branch_implementations.test_sprout',
'bzrlib.tests.branch_implementations.test_tags',
'bzrlib.tests.branch_implementations.test_uncommit',
'bzrlib.tests.branch_implementations.test_update',
=== modified file 'bzrlib/tests/branch_implementations/test_branch.py'
--- a/bzrlib/tests/branch_implementations/test_branch.py 2007-06-12 13:40:01 +0000
+++ b/bzrlib/tests/branch_implementations/test_branch.py 2007-06-12 16:21:40 +0000
@@ -167,22 +167,6 @@
br_b = branch.clone(repo_b.bzrdir, revision_id='1')
self.assertEqual('1', br_b.last_revision())
- def test_sprout_partial(self):
- # test sprouting with a prefix of the revision-history.
- # also needs not-on-revision-history behaviour defined.
- wt_a = self.make_branch_and_tree('a')
- self.build_tree(['a/one'])
- wt_a.add(['one'])
- wt_a.commit('commit one', rev_id='1')
- self.build_tree(['a/two'])
- wt_a.add(['two'])
- wt_a.commit('commit two', rev_id='2')
- repo_b = self.make_repository('b')
- repo_a = wt_a.branch.repository
- repo_a.copy_content_into(repo_b)
- br_b = wt_a.branch.sprout(repo_b.bzrdir, revision_id='1')
- self.assertEqual('1', br_b.last_revision())
-
def get_parented_branch(self):
wt_a = self.make_branch_and_tree('a')
self.build_tree(['a/one'])
@@ -214,15 +198,6 @@
branch_d = branch_b.clone(repo_d.bzrdir)
self.assertEqual(random_parent, branch_d.get_parent())
- def test_sprout_branch_nickname(self):
- # test the nick name is reset always
- raise TestSkipped('XXX branch sprouting is not yet tested..')
-
- def test_sprout_branch_parent(self):
- source = self.make_branch('source')
- target = source.bzrdir.sprout(self.get_url('target')).open_branch()
- self.assertEqual(source.bzrdir.root_transport.base, target.get_parent())
-
def test_submit_branch(self):
"""Submit location can be queried and set"""
branch = self.make_branch('branch')
More information about the bazaar-commits
mailing list