[PATCH] checkout --light

James Blackwell jblack at merconline.com
Tue Apr 18 07:42:10 BST 2006


On Tue, Apr 18, 2006 at 01:49:24AM +0200, David Allouche wrote:
> I love light checkouts. And I'm too lazy to call them "lightweight".
> 
> So I would like the command to create them to change from "bzr co
> --lightweight" to "bzr co --light", so much less finger wear.

I have this in my .bazaar/bazaar.conf: 

[ALIASES]
checkout=checkout --lightweight


This will make all checkouts lightweight. The UI doesn't yet have a flag
to specify non-lightweight.

> 
> This is accomplished by the attached patch. The patch also does some
> minor fixes to the docstring, accounting for the bulk of the diffs:
> 
>       * turn the reference to the non-existent basis option into a
>         comment, so it does not appear in the help text
>       * reflow the docstrings so they do not go past column 79.
> -- 
>                                                             -- ddaa

> === modified file 'a/bzrlib/builtins.py'
> --- a/bzrlib/builtins.py	
> +++ b/bzrlib/builtins.py	
> @@ -625,36 +625,35 @@
>  class cmd_checkout(Command):
>      """Create a new checkout of an existing branch.
>  
> -    If BRANCH_LOCATION is omitted, checkout will reconstitute a working tree for
> -    the branch found in '.'. This is useful if you have removed the working tree
> -    or if it was never created - i.e. if you pushed the branch to its current
> -    location using SFTP.
> -    
> -    If the TO_LOCATION is omitted, the last component of the BRANCH_LOCATION will
> -    be used.  In other words, "checkout ../foo/bar" will attempt to create ./bar.
> +    If BRANCH_LOCATION is omitted, checkout will reconstitute a working tree
> +    for the branch found in '.'. This is useful if you have removed the working
> +    tree or if it was never created - i.e. if you pushed the branch to its
> +    current location using SFTP.
> +    
> +    If the TO_LOCATION is omitted, the last component of the BRANCH_LOCATION
> +    will be used. In other words, "checkout ../foo/bar" will attempt to create
> +    ./bar.
>  
>      To retrieve the branch as of a particular revision, supply the --revision
> -    parameter, as in "checkout foo/bar -r 5". Note that this will be immediately
> -    out of date [so you cannot commit] but it may be useful (i.e. to examine old
> -    code.)
> -
> -    --basis is to speed up checking out from remote branches.  When specified, it
> -    uses the inventory and file contents from the basis branch in preference to the
> -    branch being checked out. [Not implemented yet.]
> -    """
> +    parameter, as in"checkout foo/bar -r 5". Note that this will be immediately
> +    out of date [so you cannot commit] but it may be useful (i.e. to examine
> +    old code.)
> +    """
> +    # --basis is to speed up checking out from remote branches. When specified,
> +    # it uses the inventory and file contents from the basis branch in
> +    # preference to the branch being checked out. [Not implemented yet.]
> +
>      takes_args = ['branch_location?', 'to_location?']
> -    takes_options = ['revision', # , 'basis']
> -                     Option('lightweight',
> -                            help="perform a lightweight checkout. Lightweight "
> -                                 "checkouts depend on access to the branch for "
> -                                 "every operation. Normal checkouts can perform "
> -                                 "common operations like diff and status without "
> -                                 "such access, and also support local commits."
> -                            ),
> -                     ]
> +    takes_options = ['revision', # , 'basis',
> +                     Option('light', help=(
> +        "create a light checkout. Light checkouts depend on access to the "
> +        "branch for every operation. Normal checkouts can perform common "
> +        "operations like diff and status without such access, and also "
> +        "support local commits.")),
> +                    ]
>  
>      def run(self, branch_location=None, to_location=None, revision=None, basis=None,
> -            lightweight=False):
> +            light=False):
>          if revision is None:
>              revision = [None]
>          elif len(revision) > 1:
> @@ -694,7 +693,7 @@
>          old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
>          bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrdir.BzrDirMetaFormat1())
>          try:
> -            if lightweight:
> +            if light:
>                  checkout = bzrdir.BzrDirMetaFormat1().initialize(to_location)
>                  bzrlib.branch.BranchReferenceFormat().initialize(checkout, source)
>              else:
> 




-- 
My home page:   <a href="http://jblack.linuxguru.net">James Blackwell</a>
Gnupg 06357400  F-print AAE4 8C76 58DA 5902 761D  247A 8A55 DA73 0635 7400
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: Digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060418/074a8a09/attachment.pgp 


More information about the bazaar mailing list