~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Aaron Bentley
  • Date: 2005-10-19 19:52:11 UTC
  • mfrom: (1185.16.76)
  • mto: (1185.25.1)
  • mto: This revision was merged to the branch mainline in revision 1474.
  • Revision ID: abentley@panoramicfeedback.com-20051019195211-df4e4a8f8608f8fe
MergeĀ fromĀ mainline

Show diffs side-by-side

added added

removed removed

Lines of Context:
70
70
    If a revision argument is given, the status is calculated against
71
71
    that revision, or between two revisions if two are provided.
72
72
    """
 
73
    
73
74
    # XXX: FIXME: bzr status should accept a -r option to show changes
74
75
    # relative to a revision, or between revisions
75
76
 
 
77
    # TODO: --no-recurse, --recurse options
 
78
    
76
79
    takes_args = ['file*']
77
80
    takes_options = ['all', 'show-ids']
78
81
    aliases = ['st', 'stat']
1010
1013
    """
1011
1014
    # TODO: Run hooks on tree to-be-committed, and after commit.
1012
1015
 
1013
 
    # TODO: Strict commit that fails if there are unknown or deleted files.
 
1016
    # TODO: Strict commit that fails if there are deleted files.
 
1017
    #       (what does "deleted files" mean ??)
 
1018
 
1014
1019
    # TODO: Give better message for -s, --summary, used by tla people
1015
1020
 
1016
1021
    # XXX: verbose currently does nothing
1022
1027
                     Option('file', type=str, 
1023
1028
                            argname='msgfile',
1024
1029
                            help='file containing commit message'),
 
1030
                     Option('strict',
 
1031
                            help="refuse to commit if there are unknown "
 
1032
                            "files in the working tree."),
1025
1033
                     ]
1026
1034
    aliases = ['ci', 'checkin']
1027
1035
 
1028
1036
    def run(self, message=None, file=None, verbose=True, selected_list=None,
1029
 
            unchanged=False):
1030
 
        from bzrlib.errors import PointlessCommit, ConflictsInTree
 
1037
            unchanged=False, strict=False):
 
1038
        from bzrlib.errors import (PointlessCommit, ConflictsInTree,
 
1039
                StrictCommitFailed)
1031
1040
        from bzrlib.msgeditor import edit_commit_message
1032
1041
        from bzrlib.status import show_status
1033
1042
        from cStringIO import StringIO
1056
1065
                raise BzrCommandError("empty commit message specified")
1057
1066
            
1058
1067
        try:
1059
 
            b.commit(message,
1060
 
                     specific_files=selected_list,
1061
 
                     allow_pointless=unchanged)
 
1068
            b.commit(message, specific_files=selected_list,
 
1069
                     allow_pointless=unchanged, strict=strict)
1062
1070
        except PointlessCommit:
1063
1071
            # FIXME: This should really happen before the file is read in;
1064
1072
            # perhaps prepare the commit; get the message; then actually commit
1067
1075
        except ConflictsInTree:
1068
1076
            raise BzrCommandError("Conflicts detected in working tree.  "
1069
1077
                'Use "bzr conflicts" to list, "bzr resolve FILE" to resolve.')
 
1078
        except StrictCommitFailed:
 
1079
            raise BzrCommandError("Commit refused because there are unknown "
 
1080
                                  "files in the working tree.")
1070
1081
 
1071
1082
 
1072
1083
class cmd_check(Command):