/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: Vincent Ladeuil
  • Date: 2009-01-18 18:11:27 UTC
  • mto: (0.152.55 trunk)
  • mto: This revision was merged to the branch mainline in revision 6649.
  • Revision ID: v.ladeuil+lp@free.fr-20090118181127-b6qe325j3rtrfcw3
Bzr has facilities for exceptions, let's use them.

* __init__.py:
(CannotUploadToWorkingTreeError): Use bzr exception facilities.

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
class CannotUploadToWorkingTreeError(errors.BzrCommandError):
 
327
 
 
328
    _fmt = 'Cannot upload to a bzr managed working tree: %(url)s".'
 
329
 
 
330
    def __init__(self, url):
 
331
        super(CannotUploadToWorkingTreeError, self).__init__(self)
 
332
        self.url = url
 
333
 
328
334
 
329
335
class cmd_upload(commands.Command):
330
336
    """Upload a working tree, as a whole or incrementally.
356
362
        if directory is None:
357
363
            directory = u'.'
358
364
 
359
 
        wt, branch, relpath = \
360
 
            bzrdir.BzrDir.open_containing_tree_or_branch(directory)
 
365
        (wt, branch,
 
366
         relpath) = bzrdir.BzrDir.open_containing_tree_or_branch(directory)
361
367
 
362
368
        if wt:
363
369
            changes = wt.changes_from(wt.basis_tree())
386
392
        except errors.NotBranchError:
387
393
            has_wt = False
388
394
        except errors.NotLocalUrl:
 
395
            # The exception raised is a bit weird... but that's life.
389
396
            has_wt = True
390
397
 
391
398
        if has_wt:
392
 
            raise CannotUploadToWT('Cannot upload to %s as it has a'
393
 
                                          ' working directory.' % (location))
 
399
            raise CannotUploadToWorkingTreeError(location)
394
400
 
395
401
        if revision is None:
396
402
            rev_id = branch.last_revision()