/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/commands.py

  • Committer: Martin Pool
  • Date: 2005-07-25 21:54:01 UTC
  • Revision ID: mbp@sourcefrog.net-20050725215401-0bed2682b7fee8b5
- fix bugs and add tests for doing commit of selected directories

Show diffs side-by-side

added added

removed removed

Lines of Context:
1184
1184
 
1185
1185
class cmd_commit(Command):
1186
1186
    """Commit changes into a new revision.
 
1187
    
 
1188
    If no arguments are given, the entire tree is committed.
1187
1189
 
1188
1190
    If selected files are specified, only changes to those files are
1189
 
    committed.  If a directory is specified then its contents are also
1190
 
    committed.
 
1191
    committed.  If a directory is specified then the directory and everything 
 
1192
    within it is committed.
1191
1193
 
1192
1194
    A selected-file commit may fail in some cases where the committed
1193
1195
    tree would be invalid, such as trying to commit a file in a
1201
1203
    takes_options = ['message', 'file', 'verbose', 'unchanged']
1202
1204
    aliases = ['ci', 'checkin']
1203
1205
 
 
1206
    # TODO: Give better message for -s, --summary, used by tla people
 
1207
    
1204
1208
    def run(self, message=None, file=None, verbose=True, selected_list=None,
1205
1209
            unchanged=False):
1206
1210
        from bzrlib.errors import PointlessCommit
1208
1212
 
1209
1213
        ## Warning: shadows builtin file()
1210
1214
        if not message and not file:
 
1215
            # FIXME: Ugly; change status code to send to a provided function?
 
1216
            
1211
1217
            import cStringIO
1212
1218
            stdout = sys.stdout
1213
1219
            catcher = cStringIO.StringIO()
1228
1234
            message = codecs.open(file, 'rt', bzrlib.user_encoding).read()
1229
1235
 
1230
1236
        b = find_branch('.')
 
1237
        if selected_list:
 
1238
            selected_list = [b.relpath(s) for s in selected_list]
 
1239
        else:
 
1240
            selected_list = [b.relpath('.')]
 
1241
        if selected_list == ['.']:
 
1242
            selected_list = None
1231
1243
 
1232
1244
        try:
1233
1245
            b.commit(message, verbose=verbose,