~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-03-22 12:17:00 UTC
  • mfrom: (1616.1.10 bzr.mbp.integration)
  • Revision ID: pqm@pqm.ubuntu.com-20060322121700-79ce0be81013aba1
(mbp) pycurl fixes, other fixes, weave commands, verbose commit changes from robert

Show diffs side-by-side

added added

removed removed

Lines of Context:
326
326
                print path
327
327
 
328
328
 
329
 
class cmd_move(Command):
330
 
    """Move files to a different directory.
331
 
 
332
 
    examples:
333
 
        bzr move *.txt doc
334
 
 
335
 
    The destination must be a versioned directory in the same branch.
336
 
    """
337
 
    takes_args = ['source$', 'dest']
338
 
    def run(self, source_list, dest):
339
 
        tree, source_list = tree_files(source_list)
340
 
        # TODO: glob expansion on windows?
341
 
        tree.move(source_list, tree.relpath(dest))
342
 
 
343
 
 
344
 
class cmd_rename(Command):
345
 
    """Change the name of an entry.
346
 
 
347
 
    examples:
348
 
      bzr rename frob.c frobber.c
349
 
      bzr rename src/frob.c lib/frob.c
350
 
 
351
 
    It is an error if the destination name exists.
352
 
 
353
 
    See also the 'move' command, which moves files into a different
354
 
    directory without changing their name.
355
 
    """
356
 
    # TODO: Some way to rename multiple files without invoking 
357
 
    # bzr for each one?"""
358
 
    takes_args = ['from_name', 'to_name']
359
 
    
360
 
    def run(self, from_name, to_name):
361
 
        tree, (from_name, to_name) = tree_files((from_name, to_name))
362
 
        tree.rename_one(from_name, to_name)
363
 
 
364
 
 
365
329
class cmd_mv(Command):
366
330
    """Move or rename a file.
367
331
 
376
340
    Files cannot be moved between branches.
377
341
    """
378
342
    takes_args = ['names*']
 
343
    aliases = ['move', 'rename']
 
344
 
379
345
    def run(self, names_list):
380
346
        if len(names_list) < 2:
381
347
            raise BzrCommandError("missing file argument")
1477
1443
 
1478
1444
    def run(self, message=None, file=None, verbose=True, selected_list=None,
1479
1445
            unchanged=False, strict=False, local=False):
 
1446
        from bzrlib.commit import (NullCommitReporter, ReportCommitToLog)
1480
1447
        from bzrlib.errors import (PointlessCommit, ConflictsInTree,
1481
1448
                StrictCommitFailed)
1482
1449
        from bzrlib.msgeditor import edit_commit_message, \
1510
1477
 
1511
1478
        if message == "":
1512
1479
                raise BzrCommandError("empty commit message specified")
1513
 
            
 
1480
        
 
1481
        if verbose:
 
1482
            reporter = ReportCommitToLog()
 
1483
        else:
 
1484
            reporter = NullCommitReporter()
 
1485
        
1514
1486
        try:
1515
1487
            tree.commit(message, specific_files=selected_list,
1516
 
                        allow_pointless=unchanged, strict=strict, local=local)
 
1488
                        allow_pointless=unchanged, strict=strict, local=local,
 
1489
                        reporter=reporter)
1517
1490
        except PointlessCommit:
1518
1491
            # FIXME: This should really happen before the file is read in;
1519
1492
            # perhaps prepare the commit; get the message; then actually commit
1530
1503
                                  + ' Either unbind, update, or'
1531
1504
                                    ' pass --local to commit.')
1532
1505
 
1533
 
        note('Committed revision %d.' % (tree.branch.revno(),))
1534
 
 
1535
1506
 
1536
1507
class cmd_check(Command):
1537
1508
    """Validate consistency of branch history.
2426
2397
# these get imported and then picked up by the scan for cmd_*
2427
2398
# TODO: Some more consistent way to split command definitions across files;
2428
2399
# we do need to load at least some information about them to know of 
2429
 
# aliases.
 
2400
# aliases.  ideally we would avoid loading the implementation until the
 
2401
# details were needed.
2430
2402
from bzrlib.conflicts import cmd_resolve, cmd_conflicts, restore
2431
2403
from bzrlib.sign_my_commits import cmd_sign_my_commits
 
2404
from bzrlib.weave_commands import cmd_weave_list, cmd_weave_join