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

  • Committer: Jelmer Vernooij
  • Date: 2020-05-06 02:13:25 UTC
  • mfrom: (7490.7.21 work)
  • mto: This revision was merged to the branch mainline in revision 7501.
  • Revision ID: jelmer@jelmer.uk-20200506021325-awbmmqu1zyorz7sj
Merge 3.1 branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
223
223
        """See ControlDir.clone_on_transport."""
224
224
        from ..repository import InterRepository
225
225
        from .mapping import default_mapping
 
226
        from ..transport.local import LocalTransport
226
227
        if stacked_on is not None:
227
228
            raise _mod_branch.UnstackableBranchFormat(
228
229
                self._format, self.user_url)
248
249
                                                       mapping=default_mapping)
249
250
        for name, val in refs.items():
250
251
            target_git_repo.refs[name] = val
251
 
        result_dir = self.__class__(transport, target_git_repo, format)
 
252
        result_dir = LocalGitDir(transport, target_git_repo, format)
252
253
        if revision_id is not None:
253
254
            result_dir.open_branch().set_last_revision(revision_id)
254
 
        try:
255
 
            # Cheaper to check if the target is not local, than to try making
256
 
            # the tree and fail.
257
 
            result_dir.root_transport.local_abspath('.')
 
255
        if not no_tree and isinstance(result_dir.root_transport, LocalTransport):
258
256
            if result_dir.open_repository().make_working_trees():
259
 
                self.open_workingtree().clone(
260
 
                    result_dir, revision_id=revision_id)
261
 
        except (brz_errors.NoWorkingTree, brz_errors.NotLocalUrl):
262
 
            pass
 
257
                try:
 
258
                    local_wt = self.open_workingtree()
 
259
                except brz_errors.NoWorkingTree:
 
260
                    pass
 
261
                except brz_errors.NotLocalUrl:
 
262
                    result_dir.create_workingtree(revision_id=revision_id)
 
263
                else:
 
264
                    local_wt.clone(result_dir, revision_id=revision_id)
263
265
 
264
266
        return result_dir
265
267
 
294
296
        """
295
297
        return UseExistingRepository(self.find_repository())
296
298
 
 
299
    def branch_names(self):
 
300
        from .refs import ref_to_branch_name
 
301
        ret = []
 
302
        for ref in self.get_refs_container().keys():
 
303
            try:
 
304
                branch_name = ref_to_branch_name(ref)
 
305
            except UnicodeDecodeError:
 
306
                trace.warning("Ignoring branch %r with unicode error ref", ref)
 
307
                continue
 
308
            except ValueError:
 
309
                continue
 
310
            ret.append(branch_name)
 
311
        return ret
 
312
 
297
313
    def get_branches(self):
298
314
        from .refs import ref_to_branch_name
299
315
        ret = {}