~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: 2008-09-21 01:21:05 UTC
  • mfrom: (3667.2.1 remove_tree_changed_wt)
  • Revision ID: pqm@pqm.ubuntu.com-20080921012105-ote1u11mokjim9ir
make  halt on uncommitted changes (luks)

Show diffs side-by-side

added added

removed removed

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