Merge lp:~jelmer/bzr-loom/no-get-ancestry into lp:bzr-loom

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Robert Collins
Approved revision: 138
Merged at revision: 138
Proposed branch: lp:~jelmer/bzr-loom/no-get-ancestry
Merge into: lp:bzr-loom
Diff against target: 36 lines (+5/-14)
1 file modified
branch.py (+5/-14)
To merge this branch: bzr merge lp:~jelmer/bzr-loom/no-get-ancestry
Reviewer Review Type Date Requested Status
Robert Collins (community) Approve
Review via email: mp+65715@code.launchpad.net

Description of the change

Avoid the Repository.get_ancestry() call that is now in upstream bzr.

To post a comment you must log in.
Revision history for this message
Robert Collins (lifeless) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'branch.py'
2--- branch.py 2011-06-13 11:07:00 +0000
3+++ branch.py 2011-06-23 19:26:28 +0000
4@@ -639,17 +639,8 @@
5 fetch_spec = self.build_fetch_spec(stop_revision)
6 self.target.repository.fetch(self.source.repository,
7 fetch_spec=fetch_spec)
8- if not overwrite:
9- new_rev_ancestry = self.source.repository.get_ancestry(
10- new_rev)
11- last_rev = self.target.last_revision()
12- # get_ancestry returns None for NULL_REVISION currently.
13- if last_rev == NULL_REVISION:
14- last_rev = None
15- if last_rev not in new_rev_ancestry:
16- raise bzrlib.errors.DivergedBranches(
17- self.target, self.source)
18- self.target.generate_revision_history(new_rev)
19+ self.target.generate_revision_history(new_rev, self.target.last_revision(),
20+ self.source)
21 result.tag_conflicts = self.source.tags.merge_to(self.target.tags)
22 # get the final result object details
23 self.do_hooks(result, run_hooks)
24@@ -688,9 +679,9 @@
25 if not overwrite:
26 # is the loom compatible?
27 if len(my_state.get_parents()) > 0:
28- source_ancestry = self.source.repository.get_ancestry(
29- source_loom_rev)
30- if my_state.get_parents()[0] not in source_ancestry:
31+ graph = self.source.repository.get_graph()
32+ if not graph.is_ancestor(my_state.get_parents()[0],
33+ source_loom_rev):
34 raise bzrlib.errors.DivergedBranches(
35 self.target, self.source)
36 # fetch the loom content

Subscribers

People subscribed via source and target branches