~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: John Arbash Meinel
  • Date: 2007-06-07 22:31:44 UTC
  • mfrom: (2517 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2518.
  • Revision ID: john@arbash-meinel.com-20070607223144-u4oljlajcvq6by2n
[merge] bzr.dev 2517

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
    osutils,
46
46
    registry,
47
47
    repository,
 
48
    revisionspec,
48
49
    symbol_versioning,
49
50
    transport,
50
51
    tree as _mod_tree,
249
250
 
250
251
    To re-create the working tree, use "bzr checkout".
251
252
    """
252
 
    _see_also = ['checkout']
 
253
    _see_also = ['checkout', 'working-trees']
253
254
 
254
255
    takes_args = ['location?']
255
256
 
304
305
        if revision_info_list is not None:
305
306
            for rev in revision_info_list:
306
307
                revs.append(RevisionSpec.from_string(rev))
 
308
 
 
309
        b = Branch.open_containing(u'.')[0]
 
310
 
307
311
        if len(revs) == 0:
308
 
            raise errors.BzrCommandError('You must supply a revision identifier')
309
 
 
310
 
        b = WorkingTree.open_containing(u'.')[0].branch
 
312
            revs.append(RevisionSpec.from_string('-1'))
311
313
 
312
314
        for rev in revs:
313
315
            revinfo = rev.in_history(b)
314
316
            if revinfo.revno is None:
315
 
                print '     %s' % revinfo.rev_id
 
317
                dotted_map = b.get_revision_id_to_revno_map()
 
318
                revno = '.'.join(str(i) for i in dotted_map[revinfo.rev_id])
 
319
                print '%s %s' % (revno, revinfo.rev_id)
316
320
            else:
317
321
                print '%4d %s' % (revinfo.revno, revinfo.rev_id)
318
322
 
669
673
    location can be accessed.
670
674
    """
671
675
 
672
 
    _see_also = ['pull', 'update']
 
676
    _see_also = ['pull', 'update', 'working-trees']
673
677
    takes_options = ['remember', 'overwrite', 'verbose',
674
678
        Option('create-prefix',
675
679
               help='Create the path leading up to the branch '
812
816
                try:
813
817
                    tree_to = dir_to.open_workingtree()
814
818
                except errors.NotLocalUrl:
815
 
                    warning('This transport does not update the working '
816
 
                            'tree of: %s' % (br_to.base,))
 
819
                    warning("This transport does not update the working " 
 
820
                            "tree of: %s. See 'bzr help working-trees' for "
 
821
                            "more information." % br_to.base)
817
822
                    push_result = br_from.push(br_to, overwrite)
818
823
                except errors.NoWorkingTree:
819
824
                    push_result = br_from.push(br_to, overwrite)
1017
1022
    'bzr revert' instead of 'bzr commit' after the update.
1018
1023
    """
1019
1024
 
1020
 
    _see_also = ['pull']
 
1025
    _see_also = ['pull', 'working-trees']
1021
1026
    takes_args = ['dir?']
1022
1027
    aliases = ['up']
1023
1028
 
1061
1066
 
1062
1067
    Branches and working trees will also report any missing revisions.
1063
1068
    """
1064
 
    _see_also = ['revno']
 
1069
    _see_also = ['revno', 'working-trees', 'repositories']
1065
1070
    takes_args = ['location?']
1066
1071
    takes_options = ['verbose']
1067
1072
 
1312
1317
class cmd_init_repository(Command):
1313
1318
    """Create a shared repository to hold branches.
1314
1319
 
1315
 
    New branches created under the repository directory will store their revisions
1316
 
    in the repository, not in the branch directory.
 
1320
    New branches created under the repository directory will store their
 
1321
    revisions in the repository, not in the branch directory.
 
1322
 
 
1323
    If the --no-trees option is used then the branches in the repository
 
1324
    will not have working trees by default.
1317
1325
 
1318
1326
    example:
1319
1327
        bzr init-repo --no-trees repo
1321
1329
        bzr checkout --lightweight repo/trunk trunk-checkout
1322
1330
        cd trunk-checkout
1323
1331
        (add files here)
 
1332
 
 
1333
    See 'bzr help repositories' for more information.
1324
1334
    """
1325
1335
 
1326
1336
    _see_also = ['init', 'branch', 'checkout']
1557
1567
        self.outf.write(tree.basedir + '\n')
1558
1568
 
1559
1569
 
 
1570
def _parse_limit(limitstring):
 
1571
    try:
 
1572
        return int(limitstring)
 
1573
    except ValueError:
 
1574
        msg = "The limit argument must be an integer."
 
1575
        raise errors.BzrCommandError(msg)
 
1576
 
 
1577
 
1560
1578
class cmd_log(Command):
1561
1579
    """Show log of a branch, file, or directory.
1562
1580
 
1587
1605
                            short_name='m',
1588
1606
                            help='show revisions whose message matches this regexp',
1589
1607
                            type=str),
 
1608
                     Option('limit', 
 
1609
                            help='limit the output to the first N revisions',
 
1610
                            type=_parse_limit),
1590
1611
                     ]
1591
1612
    encoding_type = 'replace'
1592
1613
 
1597
1618
            forward=False,
1598
1619
            revision=None,
1599
1620
            log_format=None,
1600
 
            message=None):
 
1621
            message=None,
 
1622
            limit=None):
1601
1623
        from bzrlib.log import show_log
1602
1624
        assert message is None or isinstance(message, basestring), \
1603
1625
            "invalid message argument %r" % message
1678
1700
                     direction=direction,
1679
1701
                     start_revision=rev1,
1680
1702
                     end_revision=rev2,
1681
 
                     search=message)
 
1703
                     search=message,
 
1704
                     limit=limit)
1682
1705
        finally:
1683
1706
            b.unlock()
1684
1707
 
2965
2988
    def run(self, other_branch=None, reverse=False, mine_only=False,
2966
2989
            theirs_only=False, log_format=None, long=False, short=False, line=False, 
2967
2990
            show_ids=False, verbose=False):
2968
 
        from bzrlib.missing import find_unmerged, iter_log_data
 
2991
        from bzrlib.missing import find_unmerged, iter_log_revisions
2969
2992
        from bzrlib.log import log_formatter
2970
2993
        local_branch = Branch.open_containing(u".")[0]
2971
2994
        parent = local_branch.get_parent()
2996
3019
                    remote_extra.reverse()
2997
3020
                if local_extra and not theirs_only:
2998
3021
                    print "You have %d extra revision(s):" % len(local_extra)
2999
 
                    for data in iter_log_data(local_extra, local_branch.repository,
3000
 
                                              verbose):
3001
 
                        lf.show(*data)
 
3022
                    for revision in iter_log_revisions(local_extra, 
 
3023
                                        local_branch.repository,
 
3024
                                        verbose):
 
3025
                        lf.log_revision(revision)
3002
3026
                    printed_local = True
3003
3027
                else:
3004
3028
                    printed_local = False
3006
3030
                    if printed_local is True:
3007
3031
                        print "\n\n"
3008
3032
                    print "You are missing %d revision(s):" % len(remote_extra)
3009
 
                    for data in iter_log_data(remote_extra, remote_branch.repository, 
3010
 
                                              verbose):
3011
 
                        lf.show(*data)
 
3033
                    for revision in iter_log_revisions(remote_extra, 
 
3034
                                        remote_branch.repository, 
 
3035
                                        verbose):
 
3036
                        lf.log_revision(revision)
3012
3037
                if not remote_extra and not local_extra:
3013
3038
                    status_code = 0
3014
3039
                    print "Branches are up to date."