Rev 3109: Merge directives now fetch bundle prerequisites from submit branch in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Fri Dec 14 05:44:17 GMT 2007
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 3109
revision-id:pqm at pqm.ubuntu.com-20071214054408-5xnavnb30uddiqxh
parent: pqm at pqm.ubuntu.com-20071213191437-c42q84tx9pf0e2tk
parent: aaron.bentley at utoronto.ca-20071214044458-ce124oijzzqwj7a6
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2007-12-14 05:44:08 +0000
message:
Merge directives now fetch bundle prerequisites from submit branch
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/merge_directive.py merge_directive.py-20070228184838-ja62280spt1g7f4x-1
bzrlib/tests/test_merge_directive.py test_merge_directive-20070228184838-ja62280spt1g7f4x-2
------------------------------------------------------------
revno: 1551.2.49.1.40.1.22.1.42.1.31.1.39.1.17.1.77.1.3.1.20.1.20
revision-id:aaron.bentley at utoronto.ca-20071214044458-ce124oijzzqwj7a6
parent: abentley at panoramicfeedback.com-20071210152039-ukhnolt0imqcrmyd
committer: Aaron Bentley <aaron.bentley at utoronto.ca>
branch nick: Aaron's mergeable stuff
timestamp: Thu 2007-12-13 23:44:58 -0500
message:
Updates from review
modified:
bzrlib/merge_directive.py merge_directive.py-20070228184838-ja62280spt1g7f4x-1
------------------------------------------------------------
revno: 1551.2.49.1.40.1.22.1.42.1.31.1.39.1.17.1.77.1.3.1.20.1.19
revision-id:abentley at panoramicfeedback.com-20071210152039-ukhnolt0imqcrmyd
parent: abentley at panoramicfeedback.com-20071206180943-0wpbj8hqqe376rjx
committer: Aaron Bentley <abentley at panoramicfeedback.com>
branch nick: Aaron's mergeable stuff
timestamp: Mon 2007-12-10 10:20:39 -0500
message:
Merge directives can now fetch prerequisites from the target branch
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/merge_directive.py merge_directive.py-20070228184838-ja62280spt1g7f4x-1
bzrlib/tests/test_merge_directive.py test_merge_directive-20070228184838-ja62280spt1g7f4x-2
=== modified file 'NEWS'
--- a/NEWS 2007-12-12 16:14:01 +0000
+++ b/NEWS 2007-12-14 05:44:08 +0000
@@ -53,6 +53,9 @@
* ``bzr commit`` now doesn't print the revision number twice. (Matt
Nordhoff, #172612)
+ * Merge directives now fetch prerequisites from the target branch if
+ needed. (Aaron Bentley)
+
* New configuration option ``bugtracker_<tracker_abbrevation>_url`` to
define locations of bug trackers that are not directly supported by
bzr or a plugin. The URL will be treated as a template and ``{id}``
=== modified file 'bzrlib/merge_directive.py'
--- a/bzrlib/merge_directive.py 2007-08-15 20:49:22 +0000
+++ b/bzrlib/merge_directive.py 2007-12-14 04:44:58 +0000
@@ -190,7 +190,32 @@
StringIO(self.get_raw_bundle()))
# We don't use the bundle's target revision, because
# MergeDirective.revision_id is authoritative.
- info.install_revisions(target_repo, stream_input=False)
+ try:
+ info.install_revisions(target_repo, stream_input=False)
+ except errors.RevisionNotPresent:
+ # At least one dependency isn't present. Try installing
+ # missing revisions from the submit branch
+ submit_branch = _mod_branch.Branch.open(self.target_branch)
+ missing_revisions = []
+ bundle_revisions = set(r.revision_id for r in
+ info.real_revisions)
+ for revision in info.real_revisions:
+ for parent_id in revision.parent_ids:
+ if (parent_id not in bundle_revisions and
+ not target_repo.has_revision(parent_id)):
+ missing_revisions.append(parent_id)
+ # reverse missing revisions to try to get heads first
+ unique_missing = []
+ unique_missing_set = set()
+ for revision in reversed(missing_revisions):
+ if revision in unique_missing_set:
+ continue
+ unique_missing.append(revision)
+ unique_missing_set.add(revision)
+ for missing_revision in unique_missing:
+ target_repo.fetch(submit_branch.repository,
+ missing_revision)
+ info.install_revisions(target_repo, stream_input=False)
else:
source_branch = _mod_branch.Branch.open(self.source_branch)
target_repo.fetch(source_branch.repository, self.revision_id)
=== modified file 'bzrlib/tests/test_merge_directive.py'
--- a/bzrlib/tests/test_merge_directive.py 2007-11-22 00:05:12 +0000
+++ b/bzrlib/tests/test_merge_directive.py 2007-12-10 15:20:39 +0000
@@ -553,6 +553,15 @@
revision = md.install_revisions(tree_b.branch.repository)
self.assertEqual('rev2a', revision)
+ def test_use_submit_for_missing_dependency(self):
+ tree_a, tree_b, branch_c = self.make_trees()
+ branch_c.pull(tree_a.branch)
+ self.build_tree_contents([('tree_a/file', 'content_q\ncontent_r\n')])
+ tree_a.commit('rev3a', rev_id='rev3a')
+ md = self.from_objects(tree_a.branch.repository, 'rev3a', 500, 36,
+ branch_c.base, base_revision_id='rev2a')
+ revision = md.install_revisions(tree_b.branch.repository)
+
class TestMergeDirective1Branch(tests.TestCaseWithTransport,
TestMergeDirectiveBranch):
@@ -564,7 +573,10 @@
def from_objects(self, repository, revision_id, time, timezone,
target_branch, patch_type='bundle', local_target_branch=None,
- public_branch=None, message=None):
+ public_branch=None, message=None, base_revision_id=None):
+ if base_revision_id is not None:
+ raise tests.TestNotApplicable('This format does not support'
+ ' explicit bases.')
repository.lock_write()
try:
return merge_directive.MergeDirective.from_objects( repository,
More information about the bazaar-commits
mailing list