Merge lp:~spiv/bzr-loom/bzr-2.4-compat into lp:bzr-loom

Proposed by Andrew Bennetts
Status: Merged
Approved by: John A Meinel
Approved revision: 130
Merged at revision: 131
Proposed branch: lp:~spiv/bzr-loom/bzr-2.4-compat
Merge into: lp:bzr-loom
Diff against target: 153 lines (+44/-17)
1 file modified
branch.py (+44/-17)
To merge this branch: bzr merge lp:~spiv/bzr-loom/bzr-2.4-compat
Reviewer Review Type Date Requested Status
John A Meinel Approve
Review via email: mp+51714@code.launchpad.net

Description of the change

This branch depends on <https://code.launchpad.net/~spiv/bzr/branch-revs-to-fetch/+merge/51710>.

This fixes all the test failures in bzr-loom when run with lp:bzr.

Some points of interest, and maybe concern:

 * it now does a single fetch, rather than one fetch per thread. Yay!
 * for simplicity I haven't tried to maintain backwards compatibility with bzr 2.3. Should I?
 * I also implemented pushing/pulling etc of tags for looms. The model is simple: there's a global tags dict for the whole loom, independent of threads. That is, tag semantics are basically unaffected by 'bzr loomify'. This is part of this patch because it was the easiest path to getting tests passing; previously looms sort-of had tags, and the new tests in lp:bzr were partly failing because of that.

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

+1

Revision history for this message
John A Meinel (jameinel) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 3/1/2011 9:39 AM, Andrew Bennetts wrote:
> Andrew Bennetts has proposed merging lp:~spiv/bzr-loom/bzr-2.4-compat into lp:bzr-loom.
>
> Requested reviews:
> Loom Developers (bzr-loom-devs)
> Related bugs:
> #721328 revno 5648 on bzr.dev broke loom tests
> https://bugs.launchpad.net/bugs/721328
>
> For more details, see:
> https://code.launchpad.net/~spiv/bzr-loom/bzr-2.4-compat/+merge/51714
>
> This branch depends on <https://code.launchpad.net/~spiv/bzr/branch-revs-to-fetch/+merge/51710>.
>
> This fixes all the test failures in bzr-loom when run with lp:bzr.
>
> Some points of interest, and maybe concern:
>
> * it now does a single fetch, rather than one fetch per thread. Yay!
> * for simplicity I haven't tried to maintain backwards compatibility with bzr 2.3. Should I?
> * I also implemented pushing/pulling etc of tags for looms. The model is simple: there's a global tags dict for the whole loom, independent of threads. That is, tag semantics are basically unaffected by 'bzr loomify'. This is part of this patch because it was the easiest path to getting tests passing; previously looms sort-of had tags, and the new tests in lp:bzr were partly failing because of that.

