~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to cbranch.py

  • Committer: Aaron Bentley
  • Date: 2006-03-28 22:16:46 UTC
  • mto: This revision was merged to the branch mainline in revision 358.
  • Revision ID: abentley@panoramicfeedback.com-20060328221646-d36c46c772bdcaa5
cbranch mimics checkout wrt --lightweight

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
from bzrlib.builtins import cmd_branch, cmd_checkout
19
19
from bzrlib.config import LocationConfig
20
20
from bzrlib.errors import BzrCommandError
21
 
from bzrlib.osutils import pathjoin, basename, abspath
 
21
from bzrlib.osutils import pathjoin, basename, abspath, getcwd
22
22
 
23
 
def cbranch(from_location, to_location, revision=None):
 
23
def cbranch(from_location, to_location=None, revision=None, lightweight=False):
24
24
    config = LocationConfig(abspath(to_location))
25
25
    b_root = config.get_user_option("cbranch_root")
26
26
    if b_root is None:
27
27
        raise BzrCommandError("Can't find cbranch_root in branches.conf")
 
28
    if to_location is None:
 
29
        to_location = pathjoin(getcwd(), basename(to_location))
28
30
    b_loc = pathjoin(b_root, basename(to_location))
29
31
    cmd_branch().run(from_location, b_loc, revision=revision)
30
 
    cmd_checkout().run(b_loc, to_location, lightweight=True)
 
32
    cmd_checkout().run(b_loc, to_location, lightweight=lightweight)