[MERGE] Improve test_sprout_preserves_kind
Aaron Bentley
aaron at aaronbentley.com
Tue Nov 18 17:54:47 GMT 2008
John Arbash Meinel wrote:
> I believe your contention that it "uses it if it has been specified" is
> incorrect, because AFAIK there is no way to leave a BzrDir.branch_format
> unspecified.
Sure there is. You can accept the default. This test is specifically
doing self.make_repository('target', format=self.bzrdir_format)
> If you create a BzrDir it auto-specifies the default.
"auto-specifies the default" seems like a contradiction in terms to me,
which is why I phrased it that way earlier.
> And
> Branch.sprout() always takes an existing BzrDir to sprout into.
I hadn't twigged that we were actually testing Branch.sprout, not
BzrDir.sprout. I don't think it's a very clear test of the format
support, because it's assuming that the BzrDir from the repo has the
same branch format as self.bzrdir_format.
I think it would be much better to explicitly create a bzrdir, make a
repo in it, and sprout into it.
i.e.
target_bzrdir = self.make_bzrdir('target') # no redundant format=
target_bzrdir.create_repository()
target = source.sprout(target_bzrdir)
> We discussed it a bit in Sydney, and I think an ideal api would have the
> primary "sprout" be on Branch rather than on BzrDir
Agreed. Sprouting a repository doesn't make sense.
Actually, I think a command object is the way to go, but it should
definitely take a branch and produce a branch.
> Does the term:
>
> test_sprout_uses_bzrdir_branch_format(self): ?
>
> Sound better to you?
Yes, it sounds great.
Aaron
More information about the bazaar
mailing list