549
549
branch before copying anything from the remote branch.
551
551
takes_args = ['from_location', 'to_location?']
552
takes_options = ['revision', 'basis']
552
takes_options = ['revision', 'basis', 'bound']
553
553
aliases = ['get', 'clone']
555
def run(self, from_location, to_location=None, revision=None, basis=None):
555
def run(self, from_location, to_location=None, revision=None, basis=None,
556
557
if revision is None:
557
558
revision = [None]
558
559
elif len(revision) > 1:
604
605
raise BzrCommandError(msg)
605
606
except bzrlib.errors.UnlistableBranch:
606
607
rmtree(to_location)
607
msg = "The branch %s cannot be used as a --basis"
608
msg = "The branch %s cannot be used as a --basis" % (basis,)
608
609
raise BzrCommandError(msg)
610
611
branch.control_files.put_utf8('branch-name', name)
1436
1439
except StrictCommitFailed:
1437
1440
raise BzrCommandError("Commit refused because there are unknown "
1438
1441
"files in the working tree.")
1442
except errors.BoundBranchOutOfDate, e:
1443
raise BzrCommandError(str(e)
1444
+ ' Either unbind or update.')
1439
1446
note('Committed revision %d.' % (tree.branch.revno(),))
2122
2129
raise BzrCommandError('Please supply either one revision, or a range.')
2132
class cmd_bind(Command):
2133
"""Bind the current branch to its parent.
2135
After binding, commits must succeed on the parent branch
2136
before they can be done on the local one.
2139
takes_args = ['location?']
2142
def run(self, location=None):
2143
b, relpath = Branch.open_containing(u'.')
2144
if location is None:
2145
location = b.get_bound_location()
2146
if location is None:
2147
location = b.get_parent()
2148
if location is None:
2149
raise BzrCommandError('Branch has no parent,'
2150
' you must supply a bind location.')
2151
b_other = Branch.open(location)
2154
except DivergedBranches:
2155
raise BzrCommandError('These branches have diverged.'
2156
' Try merging, and then bind again.')
2159
class cmd_unbind(Command):
2160
"""Bind the current branch to its parent.
2162
After unbinding, the local branch is considered independent.
2169
b, relpath = Branch.open_containing(u'.')
2171
raise BzrCommandError('Local branch is not bound')
2174
class cmd_update(Command):
2175
"""Update the local tree for checkouts and bound branches.
2178
wt, relpath = WorkingTree.open_containing(u'.')
2179
# TODO: jam 20051127 Check here to see if this is a checkout
2180
bound_loc = wt.branch.get_bound_location()
2182
raise BzrCommandError('Working tree %s is not a checkout'
2183
' or a bound branch, you probably'
2184
' want pull' % wt.base)
2186
br_bound = Branch.open(bound_loc)
2188
wt.pull(br_bound, overwrite=False)
2189
except DivergedBranches:
2190
raise BzrCommandError("These branches have diverged."
2125
2194
class cmd_uncommit(bzrlib.commands.Command):
2126
2195
"""Remove the last committed revision.