~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-02-14 09:51:20 UTC
  • mfrom: (2279.3.1 dashd)
  • Revision ID: pqm@pqm.ubuntu.com-20070214095120-13e5c64a9d83e718
(mbp) add -d option to push, pull, merge (r=aaron)

Show diffs side-by-side

added added

removed removed

Lines of Context:
537
537
    location can be accessed.
538
538
    """
539
539
 
540
 
    takes_options = ['remember', 'overwrite', 'revision', 'verbose']
 
540
    takes_options = ['remember', 'overwrite', 'revision', 'verbose',
 
541
        Option('directory',
 
542
            help='branch to pull into, '
 
543
                 'rather than the one containing the working directory',
 
544
            short_name='d',
 
545
            type=unicode,
 
546
            ),
 
547
        ]
541
548
    takes_args = ['location?']
542
549
    encoding_type = 'replace'
543
550
 
544
 
    def run(self, location=None, remember=False, overwrite=False, revision=None, verbose=False):
 
551
    def run(self, location=None, remember=False, overwrite=False,
 
552
            revision=None, verbose=False,
 
553
            directory=None):
545
554
        # FIXME: too much stuff is in the command class
 
555
        if directory is None:
 
556
            directory = u'.'
546
557
        try:
547
 
            tree_to = WorkingTree.open_containing(u'.')[0]
 
558
            tree_to = WorkingTree.open_containing(directory)[0]
548
559
            branch_to = tree_to.branch
549
560
        except errors.NoWorkingTree:
550
561
            tree_to = None
551
 
            branch_to = Branch.open_containing(u'.')[0]
 
562
            branch_to = Branch.open_containing(directory)[0]
552
563
 
553
564
        reader = None
554
565
        if location is not None:
568
579
                self.outf.write("Using saved location: %s\n" % display_url)
569
580
                location = stored_loc
570
581
 
571
 
 
572
582
        if reader is not None:
573
583
            install_bundle(branch_to.repository, reader)
574
584
            branch_from = branch_to
630
640
    """
631
641
 
632
642
    takes_options = ['remember', 'overwrite', 'verbose',
633
 
                     Option('create-prefix',
634
 
                            help='Create the path leading up to the branch '
635
 
                                 'if it does not already exist'),
636
 
                     Option('use-existing-dir',
637
 
                            help='By default push will fail if the target'
638
 
                                 ' directory exists, but does not already'
639
 
                                 ' have a control directory. This flag will'
640
 
                                 ' allow push to proceed.'),
641
 
                     ]
 
643
        Option('create-prefix',
 
644
               help='Create the path leading up to the branch '
 
645
                    'if it does not already exist'),
 
646
        Option('directory',
 
647
            help='branch to push from, '
 
648
                 'rather than the one containing the working directory',
 
649
            short_name='d',
 
650
            type=unicode,
 
651
            ),
 
652
        Option('use-existing-dir',
 
653
               help='By default push will fail if the target'
 
654
                    ' directory exists, but does not already'
 
655
                    ' have a control directory. This flag will'
 
656
                    ' allow push to proceed.'),
 
657
        ]
642
658
    takes_args = ['location?']
643
659
    encoding_type = 'replace'
644
660
 
645
661
    def run(self, location=None, remember=False, overwrite=False,
646
 
            create_prefix=False, verbose=False, use_existing_dir=False):
 
662
            create_prefix=False, verbose=False,
 
663
            use_existing_dir=False,
 
664
            directory=None):
647
665
        # FIXME: Way too big!  Put this into a function called from the
648
666
        # command.
649
 
        
650
 
        br_from = Branch.open_containing('.')[0]
 
667
        if directory is None:
 
668
            directory = '.'
 
669
        br_from = Branch.open_containing(directory)[0]
651
670
        stored_loc = br_from.get_push_location()
652
671
        if location is None:
653
672
            if stored_loc is None:
2351
2370
    default, use --remember. The value will only be saved if the remote
2352
2371
    location can be accessed.
2353
2372
 
 
2373
    The results of the merge are placed into the destination working
 
2374
    directory, where they can be reviewed (with bzr diff), tested, and then
 
2375
    committed to record the result of the merge.
 
2376
 
2354
2377
    Examples:
2355
2378
 
2356
2379
    To merge the latest revision from bzr.dev
2369
2392
    """
2370
2393
    takes_args = ['branch?']
2371
2394
    takes_options = ['revision', 'force', 'merge-type', 'reprocess', 'remember',
2372
 
                     Option('show-base', help="Show base revision text in "
2373
 
                            "conflicts"),
2374
 
                     Option('uncommitted', help='Apply uncommitted changes'
2375
 
                            ' from a working copy, instead of branch changes'),
2376
 
                     Option('pull', help='If the destination is already'
2377
 
                             ' completely merged into the source, pull from the'
2378
 
                             ' source rather than merging. When this happens,'
2379
 
                             ' you do not need to commit the result.'),
2380
 
                     ]
 
2395
        Option('show-base', help="Show base revision text in "
 
2396
               "conflicts"),
 
2397
        Option('uncommitted', help='Apply uncommitted changes'
 
2398
               ' from a working copy, instead of branch changes'),
 
2399
        Option('pull', help='If the destination is already'
 
2400
                ' completely merged into the source, pull from the'
 
2401
                ' source rather than merging. When this happens,'
 
2402
                ' you do not need to commit the result.'),
 
2403
        Option('directory',
 
2404
            help='branch to merge into, '
 
2405
                 'rather than the one containing the working directory',
 
2406
            short_name='d',
 
2407
            type=unicode,
 
2408
            ),
 
2409
    ]
2381
2410
 
2382
2411
    def run(self, branch=None, revision=None, force=False, merge_type=None,
2383
 
            show_base=False, reprocess=False, remember=False, 
2384
 
            uncommitted=False, pull=False):
 
2412
            show_base=False, reprocess=False, remember=False,
 
2413
            uncommitted=False, pull=False,
 
2414
            directory=None,
 
2415
            ):
2385
2416
        if merge_type is None:
2386
2417
            merge_type = _mod_merge.Merge3Merger
2387
 
 
2388
 
        tree = WorkingTree.open_containing(u'.')[0]
 
2418
        if directory is None: directory = u'.'
 
2419
        tree = WorkingTree.open_containing(directory)[0]
2389
2420
 
2390
2421
        if branch is not None:
2391
2422
            try:
2453
2484
                    reprocess=reprocess,
2454
2485
                    show_base=show_base,
2455
2486
                    pull=pull,
 
2487
                    this_dir=directory,
2456
2488
                    pb=pb, file_list=interesting_files)
2457
2489
            finally:
2458
2490
                pb.finished()