~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commands.py

  • Committer: Martin Pool
  • Date: 2005-07-11 03:40:02 UTC
  • Revision ID: mbp@sourcefrog.net-20050711034002-575d84b4c7514542
- commit command refuses unless something is changed or --unchanged is given

Show diffs side-by-side

added added

removed removed

Lines of Context:
1095
1095
    TODO: Strict commit that fails if there are unknown or deleted files.
1096
1096
    """
1097
1097
    takes_args = ['selected*']
1098
 
    takes_options = ['message', 'file', 'verbose']
 
1098
    takes_options = ['message', 'file', 'verbose', 'unchanged']
1099
1099
    aliases = ['ci', 'checkin']
1100
1100
 
1101
 
    def run(self, message=None, file=None, verbose=True, selected_list=None):
1102
 
        from bzrlib.commit import commit
 
1101
    def run(self, message=None, file=None, verbose=True, selected_list=None,
 
1102
            unchanged=False):
 
1103
        from bzrlib.errors import PointlessCommit
1103
1104
        from bzrlib.osutils import get_text_message
1104
1105
 
1105
1106
        ## Warning: shadows builtin file()
1124
1125
            message = codecs.open(file, 'rt', bzrlib.user_encoding).read()
1125
1126
 
1126
1127
        b = find_branch('.')
1127
 
        commit(b, message, verbose=verbose, specific_files=selected_list)
 
1128
 
 
1129
        try:
 
1130
            b.commit(message, verbose=verbose,
 
1131
                     specific_files=selected_list,
 
1132
                     allow_pointless=unchanged)
 
1133
        except PointlessCommit:
 
1134
            raise BzrCommandError("no changes to commit",
 
1135
                                  ["use --unchanged to commit anyhow"])
1128
1136
 
1129
1137
 
1130
1138
class cmd_check(Command):
1344
1352
    'verbose':                None,
1345
1353
    'version':                None,
1346
1354
    'email':                  None,
 
1355
    'unchanged':              None,
1347
1356
    'update':                 None,
1348
1357
    'long':                   None,
1349
1358
    'root':                   str,