/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 breezy/git/commands.py

  • Committer: Jelmer Vernooij
  • Date: 2020-02-18 01:57:45 UTC
  • mto: This revision was merged to the branch mainline in revision 7493.
  • Revision ID: jelmer@jelmer.uk-20200218015745-q2ss9tsk74h4nh61
drop use of future.

Show diffs side-by-side

added added

removed removed

Lines of Context:
87
87
            )
88
88
        from ..errors import (
89
89
            BzrError,
90
 
            CommandError,
 
90
            BzrCommandError,
91
91
            NoRepositoryPresent,
92
92
            NotBranchError,
93
93
            )
115
115
 
116
116
        source_repo = Repository.open(src_location)
117
117
        if not isinstance(source_repo, GitRepository):
118
 
            raise CommandError(
 
118
            raise BzrCommandError(
119
119
                gettext("%r is not a git repository") % src_location)
120
120
        try:
121
121
            target_controldir = ControlDir.open_from_transport(dest_transport)
128
128
            target_repo = target_controldir.create_repository(shared=True)
129
129
 
130
130
        if not target_repo.supports_rich_root():
131
 
            raise CommandError(
 
131
            raise BzrCommandError(
132
132
                gettext("Target repository doesn't support rich roots"))
133
133
 
134
134
        interrepo = InterRepository.get(source_repo, target_repo)
187
187
    @display_command
188
188
    def run(self, sha1=None, directory=".", pretty=False):
189
189
        from ..errors import (
190
 
            CommandError,
 
190
            BzrCommandError,
191
191
            )
192
192
        from ..controldir import (
193
193
            ControlDir,
204
204
                try:
205
205
                    obj = object_store[sha1.encode('ascii')]
206
206
                except KeyError:
207
 
                    raise CommandError(
 
207
                    raise BzrCommandError(
208
208
                        gettext("Object not found: %s") % sha1)
209
209
                if pretty:
210
210
                    text = obj.as_pretty_string()
304
304
    def run(self, target, package, directory='.'):
305
305
        from ..branch import Branch
306
306
        from ..errors import (
307
 
            CommandError,
 
307
            BzrCommandError,
308
308
            NoSuchRevision,
309
309
            )
310
310
        from ..trace import warning
311
311
        from ..repository import Repository
312
 
        from .mapping import encode_git_path
313
312
        from .object_store import get_object_store
314
313
        from .pristine_tar import (
315
314
            revision_pristine_tar_data,
319
318
        target_bzr = Repository.open(target)
320
319
        target = getattr(target_bzr, '_git', None)
321
320
        if target is None:
322
 
            raise CommandError("Target not a git repository")
 
321
            raise BzrCommandError("Target not a git repository")
323
322
        git_store = get_object_store(source.repository)
324
323
        with git_store.lock_read():
325
324
            tag_dict = source.tags.get_tag_dict()
346
345
                    warning(
347
346
                        "base git id %s for %s missing in target repository",
348
347
                        gitid, filename)
349
 
                store_git_pristine_tar_data(target, encode_git_path(filename),
 
348
                store_git_pristine_tar_data(target, filename.encode('utf-8'),
350
349
                                            delta, gitid)