~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Lukáš Lalinský
  • Date: 2008-08-31 06:51:42 UTC
  • mto: This revision was merged to the branch mainline in revision 3719.
  • Revision ID: lalinsky@gmail.com-20080831065142-dmj7vbnryqqid1tb
Make `bzr remove-tree` not remove trees with uncommitted changes by default

Show diffs side-by-side

added added

removed removed

Lines of Context:
245
245
    To re-create the working tree, use "bzr checkout".
246
246
    """
247
247
    _see_also = ['checkout', 'working-trees']
248
 
 
249
248
    takes_args = ['location?']
 
249
    takes_options = [
 
250
        Option('force',
 
251
               help='Remove the working tree even if it has '
 
252
                    'uncommitted changes.'),
 
253
        ]
250
254
 
251
 
    def run(self, location='.'):
 
255
    def run(self, location='.', force=False):
252
256
        d = bzrdir.BzrDir.open(location)
253
257
        
254
258
        try:
258
262
        except errors.NotLocalUrl:
259
263
            raise errors.BzrCommandError("You cannot remove the working tree of a "
260
264
                                         "remote path")
261
 
        
 
265
        if not force:
 
266
            changes = working.changes_from(working.basis_tree())
 
267
            if changes.has_changed():
 
268
                raise errors.UncommittedChanges(working)
 
269
 
262
270
        working_path = working.bzrdir.root_transport.base
263
271
        branch_path = working.branch.bzrdir.root_transport.base
264
272
        if working_path != branch_path: