Merge lp:~abentley/bzr/merge-into-empty into lp:bzr
Status: | Merged |
---|---|
Approved by: | Vincent Ladeuil |
Approved revision: | no longer in the source branch. |
Merged at revision: | 5968 |
Proposed branch: | lp:~abentley/bzr/merge-into-empty |
Merge into: | lp:bzr |
Prerequisite: | lp:~abentley/bzr/merge-into-empty-fixups |
Diff against target: |
256 lines (+98/-24) 9 files modified
bzrlib/merge.py (+17/-6) bzrlib/tests/blackbox/test_merge.py (+3/-2) bzrlib/tests/per_workingtree/test_merge_from_branch.py (+2/-0) bzrlib/tests/test_merge.py (+34/-0) bzrlib/tests/test_shelf.py (+8/-9) bzrlib/tests/test_shelf_ui.py (+9/-4) bzrlib/tests/test_transform.py (+17/-0) bzrlib/transform.py (+6/-3) doc/en/release-notes/bzr-2.4.txt (+2/-0) |
To merge this branch: | bzr merge lp:~abentley/bzr/merge-into-empty |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Vincent Ladeuil | Approve | ||
John A Meinel | Needs Fixing | ||
Review via email: mp+64078@code.launchpad.net |
Commit message
Support merge into empty tree.
Description of the change
This branch enables bzrlib to merge into the empty tree, i.e. the tree associated with the null revision. This tree is special because it has no root.
Such merges are not typically useful for bzr itself, but they are attempted when someone proposes a merge in Launchpad that merges a branch with commits into a branch that has no commits. (See bug #595328.) I would rather fix the root cause in bzrlib than special-case the diff generation code.
The code in TreeTransform.
There is some behavioural difference between the two. fixup_new_roots does not generate a conflict if a new root is added and the old root is not deleted. It happily merges the contents of the two roots. In such cases, the new root wins, whereas fix_root would have the old root win. Still, the new behaviour is in keeping with Merge's tendency of letting OTHER win in the case of ambiguity. And reducing duplication between fixup_new_roots and fix_root is also a win.
I've also changed Merge to ensure that root entries are processed.
I've had a bit of a revelation that TreeTransforms that delete the root aren't *invalid*, they simply can't be applied to a working tree. (They could be used to generate a _PreviewTree, for example) With that in mind, I've updated apply_removals to skip deletions of the root directory.
As a bonus, test_shelve_
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 6/9/2011 9:51 PM, Aaron Bentley wrote: proposal- jobs OOPS-1628MPJ1 in cancel_deletion when merging into empty tree" /bugs.launchpad .net/bzr/ +bug/595328 /code.launchpad .net/~abentley/ bzr/merge- into-empty/ +merge/ 64078 fixup_new_ roots seemed more suitable than the code in Merger.fix_root, so I've switched to fixup_new_roots and deprecated fix_root. old_root_ deleted no longer fails. I've taken the opportunity to rewrite it slightly using ExpectedException, which I find is clearer than assertRaises.
> Aaron Bentley has proposed merging lp:~abentley/bzr/merge-into-empty into lp:bzr with lp:~abentley/bzr/merge-into-empty-fixups as a prerequisite.
>
> Requested reviews:
> bzr-core (bzr-core)
> Related bugs:
> Bug #595328 in Bazaar: "merge-
> https:/
>
> For more details, see:
> https:/
>
> This branch enables bzrlib to merge into the empty tree, i.e. the tree associated with the null revision. This tree is special because it has no root.
>
> Such merges are not typically useful for bzr itself, but they are attempted when someone proposes a merge in Launchpad that merges a branch with commits into a branch that has no commits. (See bug #595328.) I would rather fix the root cause in bzrlib than special-case the diff generation code.
>
> The code in TreeTransform.
>
> There is some behavioural difference between the two. fixup_new_roots does not generate a conflict if a new root is added and the old root is not deleted. It happily merges the contents of the two roots. In such cases, the new root wins, whereas fix_root would have the old root win. Still, the new behaviour is in keeping with Merge's tendency of letting OTHER win in the case of ambiguity. And reducing duplication between fixup_new_roots and fix_root is also a win.
>
> I've also changed Merge to ensure that root entries are processed.
>
> I've had a bit of a revelation that TreeTransforms that delete the root aren't *invalid*, they simply can't be applied to a working tree. (They could be used to generate a _PeviewTree, for example) With that in mind, I've updated apply_removals to skip deletions of the root directory.
>
> As a bonus, test_shelve_
+ name = names[self. winner_ idx[name_ winner] ] adjust_ path(names[ self.winner_ idx[name_ winner] ], trans_id_ file_id( parent_ id), winner_ idx[parent_ id_winner] ] != '': winner_ idx[parent_ id_winner] ])
+ if parent_id is not None or name is not None:
# if we get here, name_winner and parent_winner are set to safe
# values.
- - self.tt.
- - self.tt.
+ if parent_id is None and name is not None:
+ # if parent_id is None and name is non-None, current
file is
+ # the tree root.
+ if names[self.
+ raise AssertionError(
+ 'File looks like a root, but named %s' %
+ names[self.
^- Why are you doing the lookup with the parent_id_winner rather than
the name_winner that you just used?
+ parent_trans_id = transform. ROOT_PARENT
+ else:
+ parent_trans_id = self.tt.tr...