/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 __init__.py

  • Committer: Gary van der Merwe
  • Date: 2009-01-11 23:15:04 UTC
  • mto: (0.152.55 trunk)
  • mto: This revision was merged to the branch mainline in revision 6649.
  • Revision ID: garyvdm@gmail.com-20090111231504-qkhsly131cmqsbeh
Add a check to make sure we are not uploading to an existing wt.

Show diffs side-by-side

added added

removed removed

Lines of Context:
323
323
        finally:
324
324
            self.tree.unlock()
325
325
 
 
326
class CannotUploadToWT(errors.BzrCommandError):
 
327
    pass
326
328
 
327
329
class cmd_upload(commands.Command):
328
330
    """Upload a working tree, as a whole or incrementally.
376
378
                location = stored_loc
377
379
 
378
380
        to_transport = transport.get_transport(location)
 
381
 
 
382
        # Check that we are not uploading to a existing working tree.
 
383
        try:
 
384
            to_bzr_dir = bzrdir.BzrDir.open_from_transport(to_transport)
 
385
            has_wt = to_bzr_dir.has_workingtree()
 
386
        except errors.NotBranchError:
 
387
            has_wt = False
 
388
        except errors.NotLocalUrl:
 
389
            has_wt = True
 
390
 
 
391
        if has_wt:
 
392
            raise CannotUploadToWT('Cannot upload to %s as it has a'
 
393
                                          ' working directory.' % (location))
 
394
 
379
395
        if revision is None:
380
396
            rev_id = branch.last_revision()
381
397
        else: