/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-13 23:57:28 UTC
  • mfrom: (7490 work)
  • mto: This revision was merged to the branch mainline in revision 7492.
  • Revision ID: jelmer@jelmer.uk-20200213235728-m6ds0mm3mbs4y182
Merge trunk.

Show diffs side-by-side

added added

removed removed

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