~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Robert Collins
  • Date: 2005-10-18 13:11:57 UTC
  • mfrom: (1185.16.72) (0.2.1)
  • Revision ID: robertc@robertcollins.net-20051018131157-76a9970aa78e927e
Merged Martin.

Show diffs side-by-side

added added

removed removed

Lines of Context:
985
985
    """
986
986
    # TODO: Run hooks on tree to-be-committed, and after commit.
987
987
 
988
 
    # TODO: Strict commit that fails if there are unknown or deleted files.
 
988
    # TODO: Strict commit that fails if there are deleted files.
 
989
    #       (what does "deleted files" mean ??)
 
990
 
989
991
    # TODO: Give better message for -s, --summary, used by tla people
990
992
 
991
993
    # XXX: verbose currently does nothing
997
999
                     Option('file', type=str, 
998
1000
                            argname='msgfile',
999
1001
                            help='file containing commit message'),
 
1002
                     Option('strict',
 
1003
                            help="refuse to commit if there are unknown "
 
1004
                            "files in the working tree."),
1000
1005
                     ]
1001
1006
    aliases = ['ci', 'checkin']
1002
1007
 
1003
1008
    def run(self, message=None, file=None, verbose=True, selected_list=None,
1004
 
            unchanged=False):
1005
 
        from bzrlib.errors import PointlessCommit, ConflictsInTree
 
1009
            unchanged=False, strict=False):
 
1010
        from bzrlib.errors import (PointlessCommit, ConflictsInTree,
 
1011
                StrictCommitFailed)
1006
1012
        from bzrlib.msgeditor import edit_commit_message
1007
1013
        from bzrlib.status import show_status
1008
1014
        from cStringIO import StringIO
1031
1037
                raise BzrCommandError("empty commit message specified")
1032
1038
            
1033
1039
        try:
1034
 
            b.commit(message,
1035
 
                     specific_files=selected_list,
1036
 
                     allow_pointless=unchanged)
 
1040
            b.commit(message, specific_files=selected_list,
 
1041
                     allow_pointless=unchanged, strict=strict)
1037
1042
        except PointlessCommit:
1038
1043
            # FIXME: This should really happen before the file is read in;
1039
1044
            # perhaps prepare the commit; get the message; then actually commit
1042
1047
        except ConflictsInTree:
1043
1048
            raise BzrCommandError("Conflicts detected in working tree.  "
1044
1049
                'Use "bzr conflicts" to list, "bzr resolve FILE" to resolve.')
 
1050
        except StrictCommitFailed:
 
1051
            raise BzrCommandError("Commit refused because there are unknown "
 
1052
                                  "files in the working tree.")
1045
1053
 
1046
1054
 
1047
1055
class cmd_check(Command):