~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Robert Collins
  • Date: 2005-09-30 02:54:51 UTC
  • mfrom: (1395)
  • mto: This revision was merged to the branch mainline in revision 1397.
  • Revision ID: robertc@robertcollins.net-20050930025451-47b9e412202be44b
symlink and weaves, whaddya know

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
import bzrlib
22
22
import bzrlib.trace
23
23
from bzrlib.trace import mutter, note, log_error, warning
24
 
from bzrlib.errors import BzrError, BzrCheckError, BzrCommandError
 
24
from bzrlib.errors import BzrError, BzrCheckError, BzrCommandError, NotBranchError
25
25
from bzrlib.branch import Branch
26
26
from bzrlib import BZRDIR
27
27
from bzrlib.commands import Command
407
407
            else:
408
408
                basis_branch = None
409
409
            if len(revision) == 1 and revision[0] is not None:
410
 
                revno = revision[0].in_history(br_from)[0]
 
410
                revision_id = revision[0].in_history(br_from)[1]
411
411
            else:
412
 
                revno = None
 
412
                revision_id = None
413
413
            if to_location is None:
414
414
                to_location = os.path.basename(from_location.rstrip("/\\"))
415
415
            try:
424
424
                else:
425
425
                    raise
426
426
            try:
427
 
                copy_branch(br_from, to_location, revno, basis_branch)
 
427
                copy_branch(br_from, to_location, revision_id, basis_branch)
428
428
            except bzrlib.errors.NoSuchRevision:
429
429
                rmtree(to_location)
430
430
                msg = "The branch %s has no revision %d." % (from_location, revision[0])
523
523
            print patchid
524
524
 
525
525
 
 
526
class cmd_ancestry(Command):
 
527
    """List all revisions merged into this branch."""
 
528
    hidden = True
 
529
    def run(self):
 
530
        b = find_branch('.')
 
531
        for revision_id in b.get_ancestry(b.last_revision()):
 
532
            print revision_id
 
533
 
 
534
 
526
535
class cmd_directories(Command):
527
536
    """Display list of versioned directories in this branch."""
528
537
    def run(self):
920
929
        import os.path
921
930
        b = Branch.open_containing('.')
922
931
        if revision is None:
923
 
            rev_id = b.last_patch()
 
932
            rev_id = b.last_revision()
924
933
        else:
925
934
            if len(revision) != 1:
926
935
                raise BzrError('bzr export --revision takes exactly 1 argument')
984
993
    aliases = ['ci', 'checkin']
985
994
 
986
995
    # TODO: Give better message for -s, --summary, used by tla people
 
996
 
 
997
    # XXX: verbose currently does nothing
987
998
    
988
999
    def run(self, message=None, file=None, verbose=True, selected_list=None,
989
1000
            unchanged=False):
1013
1024
            message = codecs.open(file, 'rt', bzrlib.user_encoding).read()
1014
1025
 
1015
1026
        try:
1016
 
            b.commit(message, verbose=verbose,
 
1027
            b.commit(message,
1017
1028
                     specific_files=selected_list,
1018
1029
                     allow_pointless=unchanged)
1019
1030
        except PointlessCommit:
1062
1073
 
1063
1074
    The check command or bzr developers may sometimes advise you to run
1064
1075
    this command.
 
1076
 
 
1077
    This version of this command upgrades from the full-text storage
 
1078
    used by bzr 0.0.8 and earlier to the weave format (v5).
1065
1079
    """
1066
1080
    takes_args = ['dir?']
1067
1081
 
1068
1082
    def run(self, dir='.'):
1069
1083
        from bzrlib.upgrade import upgrade
1070
 
        upgrade(Branch.open_containing(dir))
1071
 
 
 
1084
        upgrade(dir)
1072
1085
 
1073
1086
 
1074
1087
class cmd_whoami(Command):
1078
1091
    def run(self, email=False):
1079
1092
        try:
1080
1093
            b = bzrlib.branch.Branch.open_containing('.')
1081
 
        except:
 
1094
        except NotBranchError:
1082
1095
            b = None
1083
1096
        
1084
1097
        if email:
1155
1168
        history_1 = branch1.revision_history()
1156
1169
        history_2 = branch2.revision_history()
1157
1170
 
1158
 
        last1 = branch1.last_patch()
1159
 
        last2 = branch2.last_patch()
 
1171
        last1 = branch1.last_revision()
 
1172
        last2 = branch2.last_revision()
1160
1173
 
1161
1174
        source = MultipleRevisionSources(branch1, branch2)
1162
1175
        
1312
1325
        shellcomplete.shellcomplete(context)
1313
1326
 
1314
1327
 
 
1328
class cmd_fetch(Command):
 
1329
    """Copy in history from another branch but don't merge it.
 
1330
 
 
1331
    This is an internal method used for pull and merge."""
 
1332
    hidden = True
 
1333
    takes_args = ['from_branch', 'to_branch']
 
1334
    def run(self, from_branch, to_branch):
 
1335
        from bzrlib.fetch import Fetcher
 
1336
        from bzrlib.branch import Branch
 
1337
        from_b = Branch(from_branch)
 
1338
        to_b = Branch(to_branch)
 
1339
        Fetcher(to_b, from_b)
 
1340
        
 
1341
 
 
1342
 
1315
1343
class cmd_missing(Command):
1316
1344
    """What is missing in this branch relative to other branch.
1317
1345
    """
 
1346
    # TODO: rewrite this in terms of ancestry so that it shows only
 
1347
    # unmerged things
 
1348
    
1318
1349
    takes_args = ['remote?']
1319
1350
    aliases = ['mis', 'miss']
1320
1351
    # We don't have to add quiet to the list, because