382
380
print "Using saved location: %s" % stored_loc
383
381
location = stored_loc
382
if br_to.get_parent() is None or remember:
383
br_to.set_parent(location)
384
384
br_from = Branch.open(location)
386
br_to.working_tree().pull(br_from, remember, overwrite)
386
br_to.working_tree().pull(br_from, overwrite)
387
387
except DivergedBranches:
388
388
raise BzrCommandError("These branches have diverged."
392
class cmd_push(Command):
393
"""Push this branch into another branch.
395
The remote branch will not have its working tree populated because this
396
is both expensive, and may not be supported on the remote file system.
398
Some smart servers or protocols *may* put the working tree in place.
400
If there is no default push location set, the first push will set it.
401
After that, you can omit the location to use the default. To change the
402
default, use --remember.
404
This command only works on branches that have not diverged. Branches are
405
considered diverged if the branch being pushed to is not an older version
408
If branches have diverged, you can use 'bzr push --overwrite' to replace
409
the other branch completely.
411
If you want to ensure you have the different changes in the other branch,
412
do a merge (see bzr help merge) from the other branch, and commit that
413
before doing a 'push --overwrite'.
415
takes_options = ['remember', 'overwrite']
416
takes_args = ['location?']
418
def run(self, location=None, remember=False, overwrite=False):
420
from shutil import rmtree
421
from bzrlib.transport import get_transport
423
br_from = Branch.open_containing('.')[0]
424
stored_loc = br_from.get_push_location()
426
if stored_loc is None:
427
raise BzrCommandError("No push location known or specified.")
429
print "Using saved location: %s" % stored_loc
430
location = stored_loc
431
if br_from.get_push_location() is None or remember:
432
br_from.set_push_location(location)
434
br_to = Branch.open(location)
435
except NotBranchError:
437
transport = get_transport(location).clone('..')
438
transport.mkdir(transport.relpath(location))
439
br_to = Branch.initialize(location)
441
br_to.pull(br_from, overwrite)
442
except DivergedBranches:
443
raise BzrCommandError("These branches have diverged."
444
" Try a merge then push with overwrite.")
392
447
class cmd_branch(Command):
393
448
"""Create a new copy of a branch.
634
689
b, file_list = branch_files(file_list)
635
690
if revision is not None:
636
691
if len(revision) == 1:
637
show_diff(b, revision[0], specific_files=file_list,
638
external_diff_options=diff_options)
692
return show_diff(b, revision[0], specific_files=file_list,
693
external_diff_options=diff_options)
639
694
elif len(revision) == 2:
640
show_diff(b, revision[0], specific_files=file_list,
641
external_diff_options=diff_options,
642
revision2=revision[1])
695
return show_diff(b, revision[0], specific_files=file_list,
696
external_diff_options=diff_options,
697
revision2=revision[1])
644
699
raise BzrCommandError('bzr diff --revision takes exactly one or two revision identifiers')
646
show_diff(b, None, specific_files=file_list,
647
external_diff_options=diff_options)
701
return show_diff(b, None, specific_files=file_list,
702
external_diff_options=diff_options)
652
705
class cmd_deleted(Command):