/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-08-05 20:34:11 UTC
  • mfrom: (7490.40.87 work)
  • mto: (7490.40.103 work)
  • mto: This revision was merged to the branch mainline in revision 7521.
  • Revision ID: jelmer@jelmer.uk-20200805203411-cap9gp8vuwnz5lt7
Merge lp:brz/3.1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
211
211
        return PermissionDenied(url, message)
212
212
    if message.endswith(' does not appear to be a git repository'):
213
213
        return NotBranchError(url, message)
 
214
    if message == 'pre-receive hook declined':
 
215
        return PermissionDenied(url, message)
214
216
    if re.match('(.+) is not a valid repository name',
215
217
                message.splitlines()[0]):
216
218
        return NotBranchError(url, message)
 
219
    if message == (
 
220
            'GitLab: You are not allowed to push code to protected branches '
 
221
            'on this project.'):
 
222
        return PermissionDenied(url, message)
217
223
    m = re.match(r'Permission to ([^ ]+) denied to ([^ ]+)\.', message)
218
224
    if m:
219
225
        return PermissionDenied(m.group(1), 'denied to %s' % m.group(2))
606
612
        push_result.branch_push_result = None
607
613
        repo = self.find_repository()
608
614
        refname = self._get_selected_ref(name)
609
 
        ref_chain, old_sha = self.get_refs_container().follow(refname)
610
 
        if ref_chain:
611
 
            actual_refname = ref_chain[-1]
612
 
        else:
 
615
        try:
 
616
            ref_chain, old_sha = self.get_refs_container().follow(refname)
 
617
        except NotBranchError:
613
618
            actual_refname = refname
 
619
            old_sha = None
 
620
        else:
 
621
            if ref_chain:
 
622
                actual_refname = ref_chain[-1]
 
623
            else:
 
624
                actual_refname = refname
614
625
        if isinstance(source, GitBranch) and lossy:
615
626
            raise errors.LossyPushToSameVCS(source.controldir, self)
616
627
        source_store = get_object_store(source.repository)
630
641
                    raise errors.NoRoundtrippingSupport(
631
642
                        source, self.open_branch(name=name, nascent_ok=True))
632
643
            if not overwrite:
 
644
                old_sha = remote_refs.get(actual_refname)
633
645
                if remote_divergence(old_sha, new_sha, source_store):
634
646
                    raise DivergedBranches(
635
647
                        source, self.open_branch(name, nascent_ok=True))