~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: John Arbash Meinel
  • Date: 2010-08-23 17:54:07 UTC
  • mfrom: (5387 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5390.
  • Revision ID: john@arbash-meinel.com-20100823175407-yomx2h1x5v8amt6w
Merge bzr.dev 5387 in prep for NEWS

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 
21
21
from bzrlib.lazy_import import lazy_import
22
22
lazy_import(globals(), """
23
 
import codecs
24
23
import cStringIO
25
24
import sys
26
25
import time
1478
1477
class cmd_remove(Command):
1479
1478
    __doc__ = """Remove files or directories.
1480
1479
 
1481
 
    This makes bzr stop tracking changes to the specified files. bzr will delete
1482
 
    them if they can easily be recovered using revert. If no options or
1483
 
    parameters are given bzr will scan for files that are being tracked by bzr
1484
 
    but missing in your tree and stop tracking them for you.
 
1480
    This makes Bazaar stop tracking changes to the specified files. Bazaar will
 
1481
    delete them if they can easily be recovered using revert otherwise they
 
1482
    will be backed up (adding an extention of the form .~#~). If no options or
 
1483
    parameters are given Bazaar will scan for files that are being tracked by
 
1484
    Bazaar but missing in your tree and stop tracking them for you.
1485
1485
    """
1486
1486
    takes_args = ['file*']
1487
1487
    takes_options = ['verbose',
1489
1489
        RegistryOption.from_kwargs('file-deletion-strategy',
1490
1490
            'The file deletion mode to be used.',
1491
1491
            title='Deletion Strategy', value_switches=True, enum_switch=False,
1492
 
            safe='Only delete files if they can be'
1493
 
                 ' safely recovered (default).',
 
1492
            safe='Backup changed files (default).',
1494
1493
            keep='Delete from bzr but leave the working copy.',
1495
1494
            force='Delete all the specified files, even if they can not be '
1496
1495
                'recovered and even if they are non-empty directories.')]
1593
1592
 
1594
1593
    _see_also = ['check']
1595
1594
    takes_args = ['branch?']
 
1595
    takes_options = [
 
1596
        Option('canonicalize-chks',
 
1597
               help='Make sure CHKs are in canonical form (repairs '
 
1598
                    'bug 522637).',
 
1599
               hidden=True),
 
1600
        ]
1596
1601
 
1597
 
    def run(self, branch="."):
 
1602
    def run(self, branch=".", canonicalize_chks=False):
1598
1603
        from bzrlib.reconcile import reconcile
1599
1604
        dir = bzrdir.BzrDir.open(branch)
1600
 
        reconcile(dir)
 
1605
        reconcile(dir, canonicalize_chks=canonicalize_chks)
1601
1606
 
1602
1607
 
1603
1608
class cmd_revision_history(Command):
1879
1884
        Same as 'bzr diff' but prefix paths with old/ and new/::
1880
1885
 
1881
1886
            bzr diff --prefix old/:new/
 
1887
            
 
1888
        Show the differences using a custom diff program with options::
 
1889
        
 
1890
            bzr diff --using /usr/bin/diff --diff-options -wu
1882
1891
    """
1883
1892
    _see_also = ['status']
1884
1893
    takes_args = ['file*']
1885
1894
    takes_options = [
1886
1895
        Option('diff-options', type=str,
1887
 
               help='Pass these options to the diff program.'),
 
1896
               help='Pass these options to the external diff program.'),
1888
1897
        Option('prefix', type=str,
1889
1898
               short_name='p',
1890
1899
               help='Set prefixes added to old and new filenames, as '
1931
1940
                '--prefix expects two values separated by a colon'
1932
1941
                ' (eg "old/:new/")')
1933
1942
 
1934
 
        if using is not None and diff_options is not None:
1935
 
            raise errors.BzrCommandError(
1936
 
            '--diff-options and --using are mutually exclusive.')
1937
 
 
1938
1943
        if revision and len(revision) > 2:
1939
1944
            raise errors.BzrCommandError('bzr diff --revision takes exactly'
1940
1945
                                         ' one or two revision specifiers')
3135
3140
        def get_message(commit_obj):
3136
3141
            """Callback to get commit message"""
3137
3142
            if file:
3138
 
                f = codecs.open(file, 'rt', osutils.get_user_encoding())
 
3143
                f = open(file)
3139
3144
                try:
3140
 
                    my_message = f.read()
 
3145
                    my_message = f.read().decode(osutils.get_user_encoding())
3141
3146
                finally:
3142
3147
                    f.close()
3143
3148
            elif message is not None: