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

  • Committer: Jelmer Vernooij
  • Date: 2020-07-18 23:14:00 UTC
  • mfrom: (7490.40.62 work)
  • mto: This revision was merged to the branch mainline in revision 7519.
  • Revision ID: jelmer@jelmer.uk-20200718231400-jaes9qltn8oi8xss
Merge lp:brz/3.1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
76
76
    NoSuchRef,
77
77
    )
78
78
from .mapping import (
 
79
    encode_git_path,
79
80
    mapping_registry,
80
81
    )
81
82
from .object_store import (
203
204
    if re.match('(.+) is not a valid repository name',
204
205
                message.splitlines()[0]):
205
206
        return NotBranchError(url, message)
 
207
    if message == (
 
208
            'GitLab: You are not allowed to push code to protected branches '
 
209
            'on this project.'):
 
210
        return PermissionDenied(url, message)
206
211
    m = re.match(r'Permission to ([^ ]+) denied to ([^ ]+)\.', message)
207
212
    if m:
208
213
        return PermissionDenied(m.group(1), 'denied to %s' % m.group(2))
429
434
                write_error,
430
435
                format=(format.encode('ascii') if format else None),
431
436
                subdirs=subdirs,
432
 
                prefix=(prefix.encode('utf-8') if prefix else None))
 
437
                prefix=(encode_git_path(prefix) if prefix else None))
433
438
        except HangupException as e:
434
439
            raise parse_git_hangup(self.transport.external_url(), e)
435
440
        except GitProtocolError as e:
583
588
            # No revision supplied by the user, default to the branch
584
589
            # revision
585
590
            revision_id = source.last_revision()
 
591
        else:
 
592
            if not source.repository.has_revision(revision_id):
 
593
                raise NoSuchRevision(source, revision_id)
586
594
 
587
595
        push_result = GitPushResult()
588
596
        push_result.workingtree_updated = None
635
643
                            new_sha = repo.lookup_bzr_revision_id(revid)[0]
636
644
                        except errors.NoSuchRevision:
637
645
                            continue
 
646
                        else:
 
647
                            if not source.repository.has_revision(revid):
 
648
                                continue
638
649
                    ret[tag_name_to_ref(tagname)] = new_sha
639
650
            return ret
640
651
        with source_store.lock_read():