~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/errors.py

  • Committer: Marius Kruger
  • Date: 2007-04-16 01:00:20 UTC
  • mto: This revision was merged to the branch mainline in revision 2455.
  • Revision ID: amanic@gmail.com-20070416010020-3jan8hje4qmbwdsh
* Add utility method delta.get_changes_as_text to get the output of .show()
  as a string.
* Add new errors.BzrRemoveChangedFilesError to raise when 'bzr remove'
  should refuse to delete stuff.
* Add workingtree.canicalpath(filename) to normalize file names.
* Changed the working of workingtree.remove(...) to check if any files
  are changed before it starts deleting anything. Will raise exception
  now if changed files are passed to be removed.
* workingtree_implementations/test_remove.py
  - Checked all tests and add more cases.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1521
1521
    def __init__(self, from_path, to_path, extra=None):
1522
1522
        BzrMoveFailedError.__init__(self, from_path, to_path, extra)
1523
1523
 
1524
 
 
 
1524
class BzrRemoveChangedFilesError(BzrError):
 
1525
    """Used when user is trying to remove changed files."""
 
1526
 
 
1527
    _fmt = ("Can't remove changed or unknown files:\n%(changes_as_text)s"
 
1528
        "Use --keep to not delete them, or --force to delete them regardless.")
 
1529
 
 
1530
    def __init__(self, tree_delta):
 
1531
        BzrError.__init__(self)
 
1532
        self.changes_as_text = tree_delta.get_changes_as_text()
 
1533
        #self.paths_as_string = '\n'.join(changed_files)
 
1534
        #self.paths_as_string = '\n'.join([quotefn(p) for p in changed_files])
 
1535
        
 
1536
    
1525
1537
class BzrBadParameterNotString(BzrBadParameter):
1526
1538
 
1527
1539
    _fmt = "Parameter %(param)s is not a string or unicode string."