/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/plugins/launchpad/hoster.py

  • Committer: Jelmer Vernooij
  • Date: 2020-06-18 03:08:00 UTC
  • mto: (7490.40.27 work)
  • mto: This revision was merged to the branch mainline in revision 7517.
  • Revision ID: jelmer@jelmer.uk-20200618030800-jsgupyes82s9s130
Add functions fo retrieving merge proposal source revision.

Show diffs side-by-side

added added

removed removed

Lines of Context:
119
119
                self._mp.source_git_repository.git_identity,
120
120
                ref=self._mp.source_git_path.encode('utf-8'))
121
121
 
 
122
    def get_source_revision(self):
 
123
        if self._mp.source_branch:
 
124
            last_scanned_id = self._mp.source_branch.last_scanned_id
 
125
            if last_scanned_id:
 
126
                return last_scanned_id.encode('utf-8')
 
127
            else:
 
128
                return None
 
129
        else:
 
130
            from breezy.git.mapping import default_mapping
 
131
            git_repo = self._mp.source_git_repository
 
132
            sha = git_repo.branches_collections[
 
133
                self._mp.source_git_path].commit_sha
 
134
            if sha is None:
 
135
                return None
 
136
            return default_mapping.revision_id_foreign_to_bzr(
 
137
                sha.encode('ascii'))
 
138
 
122
139
    def get_target_branch_url(self):
123
140
        if self._mp.target_branch:
124
141
            return self._mp.target_branch.bzr_identity