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

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2019-12-22 13:21:36 UTC
  • mfrom: (7413.6.1 prober-features)
  • Revision ID: breezy.the.bot@gmail.com-20191222132136-v7g7cv3zepxhzj6x
Add an optional priority method for probers.

Merged from https://code.launchpad.net/~jelmer/brz/prober-features/+merge/375187

Show diffs side-by-side

added added

removed removed

Lines of Context:
104
104
 
105
105
class LocalGitProber(Prober):
106
106
 
 
107
    @classmethod
 
108
    def priority(klass, transport):
 
109
        return 10
 
110
 
107
111
    def probe_transport(self, transport):
108
112
        try:
109
113
            external_url = transport.external_url()
150
154
 
151
155
class RemoteGitProber(Prober):
152
156
 
 
157
    @classmethod
 
158
    def priority(klass, transport):
 
159
        # This is a surprisingly good heuristic to determine whether this
 
160
        # prober is more likely to succeed than the Bazaar one.
 
161
        if 'git' in transport.base:
 
162
            return -15
 
163
        return -10
 
164
 
153
165
    def probe_http_transport(self, transport):
154
166
        # This function intentionally doesn't use any of the support code under
155
167
        # breezy.git, since it's called for every repository that's
222
234
 
223
235
 
224
236
ControlDirFormat.register_prober(LocalGitProber)
225
 
ControlDirFormat._server_probers.append(RemoteGitProber)
 
237
ControlDirFormat.register_prober(RemoteGitProber)
226
238
 
227
239
register_transport_proto(
228
240
    'git://', help="Access using the Git smart server protocol.")