[MERGE] Fix stacking tests applicability

John Arbash Meinel john at arbash-meinel.com
Thu Dec 18 17:08:10 GMT 2008


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

Vincent Ladeuil wrote:
>>>>>> "jam" == John Arbash Meinel <john at arbash-meinel.com> writes:
> 
>     jam> Vincent Ladeuil wrote:
>     >> Let's rephrase that hopefully more clearly.
>     >> 
>     >> From the premise that it should be possible to define an
>     >> unstackable branch format that pass the test suite, I modified
>     >> loom to be explicit about that. (Since it didn't pass the test
>     >> suite I thought it was a valid modification until loom support
>     >> stacking).
>     >> 
>     >> I had to modify some tests to reach that point.
>     >> 
>     >> I also fixed a typo in test_osutils.TestChunksToLines.test_is_compiled.
>     >> 
>     >> Vincent
>     >> 
>     >> P.S.: I missed one failing test in my previous submission, bad
>     >> vila, stop abusing 'selftest -s' :)
>     >> 
>     >> 
> 
>     jam> BB:resubmit
> 
>     jam> I'm pretty sure this needs to be rethought:
> 
>     jam> -        if isinstance(self.branch_format, branch.BzrBranchFormat4):
>     jam> -            raise tests.TestNotApplicable('Not a metadir format.')
>     jam> +        if not self.branch_format.supports_stacking():
>     jam> +            raise tests.TestNotApplicable('%r does not support stacking'
>     jam> +                                    % self.branch_format)
> 
>     jam> ^- Basically, the test is *about* using a repository format which
>     jam> supports stacking, and a *branch* format which does not. And ensuring
>     jam> that we get a sane result when we are done.
> 
>     jam> You changed the test so that it only runs when we have a branch that
>     jam> supports stacking... Which is not what we want.
> 
> Ok.
> 
> So, with that patch I posted earlier against loom, the tests are failing at the 
> 
>         push._show_push_branch(trunk, 'rev-2', self.get_url('remote'), output)
> 
> line with a traceback like:
> 
>   File "/net/bigmamac/Volumes/home/vila/src/bzr/experimental/selftest-stacking/bzrlib/tests/branch_implementations/test_push.py", line 220, in test_push_with_default_stacking_does_not_create_broken_branch
>     push._show_push_branch(trunk, 'rev-2', self.get_url('remote'), output)
>   File "/net/bigmamac/Volumes/home/vila/src/bzr/experimental/selftest-stacking/bzrlib/push.py", line 106, in _show_push_branch
>     revision_id=revision_id, stacked_on=stacked_on)
>   File "/net/bigmamac/Volumes/home/vila/src/bzr/experimental/selftest-stacking/bzrlib/bzrdir.py", line 233, in clone_on_transport
>     repository_policy.configure_branch(result_branch)
>   File "/net/bigmamac/Volumes/home/vila/src/bzr/experimental/selftest-stacking/bzrlib/bzrdir.py", line 2886, in configure_branch
>     branch.set_stacked_on_url(stack_on)
>   File "/home/vila/.bazaar/plugins/loom/branch.py", line 609, in set_stacked_on_url
>     raise bzrlib.errors.UnstackableBranchFormat(self._format, self.base)
> 
> At which point I don't understand how to reconcile your remark
> and the test...

Honestly, I'm not really sure how bzr-loom hijacks the code. What
happens if you try to do "bzr push --stacked" from a loom branch?
Because whatever effect that has is what this test is effectively meant
to do. Under the circumstances:

1) Your repository format supports stacking
2) Your branch doesn't support stacking
3) When pushing the target gets a "default stack location"

Under those conditions, Andrew's basic approach was to effectively
change the push to seem as though "--stacked" had been given, which
causes the branch format to automatically upgrade. (The repository
doesn't because it is already a stackable format.)

Can you try "bzr init; bzr loomify; bzr push --stacked" sort of thing to
see how looms treat the --stacked parameter.

I suppose my concern is that looms override the 'push' command to
forcefully reject --stacked, which doesn't give us much room underneath
to make things work.



>     jam>              raise TestNotApplicable()
>     jam>          # Avoid make_branch, which produces standalone branches.
>     jam>          bzrdir = self.make_bzrdir('repo/stack-on')
>     jam> -        try:
>     jam> -            b = bzrdir.create_branch()
>     jam> -        except errors.UninitializableFormat:
>     jam> -            raise TestNotApplicable()
>     jam> +        b = bzrdir.create_branch()
> 
>     jam> ^- Why did you do this one? Certainly there are formats
>     jam> that cannot be initialized (our oldest branch format).
> 
> Because I thought that was included in the unstackable format
> check ? But I can put it back if you prefer.
> 
> Keep in mind that I didn't try to understand the tests deeply,
> just make them pass with one example of an unstackable branch
> format.
> 
>         Vincent
> 

Could be. I suppose if the tests keep passing, then it doesn't matter.

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

iEYEARECAAYFAklKg3oACgkQJdeBCYSNAAMHDwCdHuSleMcTgPjDGNF9uF0TWDhe
zxgAoK9ifjlb+bl+Z5Bs0E9NBngWmOKz
=tJjY
-----END PGP SIGNATURE-----



More information about the bazaar mailing list