Rev 3164: Make merge --uncommitted work with merge-type weave/lca (abentley) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Thu Jan 3 23:18:28 GMT 2008
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 3164
revision-id:pqm at pqm.ubuntu.com-20080103231814-wymg8td870lqfzkv
parent: pqm at pqm.ubuntu.com-20080103220910-yajpwrwzbuyafqcg
parent: abentley at panoramicfeedback.com-20080103221635-i0f4co2btuyjnqbf
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2008-01-03 23:18:14 +0000
message:
Make merge --uncommitted work with merge-type weave/lca (abentley)
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/merge.py merge.py-20050513021216-953b65a438527106
bzrlib/tests/test_merge.py testmerge.py-20050905070950-c1b5aa49ff911024
------------------------------------------------------------
revno: 3146.5.4
revision-id:abentley at panoramicfeedback.com-20080103221635-i0f4co2btuyjnqbf
parent: aaron.bentley at utoronto.ca-20071230203245-hq8euyd3bu9qshck
parent: pqm at pqm.ubuntu.com-20080103103822-fj2udnviy9ilfsst
committer: Aaron Bentley <abentley at panoramicfeedback.com>
branch nick: test-merge-uncommitted
timestamp: Thu 2008-01-03 17:16:35 -0500
message:
Merge bzr.dev
added:
bzrlib/tests/test_http_implementations.py test_http_implementa-20071218210003-65nh81gglcfvurw6-1
doc/developers/lca-merge.txt lcamerge.txt-20080103061803-9isydn4ivgwrvorw-1
doc/en/tutorials/using_bazaar_with_launchpad.txt using_bazaar_with_lp-20071211073140-7msh8uf9a9h4y9hb-1
renamed:
bzrlib/tests/HTTPTestUtil.py => bzrlib/tests/http_utils.py HTTPTestUtil.py-20050914180604-247d3aafb7a43343
bzrlib/tests/HttpServer.py => bzrlib/tests/http_server.py httpserver.py-20061012142527-m1yxdj1xazsf8d7s-1
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/bugtracker.py bugtracker.py-20070410073305-vu1vu1qosjurg8kb-1
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/diff.py diff.py-20050309040759-26944fbbf2ebbf36
bzrlib/errors.py errors.py-20050309040759-20512168c4e14fbd
bzrlib/help_topics/__init__.py help_topics.py-20060920210027-rnim90q9e0bwxvy4-1
bzrlib/merge.py merge.py-20050513021216-953b65a438527106
bzrlib/option.py option.py-20051014052914-661fb36e76e7362f
bzrlib/osutils.py osutils.py-20050309040759-eeaff12fbf77ac86
bzrlib/repofmt/knitrepo.py knitrepo.py-20070206081537-pyy4a00xdas0j4pf-1
bzrlib/repofmt/pack_repo.py pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
bzrlib/repository.py rev_storage.py-20051111201905-119e9401e46257e3
bzrlib/tests/__init__.py selftest.py-20050531073622-8d0e3c8845c97a64
bzrlib/tests/blackbox/test_annotate.py testannotate.py-20051013044000-457f44801bfa9d39
bzrlib/tests/blackbox/test_ignore.py test_ignore.py-20060703063225-4tm8dc2pa7wwg2t3-1
bzrlib/tests/blackbox/test_log.py test_log.py-20060112090212-78f6ea560c868e24
bzrlib/tests/blackbox/test_merge.py test_merge.py-20060323225809-9bc0459c19917f41
bzrlib/tests/blackbox/test_selftest.py test_selftest.py-20060123024542-01c5f1bbcb596d78
bzrlib/tests/blackbox/test_too_much.py blackbox.py-20050620052131-a7370d756399f615
bzrlib/tests/branch_implementations/test_branch.py testbranch.py-20050711070244-121d632bc37d7253
bzrlib/tests/branch_implementations/test_http.py test_http.py-20060731224648-2eef7ae5yja95rya-1
bzrlib/tests/branch_implementations/test_parent.py test_parent.py-20050830052751-5e62766623c32222
bzrlib/tests/repository_implementations/test_repository.py test_repository.py-20060131092128-ad07f494f5c9d26c
bzrlib/tests/test_bzrdir.py test_bzrdir.py-20060131065654-deba40eef51cf220
bzrlib/tests/test_diff.py testdiff.py-20050727164403-d1a3496ebb12e339
bzrlib/tests/test_fetch.py testfetch.py-20050825090644-f73e07e7dfb1765a
bzrlib/tests/test_http.py testhttp.py-20051018020158-b2eef6e867c514d9
bzrlib/tests/test_merge.py testmerge.py-20050905070950-c1b5aa49ff911024
bzrlib/tests/test_osutils.py test_osutils.py-20051201224856-e48ee24c12182989
bzrlib/tests/test_selftest.py test_selftest.py-20051202044319-c110a115d8c0456a
bzrlib/tests/test_sftp_transport.py testsftp.py-20051027032739-247570325fec7e7e
bzrlib/tests/test_smart_transport.py test_ssh_transport.py-20060608202016-c25gvf1ob7ypbus6-2
bzrlib/tests/test_transport.py testtransport.py-20050718175618-e5cdb99f4555ddce
bzrlib/tests/test_transport_implementations.py test_transport_implementations.py-20051227111451-f97c5c7d5c49fce7
bzrlib/tests/test_urlutils.py test_urlutils.py-20060502192900-46b1f9579987cf9c
bzrlib/tests/test_versionedfile.py test_versionedfile.py-20060222045249-db45c9ed14a1c2e5
bzrlib/trace.py trace.py-20050309040759-c8ed824bdcd4748a
bzrlib/transport/http/_pycurl.py pycurlhttp.py-20060110060940-4e2a705911af77a6
bzrlib/transport/http/_urllib.py _urlgrabber.py-20060113083826-0bbf7d992fbf090c
bzrlib/transport/http/_urllib2_wrappers.py _urllib2_wrappers.py-20060913231729-ha9ugi48ktx481ao-1
bzrlib/tree.py tree.py-20050309040759-9d5f2496be663e77
bzrlib/urlutils.py urlutils.py-20060502195429-e8a161ecf8fac004
bzrlib/versionedfile.py versionedfile.py-20060222045106-5039c71ee3b65490
doc/developers/index.txt index.txt-20070508041241-qznziunkg0nffhiw-1
doc/en/user-guide/bug_trackers.txt bug_trackers.txt-20070713223459-khxdlcudraii95uv-1
doc/index.txt index.txt-20070813101924-07gd9i9d2jt124bf-1
bzrlib/tests/http_utils.py HTTPTestUtil.py-20050914180604-247d3aafb7a43343
bzrlib/tests/http_server.py httpserver.py-20061012142527-m1yxdj1xazsf8d7s-1
------------------------------------------------------------
revno: 3146.5.3
revision-id:aaron.bentley at utoronto.ca-20071230203245-hq8euyd3bu9qshck
parent: aaron.bentley at utoronto.ca-20071230200959-21ms4szwf591q3cv
committer: Aaron Bentley <aaron.bentley at utoronto.ca>
branch nick: test-merge-uncommitted
timestamp: Sun 2007-12-30 15:32:45 -0500
message:
Avoid retrieving revision graph twice
modified:
bzrlib/merge.py merge.py-20050513021216-953b65a438527106
------------------------------------------------------------
revno: 3146.5.2
revision-id:aaron.bentley at utoronto.ca-20071230200959-21ms4szwf591q3cv
parent: aaron.bentley at utoronto.ca-20071230200825-fghiumyk7wux7olv
committer: Aaron Bentley <aaron.bentley at utoronto.ca>
branch nick: test-merge-uncommitted
timestamp: Sun 2007-12-30 15:09:59 -0500
message:
Add NEWS entry
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
------------------------------------------------------------
revno: 3146.5.1
revision-id:aaron.bentley at utoronto.ca-20071230200825-fghiumyk7wux7olv
parent: pqm at pqm.ubuntu.com-20071228175832-9kboqtkemnuzzlab
committer: Aaron Bentley <aaron.bentley at utoronto.ca>
branch nick: test-merge-uncommitted
timestamp: Sun 2007-12-30 15:08:25 -0500
message:
Make merge --uncommitted work with merge-type weave
modified:
bzrlib/merge.py merge.py-20050513021216-953b65a438527106
bzrlib/tests/test_merge.py testmerge.py-20050905070950-c1b5aa49ff911024
=== modified file 'NEWS'
--- a/NEWS 2008-01-03 18:09:01 +0000
+++ b/NEWS 2008-01-03 23:18:14 +0000
@@ -93,6 +93,8 @@
correctly, instead of erroring or attributing incorrect parents to ghosts.
(Aaron Bentley)
+ * ``merge --weave --uncommitted`` now works. (Aaron Bentley)
+
* pycurl authentication handling was broken and incomplete. Fix handling of
user:pass embedded in the urls.
(Vincent Ladeuil, #177643)
=== modified file 'bzrlib/merge.py'
--- a/bzrlib/merge.py 2008-01-03 06:38:53 +0000
+++ b/bzrlib/merge.py 2008-01-03 22:16:35 +0000
@@ -65,7 +65,7 @@
class Merger(object):
def __init__(self, this_branch, other_tree=None, base_tree=None,
this_tree=None, pb=DummyProgress(), change_reporter=None,
- recurse='down'):
+ recurse='down', revision_graph=None):
object.__init__(self)
assert this_tree is not None, "this_tree is required"
self.this_branch = this_branch
@@ -89,6 +89,38 @@
self.recurse = recurse
self.change_reporter = change_reporter
self._cached_trees = {}
+ self._revision_graph = revision_graph
+ self._base_is_ancestor = None
+ self._base_is_other_ancestor = None
+
+ @property
+ def revision_graph(self):
+ if self._revision_graph is None:
+ self._revision_graph = self.this_branch.repository.get_graph()
+ return self._revision_graph
+
+ def _set_base_is_ancestor(self, value):
+ self._base_is_ancestor = value
+
+ def _get_base_is_ancestor(self):
+ if self._base_is_ancestor is None:
+ self._base_is_ancestor = self.revision_graph.is_ancestor(
+ self.base_rev_id, self.this_basis)
+ return self._base_is_ancestor
+
+ base_is_ancestor = property(_get_base_is_ancestor, _set_base_is_ancestor)
+
+ def _set_base_is_other_ancestor(self, value):
+ self._base_is_other_ancestor = value
+
+ def _get_base_is_other_ancestor(self):
+ if self._base_is_other_ancestor is None:
+ self.base_is_other_ancestor = self.revision_graph.is_ancestor(
+ self.base_rev_id, self.other_basis)
+ return self._base_is_other_ancestor
+
+ base_is_other_ancestor = property(_get_base_is_other_ancestor,
+ _set_base_is_other_ancestor)
@staticmethod
def from_uncommitted(tree, other_tree, pb):
@@ -102,6 +134,7 @@
pb)
merger.base_rev_id = merger.base_tree.get_revision_id()
merger.other_rev_id = None
+ merger.other_basis = merger.base_rev_id
return merger
@classmethod
@@ -115,19 +148,21 @@
mergeable.install_revisions(tree.branch.repository)
base_revision_id, other_revision_id, verified =\
mergeable.get_merge_request(tree.branch.repository)
+ revision_graph = tree.branch.repository.get_graph()
if (base_revision_id != _mod_revision.NULL_REVISION and
- tree.branch.repository.get_graph().is_ancestor(
+ revision_graph.is_ancestor(
base_revision_id, tree.branch.last_revision())):
base_revision_id = None
else:
warning('Performing cherrypick')
merger = klass.from_revision_ids(pb, tree, other_revision_id,
- base_revision_id)
+ base_revision_id, revision_graph=
+ revision_graph)
return merger, verified
@staticmethod
def from_revision_ids(pb, this, other, base=None, other_branch=None,
- base_branch=None):
+ base_branch=None, revision_graph=None):
"""Return a Merger for revision-ids.
:param tree: The tree to merge changes into
@@ -140,7 +175,8 @@
not supplied, other_branch or this.branch will be used.
:param pb: A progress indicator
"""
- merger = Merger(this.branch, this_tree=this, pb=pb)
+ merger = Merger(this.branch, this_tree=this, pb=pb,
+ revision_graph=revision_graph)
if other_branch is None:
other_branch = this.branch
merger.set_other_revision(other, other_branch)
@@ -299,26 +335,19 @@
self.base_branch = branch
self._maybe_fetch(branch, self.this_branch, revision_id)
self.base_tree = self.revision_tree(revision_id)
- graph = self.this_branch.repository.get_graph()
- self.base_is_ancestor = graph.is_ancestor(self.base_rev_id,
- self.this_basis)
- self.base_is_other_ancestor = graph.is_ancestor(self.base_rev_id,
- self.other_basis)
def _maybe_fetch(self, source, target, revision_id):
if not source.repository.has_same_location(target.repository):
target.fetch(source, revision_id)
def find_base(self):
- this_repo = self.this_branch.repository
- graph = this_repo.get_graph()
revisions = [ensure_null(self.this_basis),
ensure_null(self.other_basis)]
if NULL_REVISION in revisions:
self.base_rev_id = NULL_REVISION
else:
- self.base_rev_id, steps = graph.find_unique_lca(revisions[0],
- revisions[1], count_steps=True)
+ self.base_rev_id, steps = self.revision_graph.find_unique_lca(
+ revisions[0], revisions[1], count_steps=True)
if self.base_rev_id == NULL_REVISION:
raise UnrelatedBranches()
if steps > 1:
@@ -346,11 +375,6 @@
self.base_rev_id = _mod_revision.ensure_null(
base_branch.get_rev_id(base_revision[1]))
self._maybe_fetch(base_branch, self.this_branch, self.base_rev_id)
- graph = self.this_branch.repository.get_graph()
- self.base_is_ancestor = graph.is_ancestor(self.base_rev_id,
- self.this_basis)
- self.base_is_other_ancestor = graph.is_ancestor(self.base_rev_id,
- self.other_basis)
def do_merge(self):
kwargs = {'working_tree':self.this_tree, 'this_tree': self.this_tree,
=== modified file 'bzrlib/tests/test_merge.py'
--- a/bzrlib/tests/test_merge.py 2008-01-03 19:12:30 +0000
+++ b/bzrlib/tests/test_merge.py 2008-01-03 23:18:14 +0000
@@ -290,6 +290,21 @@
merger.do_merge()
self.assertEqual(tree_a.get_parent_ids(), [tree_b.last_revision()])
+ def test_merge_uncommitted_otherbasis_ancestor_of_thisbasis_weave(self):
+ tree_a = self.make_branch_and_tree('a')
+ self.build_tree(['a/file_1', 'a/file_2'])
+ tree_a.add(['file_1'])
+ tree_a.commit('commit 1')
+ tree_a.add(['file_2'])
+ tree_a.commit('commit 2')
+ tree_b = tree_a.bzrdir.sprout('b').open_workingtree()
+ tree_b.rename_one('file_1', 'renamed')
+ merger = _mod_merge.Merger.from_uncommitted(tree_a, tree_b,
+ progress.DummyProgress())
+ merger.merge_type = _mod_merge.WeaveMerger
+ merger.do_merge()
+ self.assertEqual(tree_a.get_parent_ids(), [tree_b.last_revision()])
+
def prepare_cherrypick(self):
"""Prepare a pair of trees for cherrypicking tests.
More information about the bazaar-commits
mailing list