/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/commands.py

  • Committer: Martin Pool
  • Date: 2005-08-02 13:56:14 UTC
  • Revision ID: mbp@sourcefrog.net-20050802135614-01365d7cbdb62854
- ignore setup.py build directory

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
17
 
18
 
# TODO: Split the command framework away from the actual commands.
19
 
 
20
 
# TODO: probably should say which arguments are candidates for glob
21
 
# expansion on windows and do that at the command level.
22
 
 
23
 
import sys
24
 
import os
 
18
 
 
19
import sys, os
25
20
 
26
21
import bzrlib
27
22
from bzrlib.trace import mutter, note, log_error, warning
510
505
    def run(self, source_list, dest):
511
506
        b = find_branch('.')
512
507
 
513
 
        # TODO: glob expansion on windows?
514
508
        b.move([b.relpath(s) for s in source_list], b.relpath(dest))
515
509
 
516
510
 
536
530
 
537
531
 
538
532
 
539
 
class cmd_mv(Command):
540
 
    """Move or rename a file.
541
 
 
542
 
    usage:
543
 
        bzr mv OLDNAME NEWNAME
544
 
        bzr mv SOURCE... DESTINATION
545
 
 
546
 
    If the last argument is a versioned directory, all the other names
547
 
    are moved into it.  Otherwise, there must be exactly two arguments
548
 
    and the file is changed to a new name, which must not already exist.
549
 
 
550
 
    Files cannot be moved between branches.
551
 
    """
552
 
    takes_args = ['names*']
553
 
    def run(self, names_list):
554
 
        if len(names_list) < 2:
555
 
            raise BzrCommandError("missing file argument")
556
 
        b = find_branch(names_list[0])
557
 
 
558
 
        rel_names = [b.relpath(x) for x in names_list]
559
 
        
560
 
        if os.path.isdir(names_list[-1]):
561
 
            # move into existing directory
562
 
            b.move(rel_names[:-1], rel_names[-1])
563
 
        else:
564
 
            if len(names_list) != 2:
565
 
                raise BzrCommandError('to mv multiple files the destination '
566
 
                                      'must be a versioned directory')
567
 
            b.move(rel_names[0], rel_names[1])
568
 
            
569
 
    
570
533
 
571
534
 
572
535
class cmd_pull(Command):
644
607
    def run(self, from_location, to_location=None, revision=None):
645
608
        import errno
646
609
        from bzrlib.merge import merge
647
 
        from bzrlib.branch import DivergedBranches, \
 
610
        from bzrlib.branch import DivergedBranches, NoSuchRevision, \
648
611
             find_cached_branch, Branch
649
612
        from shutil import rmtree
650
613
        from meta_store import CachedStore
691
654
                    revno, rev_id = br_from.get_revision_info(revision[0])
692
655
                try:
693
656
                    br_to.update_revisions(br_from, stop_revision=revno)
694
 
                except bzrlib.errors.NoSuchRevision:
 
657
                except NoSuchRevision:
695
658
                    rmtree(to_location)
696
659
                    msg = "The branch %s has no revision %d." % (from_location,
697
660
                                                                 revno)
1824
1787
 
1825
1788
def _report_exception(summary, quiet=False):
1826
1789
    import traceback
1827
 
    
1828
1790
    log_error('bzr: ' + summary)
1829
1791
    bzrlib.trace.log_exception()
1830
1792
 
1831
 
    if os.environ.get('BZR_DEBUG'):
1832
 
        traceback.print_exc()
1833
 
 
1834
1793
    if not quiet:
1835
 
        sys.stderr.write('\n')
1836
1794
        tb = sys.exc_info()[2]
1837
1795
        exinfo = traceback.extract_tb(tb)
1838
1796
        if exinfo: