[MERGE] Add --no-checkout option to branch to create workingtree-less branches.

John Arbash Meinel john at arbash-meinel.com
Thu Jul 6 15:16:44 BST 2006


Michael Ellerman wrote:
> Hi list,
> 
> Add --no-checkout option to branch to create workingtree-less branches.
> 
> This is useful in shared repositories when creating temporary branches,
> the majority of the time spent branching is the creation of the working
> tree. In some cases a working tree isn't necessary. Tests included.
> 
> cheers
> 

I think the first test is that a working tree shouldn't be created if
the Repository has 'no-working-trees' flag set. Which seems to be the
case on my end.

What sort of temp branch are you creating, in a repo with working trees,
such that you don't want a working tree? Just like a snapshot/tag/etc?

I'm okay with the --no-checkout, but I want to pass None if it wasn't
supplied by the user, so that it respects the Repositories default
setting, rather than overriding it.

Right now there is a bug in push, where if it is a local repository, it
*always* creates the working tree. Even when the Repo says not to.

...

> -        if result_repo is None or result_repo.make_working_trees():
> +        if checkout and (result_repo is None or
> +                result_repo.make_working_trees()):
>              result.create_workingtree()
> +
>          return result

See, here you explicitly deny a checkout if repo says not to. But it
seems like an argument passed into the command should override the
default repository settings. So I would say something more like:

if checkout is None:
  checkout = result_repo is None or result_repo.make_working_trees()
if checkout:
  result.create_workingtree()

But that means you can't use the 'not no_checkout' logic earlier.

...

>  
> -    def sprout(self, url, revision_id=None, basis=None):
> +    def sprout(self, url, revision_id=None, basis=None, checkout=True):
>          """See BzrDir.sprout()."""
>          from bzrlib.workingtree import WorkingTreeFormat2
>          self._make_tail(url)
> @@ -747,8 +754,10 @@
>              self.open_branch().sprout(result, revision_id=revision_id)
>          except errors.NotBranchError:
>              pass
> -        # we always want a working tree
> -        WorkingTreeFormat2().initialize(result)
> +
> +        if checkout:
> +            WorkingTreeFormat2().initialize(result)
> +
>          return result
>  

This is the old format before we split things up. This format doesn't
know how to not have a working tree. So I don't think we want to change
this.

John
=:->


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060706/d6c36e16/attachment.pgp 


More information about the bazaar mailing list