~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Andrew Bennetts
  • Date: 2010-10-13 00:26:41 UTC
  • mto: This revision was merged to the branch mainline in revision 5498.
  • Revision ID: andrew.bennetts@canonical.com-20101013002641-9tlh9k89mlj1666m
Keep docs-plain working.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
from bzrlib.lazy_import import lazy_import
22
22
lazy_import(globals(), """
23
23
import cStringIO
24
 
import itertools
25
 
import re
26
24
import sys
27
25
import time
28
26
 
1507
1505
            title='Deletion Strategy', value_switches=True, enum_switch=False,
1508
1506
            safe='Backup changed files (default).',
1509
1507
            keep='Delete from bzr but leave the working copy.',
1510
 
            no_backup='Don\'t backup changed files.',
1511
1508
            force='Delete all the specified files, even if they can not be '
1512
 
                'recovered and even if they are non-empty directories. '
1513
 
                '(deprecated, use no-backup)')]
 
1509
                'recovered and even if they are non-empty directories.')]
1514
1510
    aliases = ['rm', 'del']
1515
1511
    encoding_type = 'replace'
1516
1512
 
1517
1513
    def run(self, file_list, verbose=False, new=False,
1518
1514
        file_deletion_strategy='safe'):
1519
 
        if file_deletion_strategy == 'force':
1520
 
            note("(The --force option is deprecated, rather use --no-backup "
1521
 
                "in future.)")
1522
 
            file_deletion_strategy = 'no-backup'
1523
 
 
1524
1515
        tree, file_list = WorkingTree.open_containing_paths(file_list)
1525
1516
 
1526
1517
        if file_list is not None:
1547
1538
            file_deletion_strategy = 'keep'
1548
1539
        tree.remove(file_list, verbose=verbose, to_file=self.outf,
1549
1540
            keep_files=file_deletion_strategy=='keep',
1550
 
            force=(file_deletion_strategy=='no-backup'))
 
1541
            force=file_deletion_strategy=='force')
1551
1542
 
1552
1543
 
1553
1544
class cmd_file_id(Command):
5406
5397
            help='Branch whose tags should be displayed.'),
5407
5398
        RegistryOption.from_kwargs('sort',
5408
5399
            'Sort tags by different criteria.', title='Sorting',
5409
 
            natural='Sort numeric substrings as numbers:'
5410
 
                    ' suitable for version numbers. (default)',
5411
 
            alpha='Sort tags lexicographically.',
 
5400
            alpha='Sort tags lexicographically (default).',
5412
5401
            time='Sort tags chronologically.',
5413
5402
            ),
5414
5403
        'show-ids',
5418
5407
    @display_command
5419
5408
    def run(self,
5420
5409
            directory='.',
5421
 
            sort='natural',
 
5410
            sort='alpha',
5422
5411
            show_ids=False,
5423
5412
            revision=None,
5424
5413
            ):
5436
5425
            # only show revisions between revid1 and revid2 (inclusive)
5437
5426
            tags = [(tag, revid) for tag, revid in tags if
5438
5427
                graph.is_between(revid, revid1, revid2)]
5439
 
        if sort == 'natural':
5440
 
            def natural_sort_key(tag):
5441
 
                return [f(s) for f,s in 
5442
 
                        zip(itertools.cycle((unicode.lower,int)),
5443
 
                                            re.split('([0-9]+)', tag[0]))]
5444
 
            tags.sort(key=natural_sort_key)
5445
 
        elif sort == 'alpha':
 
5428
        if sort == 'alpha':
5446
5429
            tags.sort()
5447
5430
        elif sort == 'time':
5448
5431
            timestamps = {}