~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Robert Collins
  • Date: 2005-10-30 00:00:09 UTC
  • mfrom: (1185.16.134)
  • Revision ID: robertc@robertcollins.net-20051030000009-9db99a338a0dfdac
MergeĀ fromĀ Martin.

Show diffs side-by-side

added added

removed removed

Lines of Context:
882
882
    """
883
883
    # TODO: Take a revision or remote path and list that tree instead.
884
884
    hidden = True
 
885
    takes_options = ['verbose', 'revision',
 
886
                     Option('non-recursive',
 
887
                            help='don\'t recurse into sub-directories'),
 
888
                     Option('from-root',
 
889
                            help='Print all paths from the root of the branch.'),
 
890
                     Option('unknown', help='Print unknown files'),
 
891
                     Option('versioned', help='Print versioned files'),
 
892
                     Option('ignored', help='Print ignored files'),
 
893
 
 
894
                     Option('null', help='Null separate the files'),
 
895
                    ]
885
896
    @display_command
886
 
    def run(self, revision=None, verbose=False):
887
 
        b, relpath = Branch.open_containing('.')[0]
 
897
    def run(self, revision=None, verbose=False, 
 
898
            non_recursive=False, from_root=False,
 
899
            unknown=False, versioned=False, ignored=False,
 
900
            null=False):
 
901
 
 
902
        if verbose and null:
 
903
            raise BzrCommandError('Cannot set both --verbose and --null')
 
904
        all = not (unknown or versioned or ignored)
 
905
 
 
906
        selection = {'I':ignored, '?':unknown, 'V':versioned}
 
907
 
 
908
        b, relpath = Branch.open_containing('.')
 
909
        if from_root:
 
910
            relpath = ''
 
911
        elif relpath:
 
912
            relpath += '/'
888
913
        if revision == None:
889
914
            tree = b.working_tree()
890
915
        else:
891
 
            tree = b.revision_tree(revision.in_history(b).rev_id)
 
916
            tree = b.revision_tree(revision[0].in_history(b).rev_id)
892
917
        for fp, fc, kind, fid, entry in tree.list_files():
893
 
            if verbose:
894
 
                kindch = entry.kind_character()
895
 
                print '%-8s %s%s' % (fc, fp, kindch)
896
 
            else:
897
 
                print fp
 
918
            if fp.startswith(relpath):
 
919
                fp = fp[len(relpath):]
 
920
                if non_recursive and '/' in fp:
 
921
                    continue
 
922
                if not all and not selection[fc]:
 
923
                    continue
 
924
                if verbose:
 
925
                    kindch = entry.kind_character()
 
926
                    print '%-8s %s%s' % (fc, fp, kindch)
 
927
                elif null:
 
928
                    sys.stdout.write(fp)
 
929
                    sys.stdout.write('\0')
 
930
                    sys.stdout.flush()
 
931
                else:
 
932
                    print fp
898
933
 
899
934
 
900
935
 
1358
1393
    --force is given.
1359
1394
    """
1360
1395
    takes_args = ['branch?']
1361
 
    takes_options = ['revision', 'force', 'merge-type', 
 
1396
    takes_options = ['revision', 'force', 'merge-type', 'reprocess',
1362
1397
                     Option('show-base', help="Show base revision text in "
1363
1398
                            "conflicts")]
1364
1399
 
1365
1400
    def run(self, branch=None, revision=None, force=False, merge_type=None,
1366
 
            show_base=False):
 
1401
            show_base=False, reprocess=False):
1367
1402
        from bzrlib.merge import merge
1368
1403
        from bzrlib.merge_core import ApplyMerge3
1369
1404
        if merge_type is None:
1395
1430
 
1396
1431
        try:
1397
1432
            conflict_count = merge(other, base, check_clean=(not force),
1398
 
                                   merge_type=merge_type,
 
1433
                                   merge_type=merge_type, reprocess=reprocess,
1399
1434
                                   show_base=show_base)
1400
1435
            if conflict_count != 0:
1401
1436
                return 1