~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Aaron Bentley
  • Date: 2005-09-29 21:07:17 UTC
  • mfrom: (1393.1.6)
  • mto: (1185.25.1)
  • mto: This revision was merged to the branch mainline in revision 1419.
  • Revision ID: abentley@panoramicfeedback.com-20050929210717-cd73981590f17017
Merged the weave changes

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
382
382
    aliases = ['get', 'clone']
383
383
 
384
384
    def run(self, from_location, to_location=None, revision=None, basis=None):
385
 
        from bzrlib.branch import copy_branch
 
385
        from bzrlib.clone import copy_branch
386
386
        import tempfile
387
387
        import errno
388
388
        from shutil import rmtree
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):
921
930
        import os.path
922
931
        b = Branch.open_containing('.')
923
932
        if revision is None:
924
 
            rev_id = b.last_patch()
 
933
            rev_id = b.last_revision()
925
934
        else:
926
935
            if len(revision) != 1:
927
936
                raise BzrError('bzr export --revision takes exactly 1 argument')
992
1001
    aliases = ['ci', 'checkin']
993
1002
 
994
1003
    # TODO: Give better message for -s, --summary, used by tla people
 
1004
 
 
1005
    # XXX: verbose currently does nothing
995
1006
    
996
1007
    def run(self, message=None, file=None, verbose=True, selected_list=None,
997
1008
            unchanged=False):
1021
1032
            message = codecs.open(file, 'rt', bzrlib.user_encoding).read()
1022
1033
 
1023
1034
        try:
1024
 
            b.commit(message, verbose=verbose,
 
1035
            b.commit(message,
1025
1036
                     specific_files=selected_list,
1026
1037
                     allow_pointless=unchanged)
1027
1038
        except PointlessCommit:
1070
1081
 
1071
1082
    The check command or bzr developers may sometimes advise you to run
1072
1083
    this command.
 
1084
 
 
1085
    This version of this command upgrades from the full-text storage
 
1086
    used by bzr 0.0.8 and earlier to the weave format (v5).
1073
1087
    """
1074
1088
    takes_args = ['dir?']
1075
1089
 
1076
1090
    def run(self, dir='.'):
1077
1091
        from bzrlib.upgrade import upgrade
1078
 
        upgrade(Branch.open_containing(dir))
1079
 
 
 
1092
        upgrade(dir)
1080
1093
 
1081
1094
 
1082
1095
class cmd_whoami(Command):
1086
1099
    def run(self, email=False):
1087
1100
        try:
1088
1101
            b = bzrlib.branch.Branch.open_containing('.')
1089
 
        except:
 
1102
        except NotBranchError:
1090
1103
            b = None
1091
1104
        
1092
1105
        if email:
1163
1176
        history_1 = branch1.revision_history()
1164
1177
        history_2 = branch2.revision_history()
1165
1178
 
1166
 
        last1 = branch1.last_patch()
1167
 
        last2 = branch2.last_patch()
 
1179
        last1 = branch1.last_revision()
 
1180
        last2 = branch2.last_revision()
1168
1181
 
1169
1182
        source = MultipleRevisionSources(branch1, branch2)
1170
1183
        
1322
1335
        shellcomplete.shellcomplete(context)
1323
1336
 
1324
1337
 
 
1338
class cmd_fetch(Command):
 
1339
    """Copy in history from another branch but don't merge it.
 
1340
 
 
1341
    This is an internal method used for pull and merge."""
 
1342
    hidden = True
 
1343
    takes_args = ['from_branch', 'to_branch']
 
1344
    def run(self, from_branch, to_branch):
 
1345
        from bzrlib.fetch import Fetcher
 
1346
        from bzrlib.branch import Branch
 
1347
        from_b = Branch(from_branch)
 
1348
        to_b = Branch(to_branch)
 
1349
        Fetcher(to_b, from_b)
 
1350
        
 
1351
 
 
1352
 
1325
1353
class cmd_missing(Command):
1326
1354
    """What is missing in this branch relative to other branch.
1327
1355
    """
 
1356
    # TODO: rewrite this in terms of ancestry so that it shows only
 
1357
    # unmerged things
 
1358
    
1328
1359
    takes_args = ['remote?']
1329
1360
    aliases = ['mis', 'miss']
1330
1361
    # We don't have to add quiet to the list, because