Just repeating Robert:
 merge: approve

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk1tREUACgkQJdeBCYSNAANbygCgvlH1+VXgJRgLBUaFeq2aPe0M
zKIAnimF3IEjCPUjJ94TlRZ3O7H2vGzf
=s1qA
-----END PGP SIGNATURE-----

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'branch.py'
--- branch.py 2011-02-23 13:27:27 +0000
+++ branch.py 2011-03-01 08:38:29 +0000
@@ -30,6 +30,8 @@
30from bzrlib import bzrdir30from bzrlib import bzrdir
31from bzrlib.decorators import needs_read_lock, needs_write_lock31from bzrlib.decorators import needs_read_lock, needs_write_lock
32import bzrlib.errors32import bzrlib.errors
33import bzrlib.fetch
34import bzrlib.graph
33import bzrlib.osutils35import bzrlib.osutils
34from bzrlib import remote, symbol_versioning36from bzrlib import remote, symbol_versioning
35import bzrlib.trace37import bzrlib.trace
@@ -409,6 +411,18 @@
409411
410 nick = property(_loom_get_nick, _rename_thread)412 nick = property(_loom_get_nick, _rename_thread)
411413
414 def heads_to_fetch(self):
415 """See Branch.heads_to_fetch."""
416 # The base implementation returns ([tip], tags)
417 must_fetch, should_fetch = super(LoomSupport, self).heads_to_fetch()
418 # Add each thread's content to must_fetch
419 must_fetch.update(
420 thread_rev for thread_name, thread_rev, thread_parents in
421 self.get_loom_state().get_threads())
422 must_fetch.discard(EMPTY_REVISION)
423 must_fetch.discard(bzrlib.revision.NULL_REVISION)
424 return must_fetch, should_fetch
425
412 @needs_read_lock426 @needs_read_lock
413 def push(self, target, overwrite=False, stop_revision=None,427 def push(self, target, overwrite=False, stop_revision=None,
414 _override_hook_source_branch=None):428 _override_hook_source_branch=None):
@@ -591,7 +605,6 @@
591 return result605 return result
592606
593 def finish_result(self, result):607 def finish_result(self, result):
594 result.tag_conflicts = None
595 result.new_revno, result.new_revid = self.target.last_revision_info()608 result.new_revno, result.new_revid = self.target.last_revision_info()
596609
597 def do_hooks(self, result, run_hooks):610 def do_hooks(self, result, run_hooks):
@@ -618,8 +631,9 @@
618 new_rev = self.source.last_revision()631 new_rev = self.source.last_revision()
619 if new_rev == EMPTY_REVISION:632 if new_rev == EMPTY_REVISION:
620 new_rev = bzrlib.revision.NULL_REVISION633 new_rev = bzrlib.revision.NULL_REVISION
634 fetch_spec = self.build_fetch_spec(stop_revision)
621 self.target.repository.fetch(self.source.repository,635 self.target.repository.fetch(self.source.repository,
622 revision_id=new_rev)636 fetch_spec=fetch_spec)
623 if not overwrite:637 if not overwrite:
624 new_rev_ancestry = self.source.repository.get_ancestry(638 new_rev_ancestry = self.source.repository.get_ancestry(
625 new_rev)639 new_rev)
@@ -631,10 +645,20 @@
631 raise bzrlib.errors.DivergedBranches(645 raise bzrlib.errors.DivergedBranches(
632 self.target, self.source)646 self.target, self.source)
633 self.target.generate_revision_history(new_rev)647 self.target.generate_revision_history(new_rev)
648 result.tag_conflicts = self.source.tags.merge_to(self.target.tags)
634 # get the final result object details649 # get the final result object details
635 self.do_hooks(result, run_hooks)650 self.do_hooks(result, run_hooks)
636 return result651 return result
637652
653 def build_fetch_spec(self, stop_revision):
654 factory = bzrlib.fetch.FetchSpecFactory()
655 factory.source_branch = self.source
656 factory.source_repo = self.source.repository
657 factory.source_branch_stop_revision_id = stop_revision
658 factory.target_repo = self.target.repository
659 factory.target_repo_kind = bzrlib.fetch.TargetRepoKinds.PREEXISTING
660 return factory.make_fetch_spec()
661
638 def transfer(self, overwrite, stop_revision, run_hooks=True,662 def transfer(self, overwrite, stop_revision, run_hooks=True,
639 possible_transports=None, _override_hook_target=None, local=False):663 possible_transports=None, _override_hook_target=None, local=False):
640 """Implementation of push and pull"""664 """Implementation of push and pull"""
@@ -672,17 +696,10 @@
672 source_state.get_basis_revision_id())696 source_state.get_basis_revision_id())
673 # stopping at from our repository.697 # stopping at from our repository.
674 revisions = [rev for name,rev in threads]698 revisions = [rev for name,rev in threads]
675 # for each thread from top to bottom, retrieve its referenced699 # fetch content for all threads and tags.
676 # content. XXX FIXME: a revision_ids parameter to fetch would be700 fetch_spec = self.build_fetch_spec(stop_revision)
677 # nice here.701 self.target.repository.fetch(self.source.repository,
678 # the order is reversed because the common case is for the top702 fetch_spec=fetch_spec)
679 # thread to include all content.
680 for rev_id in reversed(revisions):
681 if rev_id not in (EMPTY_REVISION,
682 bzrlib.revision.NULL_REVISION):
683 # fetch the loom content for this revision
684 self.target.repository.fetch(self.source.repository,
685 revision_id=rev_id)
686 # set our work threads to match (this is where we lose data if703 # set our work threads to match (this is where we lose data if
687 # there are local mods)704 # there are local mods)
688 my_state.set_threads(705 my_state.set_threads(
@@ -699,6 +716,8 @@
699 if new_rev == EMPTY_REVISION:716 if new_rev == EMPTY_REVISION:
700 new_rev = bzrlib.revision.NULL_REVISION717 new_rev = bzrlib.revision.NULL_REVISION
701 self.target.generate_revision_history(new_rev)718 self.target.generate_revision_history(new_rev)
719 # merge tags
720 result.tag_conflicts = self.source.tags.merge_to(self.target.tags)
702 self.do_hooks(result, run_hooks)721 self.do_hooks(result, run_hooks)
703 return result722 return result
704 finally:723 finally:
@@ -799,7 +818,7 @@
799 transport, 'lock', bzrlib.lockdir.LockDir)818 transport, 'lock', bzrlib.lockdir.LockDir)
800 if found_repository is None:819 if found_repository is None:
801 found_repository = a_bzrdir.find_repository()820 found_repository = a_bzrdir.find_repository()
802 return self._branch_class(_format=self,821 return self._branch_class()(_format=self,
803 _control_files=control_files,822 _control_files=control_files,
804 a_bzrdir=a_bzrdir,823 a_bzrdir=a_bzrdir,
805 _repository=found_repository,824 _repository=found_repository,
@@ -836,7 +855,9 @@
836 This format is new in the loom plugin.855 This format is new in the loom plugin.
837 """856 """
838857
839 _branch_class = LoomBranch858 def _branch_class(self):
859 return LoomBranch
860
840 _parent_classs = bzrlib.branch.BzrBranchFormat5861 _parent_classs = bzrlib.branch.BzrBranchFormat5
841862
842 def get_format_string(self):863 def get_format_string(self):
@@ -863,7 +884,9 @@
863 This format is new in the loom plugin.884 This format is new in the loom plugin.
864 """885 """
865886
866 _branch_class = LoomBranch6887 def _branch_class(self):
888 return LoomBranch6
889
867 _parent_classs = bzrlib.branch.BzrBranchFormat6890 _parent_classs = bzrlib.branch.BzrBranchFormat6
868891
869 def get_format_string(self):892 def get_format_string(self):
@@ -890,7 +913,9 @@
890 This format is new in the loom plugin.913 This format is new in the loom plugin.
891 """914 """
892915
893 _branch_class = LoomBranch7916 def _branch_class(self):
917 return LoomBranch7
918
894 _parent_classs = bzrlib.branch.BzrBranchFormat7919 _parent_classs = bzrlib.branch.BzrBranchFormat7
895920
896 def get_format_string(self):921 def get_format_string(self):
@@ -1018,6 +1043,8 @@
1018 self.target.set_parent(parent)1043 self.target.set_parent(parent)
1019 if threads:1044 if threads:
1020 self.target._set_nick(threads[-1][0])1045 self.target._set_nick(threads[-1][0])
1046 if self.source._push_should_merge_tags():
1047 self.source.tags.merge_to(self.target.tags)
10211048
1022 @needs_write_lock1049 @needs_write_lock
1023 def pull(self, overwrite=False, stop_revision=None,1050 def pull(self, overwrite=False, stop_revision=None,

Subscribers

People subscribed via source and target branches