~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to bzrtools.py

  • Committer: Aaron Bentley
  • Date: 2008-05-30 02:30:22 UTC
  • Revision ID: aaron@aaronbentley.com-20080530023022-l2fzmlvuzkotwnhv
Remove baz-import

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
 
26
26
import bzrlib
27
27
from bzrlib import revision as _mod_revision, trace, urlutils
 
28
import bzrlib.errors
28
29
from bzrlib.errors import (
29
30
    BzrCommandError,
30
31
    BzrError,
 
32
    ConnectionError,
31
33
    NotBranchError,
32
34
    NoSuchFile,
 
35
    NoWorkingTree,
 
36
    PermissionDenied,
 
37
    UnsupportedFormatError,
 
38
    TransportError,
33
39
    )
34
 
from bzrlib.bzrdir import BzrDir
 
40
from bzrlib.bzrdir import BzrDir, BzrDirFormat
35
41
from bzrlib.transport import get_transport
36
42
 
37
43
def temp_tree():
196
202
 
197
203
class NotStandalone(BzrError):
198
204
 
199
 
    _fmt = '%(location)s is not a standalone tree.'
 
205
    _format = '%(location) is not a standalone tree.'
200
206
    _internal = False
201
207
 
202
208
    def __init__(self, location):
297
303
        if working_tree:
298
304
            clean, non_source = is_clean(tree)
299
305
            if not clean:
300
 
                raise BzrCommandError(
 
306
                raise bzrlib.errors.BzrCommandError(
301
307
                    'This tree has uncommitted changes or unknown'
302
308
                    ' (?) files.  Use "bzr status" to list them.')
303
309
                sys.exit(1)
313
319
            try:
314
320
                if not history_subset(push_location, tree.branch,
315
321
                                      _rsync=my_rsync):
316
 
                    raise BzrCommandError(
 
322
                    raise bzrlib.errors.BzrCommandError(
317
323
                        "Local branch is not a newer version of remote"
318
324
                        " branch.")
319
325
            except RsyncNoFile:
320
326
                if not empty_or_absent(push_location):
321
 
                    raise BzrCommandError(
 
327
                    raise bzrlib.errors.BzrCommandError(
322
328
                        "Remote location is not a bzr branch (or empty"
323
329
                        " directory)")
324
330
            except RsyncStreamIO:
325
 
                raise BzrCommandError("Rsync could not use the"
 
331
                raise bzrlib.errors.BzrCommandError("Rsync could not use the"
326
332
                    " specified location.  Please ensure that"
327
333
                    ' "%s" is of the form "machine:/path".' % push_location)
328
334
        trace.note("Pushing to %s", push_location)
349
355
    t._remote_path = lambda x: t.base
350
356
    try:
351
357
        lines = t.get('')
352
 
    except NoSuchFile:
 
358
    except bzrlib.errors.NoSuchFile:
353
359
        return
354
360
    expr = re.compile('<a[^>]*href="([^>]*)\/"[^>]*>', flags=re.I)
355
361
    for line in lines:
402
408
def open_from_url(location):
403
409
    location = urlutils.normalize_url(location)
404
410
    dirname, basename = urlutils.split(location)
405
 
    if location.endswith('/') and not basename.endswith('/'):
406
 
        basename += '/'
407
411
    return get_transport(dirname).get(basename)
408
412
 
409
413