Merge lp:~jelmer/brz/probe-hg into lp:brz

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: no longer in the source branch.
Merge reported by: The Breezy Bot
Merged at revision: not available
Proposed branch: lp:~jelmer/brz/probe-hg
Merge into: lp:brz
Diff against target: 1016 lines (+328/-96)
31 files modified
breezy/annotate.py (+1/-1)
breezy/bedding.py (+3/-1)
breezy/builtins.py (+4/-1)
breezy/bzr/bundle/commands.py (+4/-1)
breezy/bzr/knitpack_repo.py (+4/-1)
breezy/bzr/knitrepo.py (+3/-1)
breezy/bzr/smart/ping.py (+2/-1)
breezy/bzr/versionedfile.py (+3/-1)
breezy/bzr/workingtree_4.py (+3/-1)
breezy/cmd_version_info.py (+3/-1)
breezy/conflicts.py (+1/-1)
breezy/diff.py (+3/-1)
breezy/errors.py (+0/-35)
breezy/filters/__init__.py (+4/-1)
breezy/foreign.py (+1/-4)
breezy/ignores.py (+3/-1)
breezy/lazy_import.py (+46/-17)
breezy/lockable_files.py (+3/-1)
breezy/merge_directive.py (+3/-1)
breezy/mergeable.py (+3/-1)
breezy/multiparent.py (+3/-1)
breezy/plugin.py (+4/-1)
breezy/plugins/hg/__init__.py (+177/-0)
breezy/plugins/netrc_credential_store/__init__.py (+1/-4)
breezy/plugins/upload/cmds.py (+1/-1)
breezy/tag.py (+4/-1)
breezy/tests/test_lazy_import.py (+10/-10)
breezy/trace.py (+3/-1)
breezy/transport/http/__init__.py (+21/-3)
breezy/workingtree.py (+3/-1)
doc/en/release-notes/brz-3.1.txt (+4/-0)
To merge this branch: bzr merge lp:~jelmer/brz/probe-hg
Reviewer Review Type Date Requested Status
Jelmer Vernooij Approve
Review via email: mp+375181@code.launchpad.net

Commit message

Add a Mercurial prober that mentions that mercurial repositories are unsupported.

Description of the change

Add a Mercurial prober that mentions that mercurial repositories are unsupported.

To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) :
review: Approve
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote :
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote :
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'breezy/annotate.py'
--- breezy/annotate.py 2019-06-16 01:03:51 +0000
+++ breezy/annotate.py 2020-01-11 17:50:43 +0000
@@ -36,12 +36,12 @@
36import patiencediff36import patiencediff
3737
38from breezy import (38from breezy import (
39 errors,
40 tsort,39 tsort,
41 )40 )
42""")41""")
43from . import (42from . import (
44 config,43 config,
44 errors,
45 osutils,45 osutils,
46 )46 )
47from .repository import _strip_NULL_ghosts47from .repository import _strip_NULL_ghosts
4848
=== modified file 'breezy/bedding.py'
--- breezy/bedding.py 2019-06-16 19:53:27 +0000
+++ breezy/bedding.py 2020-01-11 17:50:43 +0000
@@ -25,12 +25,14 @@
25from .lazy_import import lazy_import25from .lazy_import import lazy_import
26lazy_import(globals(), """26lazy_import(globals(), """
27from breezy import (27from breezy import (
28 errors,
29 osutils,28 osutils,
30 trace,29 trace,
31 win32utils,30 win32utils,
32 )31 )
33""")32""")
33from . import (
34 errors,
35 )
34from .sixish import (36from .sixish import (
35 PY3,37 PY3,
36 )38 )
3739
=== modified file 'breezy/builtins.py'
--- breezy/builtins.py 2019-10-13 18:52:37 +0000
+++ breezy/builtins.py 2020-01-11 17:50:43 +0000
@@ -25,6 +25,10 @@
25import breezy.bzr25import breezy.bzr
26import breezy.git26import breezy.git
2727
28from . import (
29 errors,
30 )
31
28from . import lazy_import32from . import lazy_import
29lazy_import.lazy_import(globals(), """33lazy_import.lazy_import(globals(), """
30import time34import time
@@ -38,7 +42,6 @@
38 directory_service,42 directory_service,
39 delta,43 delta,
40 config as _mod_config,44 config as _mod_config,
41 errors,
42 globbing,45 globbing,
43 gpg,46 gpg,
44 hooks,47 hooks,
4548
=== modified file 'breezy/bzr/bundle/commands.py'
--- breezy/bzr/bundle/commands.py 2019-07-25 22:19:30 +0000
+++ breezy/bzr/bundle/commands.py 2020-01-11 17:50:43 +0000
@@ -23,11 +23,14 @@
2323
24from __future__ import absolute_import24from __future__ import absolute_import
2525
26from ... import (
27 errors,
28 )
29
26from ...lazy_import import lazy_import30from ...lazy_import import lazy_import
27lazy_import(globals(), """31lazy_import(globals(), """
28from breezy import (32from breezy import (
29 branch,33 branch,
30 errors,
31 merge_directive,34 merge_directive,
32 revision as _mod_revision,35 revision as _mod_revision,
33 urlutils,36 urlutils,
3437
=== modified file 'breezy/bzr/knitpack_repo.py'
--- breezy/bzr/knitpack_repo.py 2019-01-09 00:04:02 +0000
+++ breezy/bzr/knitpack_repo.py 2020-01-11 17:50:43 +0000
@@ -18,6 +18,10 @@
1818
19from __future__ import absolute_import19from __future__ import absolute_import
2020
21from .. import (
22 errors,
23 )
24
21from ..lazy_import import lazy_import25from ..lazy_import import lazy_import
22lazy_import(globals(), """26lazy_import(globals(), """
23import time27import time
@@ -25,7 +29,6 @@
25from breezy import (29from breezy import (
26 controldir,30 controldir,
27 debug,31 debug,
28 errors,
29 osutils,32 osutils,
30 revision as _mod_revision,33 revision as _mod_revision,
31 trace,34 trace,
3235
=== modified file 'breezy/bzr/knitrepo.py'
--- breezy/bzr/knitrepo.py 2018-11-30 12:39:04 +0000
+++ breezy/bzr/knitrepo.py 2020-01-11 17:50:43 +0000
@@ -22,7 +22,6 @@
2222
23from breezy import (23from breezy import (
24 controldir,24 controldir,
25 errors,
26 lockable_files,25 lockable_files,
27 lockdir,26 lockdir,
28 osutils,27 osutils,
@@ -38,6 +37,9 @@
38 xml7,37 xml7,
39 )38 )
40""")39""")
40from .. import (
41 errors,
42 )
41from ..repository import (43from ..repository import (
42 InterRepository,44 InterRepository,
43 IsInWriteGroupError,45 IsInWriteGroupError,
4446
=== modified file 'breezy/bzr/smart/ping.py'
--- breezy/bzr/smart/ping.py 2018-08-08 02:10:06 +0000
+++ breezy/bzr/smart/ping.py 2020-01-11 17:50:43 +0000
@@ -23,11 +23,12 @@
23from ...sixish import viewitems23from ...sixish import viewitems
2424
25lazy_import(globals(), """25lazy_import(globals(), """
26from breezy import errors
27from breezy.bzr.smart.client import _SmartClient26from breezy.bzr.smart.client import _SmartClient
28from breezy.transport import get_transport27from breezy.transport import get_transport
29""")28""")
3029
30from breezy import errors
31
3132
32class cmd_ping(Command):33class cmd_ping(Command):
33 """Pings a Bazaar smart server.34 """Pings a Bazaar smart server.
3435
=== modified file 'breezy/bzr/versionedfile.py'
--- breezy/bzr/versionedfile.py 2019-06-16 15:20:09 +0000
+++ breezy/bzr/versionedfile.py 2020-01-11 17:50:43 +0000
@@ -29,7 +29,6 @@
29from breezy import (29from breezy import (
30 annotate,30 annotate,
31 bencode,31 bencode,
32 errors,
33 graph as _mod_graph,32 graph as _mod_graph,
34 osutils,33 osutils,
35 multiparent,34 multiparent,
@@ -43,6 +42,9 @@
43 knit,42 knit,
44 )43 )
45""")44""")
45from .. import (
46 errors,
47 )
46from ..registry import Registry48from ..registry import Registry
47from ..sixish import (49from ..sixish import (
48 BytesIO,50 BytesIO,
4951
=== modified file 'breezy/bzr/workingtree_4.py'
--- breezy/bzr/workingtree_4.py 2020-01-11 14:56:33 +0000
+++ breezy/bzr/workingtree_4.py 2020-01-11 17:50:43 +0000
@@ -38,7 +38,6 @@
38 cleanup,38 cleanup,
39 controldir,39 controldir,
40 debug,40 debug,
41 errors,
42 filters as _mod_filters,41 filters as _mod_filters,
43 osutils,42 osutils,
44 revision as _mod_revision,43 revision as _mod_revision,
@@ -53,6 +52,9 @@
53 )52 )
54""")53""")
5554
55from .. import (
56 errors,
57 )
56from .inventory import Inventory, ROOT_ID, entry_factory58from .inventory import Inventory, ROOT_ID, entry_factory
57from ..lock import LogicalLockResult59from ..lock import LogicalLockResult
58from ..lockable_files import LockableFiles60from ..lockable_files import LockableFiles
5961
=== modified file 'breezy/cmd_version_info.py'
--- breezy/cmd_version_info.py 2018-11-12 01:41:38 +0000
+++ breezy/cmd_version_info.py 2020-01-11 17:50:43 +0000
@@ -23,13 +23,15 @@
23lazy_import(globals(), """23lazy_import(globals(), """
24from breezy import (24from breezy import (
25 branch,25 branch,
26 errors,
27 version_info_formats,26 version_info_formats,
28 workingtree,27 workingtree,
29 )28 )
30from breezy.i18n import gettext29from breezy.i18n import gettext
31""")30""")
3231
32from . import (
33 errors,
34 )
33from .commands import Command35from .commands import Command
34from .option import Option, RegistryOption36from .option import Option, RegistryOption
35from .sixish import text_type37from .sixish import text_type
3638
=== modified file 'breezy/conflicts.py'
--- breezy/conflicts.py 2019-06-22 11:16:17 +0000
+++ breezy/conflicts.py 2020-01-11 17:50:43 +0000
@@ -27,7 +27,6 @@
27import errno27import errno
2828
29from breezy import (29from breezy import (
30 errors,
31 osutils,30 osutils,
32 rio,31 rio,
33 trace,32 trace,
@@ -38,6 +37,7 @@
38""")37""")
39from . import (38from . import (
40 cache_utf8,39 cache_utf8,
40 errors,
41 commands,41 commands,
42 option,42 option,
43 registry,43 registry,
4444
=== modified file 'breezy/diff.py'
--- breezy/diff.py 2019-12-23 01:39:21 +0000
+++ breezy/diff.py 2020-01-11 17:50:43 +0000
@@ -31,7 +31,6 @@
31from breezy import (31from breezy import (
32 cleanup,32 cleanup,
33 controldir,33 controldir,
34 errors,
35 osutils,34 osutils,
36 textfile,35 textfile,
37 timestamp,36 timestamp,
@@ -42,6 +41,9 @@
42from breezy.i18n import gettext41from breezy.i18n import gettext
43""")42""")
4443
44from . import (
45 errors,
46 )
45from .registry import (47from .registry import (
46 Registry,48 Registry,
47 )49 )
4850
=== modified file 'breezy/errors.py'
--- breezy/errors.py 2019-09-01 16:44:05 +0000
+++ breezy/errors.py 2020-01-11 17:50:43 +0000
@@ -2027,41 +2027,6 @@
2027 self.revision_id = revision_id2027 self.revision_id = revision_id
20282028
20292029
2030class IllegalUseOfScopeReplacer(InternalBzrError):
2031
2032 _fmt = ("ScopeReplacer object %(name)r was used incorrectly:"
2033 " %(msg)s%(extra)s")
2034
2035 def __init__(self, name, msg, extra=None):
2036 BzrError.__init__(self)
2037 self.name = name
2038 self.msg = msg
2039 if extra:
2040 self.extra = ': ' + str(extra)
2041 else:
2042 self.extra = ''
2043
2044
2045class InvalidImportLine(InternalBzrError):
2046
2047 _fmt = "Not a valid import statement: %(msg)\n%(text)s"
2048
2049 def __init__(self, text, msg):
2050 BzrError.__init__(self)
2051 self.text = text
2052 self.msg = msg
2053
2054
2055class ImportNameCollision(InternalBzrError):
2056
2057 _fmt = ("Tried to import an object to the same name as"
2058 " an existing object. %(name)s")
2059
2060 def __init__(self, name):
2061 BzrError.__init__(self)
2062 self.name = name
2063
2064
2065class NotAMergeDirective(BzrError):2030class NotAMergeDirective(BzrError):
2066 """File starting with %(firstline)r is not a merge directive"""2031 """File starting with %(firstline)r is not a merge directive"""
20672032
20682033
=== modified file 'breezy/filters/__init__.py'
--- breezy/filters/__init__.py 2018-11-11 04:08:32 +0000
+++ breezy/filters/__init__.py 2020-01-11 17:50:43 +0000
@@ -48,12 +48,15 @@
48lazy_import(globals(), """48lazy_import(globals(), """
49from breezy import (49from breezy import (
50 config,50 config,
51 errors,
52 osutils,51 osutils,
53 registry,52 registry,
54 )53 )
55""")54""")
5655
56from .. import (
57 errors,
58 )
59
5760
58class ContentFilter(object):61class ContentFilter(object):
5962
6063
=== modified file 'breezy/foreign.py'
--- breezy/foreign.py 2018-11-18 19:48:57 +0000
+++ breezy/foreign.py 2020-01-11 17:50:43 +0000
@@ -24,13 +24,10 @@
24 )24 )
25from .repository import Repository25from .repository import Repository
26from .revision import Revision26from .revision import Revision
27from .lazy_import import lazy_import27from . import (
28lazy_import(globals(), """
29from breezy import (
30 errors,28 errors,
31 registry,29 registry,
32 )30 )
33""")
3431
3532
36class VcsMapping(object):33class VcsMapping(object):
3734
=== modified file 'breezy/ignores.py'
--- breezy/ignores.py 2019-11-19 18:10:28 +0000
+++ breezy/ignores.py 2020-01-11 17:50:43 +0000
@@ -27,11 +27,13 @@
27lazy_import(globals(), """27lazy_import(globals(), """
28from breezy import (28from breezy import (
29 atomicfile,29 atomicfile,
30 bedding,
31 globbing,30 globbing,
32 trace,31 trace,
33 )32 )
34""")33""")
34from . import (
35 bedding,
36 )
3537
36# ~/.config/breezy/ignore will be filled out using38# ~/.config/breezy/ignore will be filled out using
37# this ignore list, if it does not exist39# this ignore list, if it does not exist
3840
=== modified file 'breezy/lazy_import.py'
--- breezy/lazy_import.py 2018-11-12 01:41:38 +0000
+++ breezy/lazy_import.py 2020-01-11 17:50:43 +0000
@@ -43,6 +43,43 @@
4343
44from __future__ import absolute_import44from __future__ import absolute_import
4545
46from .errors import BzrError, InternalBzrError
47
48
49class ImportNameCollision(InternalBzrError):
50
51 _fmt = ("Tried to import an object to the same name as"
52 " an existing object. %(name)s")
53
54 def __init__(self, name):
55 BzrError.__init__(self)
56 self.name = name
57
58
59class IllegalUseOfScopeReplacer(InternalBzrError):
60
61 _fmt = ("ScopeReplacer object %(name)r was used incorrectly:"
62 " %(msg)s%(extra)s")
63
64 def __init__(self, name, msg, extra=None):
65 BzrError.__init__(self)
66 self.name = name
67 self.msg = msg
68 if extra:
69 self.extra = ': ' + str(extra)
70 else:
71 self.extra = ''
72
73
74class InvalidImportLine(InternalBzrError):
75
76 _fmt = "Not a valid import statement: %(msg)\n%(text)s"
77
78 def __init__(self, text, msg):
79 BzrError.__init__(self)
80 self.text = text
81 self.msg = msg
82
4683
47class ScopeReplacer(object):84class ScopeReplacer(object):
48 """A lazy object that will replace itself in the appropriate scope.85 """A lazy object that will replace itself in the appropriate scope.
@@ -84,8 +121,9 @@
84 scope = object.__getattribute__(self, '_scope')121 scope = object.__getattribute__(self, '_scope')
85 obj = factory(self, scope, name)122 obj = factory(self, scope, name)
86 if obj is self:123 if obj is self:
87 raise errors.IllegalUseOfScopeReplacer(name, msg="Object tried"124 raise IllegalUseOfScopeReplacer(
88 " to replace itself, check it's not using its own scope.")125 name, msg="Object tried"
126 " to replace itself, check it's not using its own scope.")
89127
90 # Check if another thread has jumped in while obj was generated.128 # Check if another thread has jumped in while obj was generated.
91 real_obj = object.__getattribute__(self, '_real_obj')129 real_obj = object.__getattribute__(self, '_real_obj')
@@ -99,7 +137,7 @@
99137
100 # Raise if proxying is disabled as obj has already been generated.138 # Raise if proxying is disabled as obj has already been generated.
101 if not ScopeReplacer._should_proxy:139 if not ScopeReplacer._should_proxy:
102 raise errors.IllegalUseOfScopeReplacer(140 raise IllegalUseOfScopeReplacer(
103 name, msg="Object already replaced, did you assign it"141 name, msg="Object already replaced, did you assign it"
104 " to another variable?")142 " to another variable?")
105 return real_obj143 return real_obj
@@ -260,8 +298,8 @@
260 elif line.startswith('from '):298 elif line.startswith('from '):
261 self._convert_from_str(line)299 self._convert_from_str(line)
262 else:300 else:
263 raise errors.InvalidImportLine(line,301 raise InvalidImportLine(
264 "doesn't start with 'import ' or 'from '")302 line, "doesn't start with 'import ' or 'from '")
265303
266 def _convert_import_str(self, import_str):304 def _convert_import_str(self, import_str):
267 """This converts a import string into an import map.305 """This converts a import string into an import map.
@@ -286,7 +324,7 @@
286 name = as_hunks[1].strip()324 name = as_hunks[1].strip()
287 module_path = as_hunks[0].strip().split('.')325 module_path = as_hunks[0].strip().split('.')
288 if name in self.imports:326 if name in self.imports:
289 raise errors.ImportNameCollision(name)327 raise ImportNameCollision(name)
290 if not module_path[0]:328 if not module_path[0]:
291 raise ImportError(path)329 raise ImportError(path)
292 # No children available in 'import foo as bar'330 # No children available in 'import foo as bar'
@@ -345,7 +383,7 @@
345 else:383 else:
346 name = module = path384 name = module = path
347 if name in self.imports:385 if name in self.imports:
348 raise errors.ImportNameCollision(name)386 raise ImportNameCollision(name)
349 self.imports[name] = (from_module_path, module, {})387 self.imports[name] = (from_module_path, module, {})
350388
351 def _canonicalize_import_text(self, text):389 def _canonicalize_import_text(self, text):
@@ -377,7 +415,7 @@
377 else:415 else:
378 out.append(line.replace('(', '').replace(')', ''))416 out.append(line.replace('(', '').replace(')', ''))
379 if cur is not None:417 if cur is not None:
380 raise errors.InvalidImportLine(cur, 'Unmatched parenthesis')418 raise InvalidImportLine(cur, 'Unmatched parenthesis')
381 return out419 return out
382420
383421
@@ -408,12 +446,3 @@
408 # This is just a helper around ImportProcessor.lazy_import446 # This is just a helper around ImportProcessor.lazy_import
409 proc = ImportProcessor(lazy_import_class=lazy_import_class)447 proc = ImportProcessor(lazy_import_class=lazy_import_class)
410 return proc.lazy_import(scope, text)448 return proc.lazy_import(scope, text)
411
412
413# The only module that this module depends on is 'breezy.errors'. But it
414# can actually be imported lazily, since we only need it if there is a
415# problem.
416
417lazy_import(globals(), """
418from breezy import errors
419""")
420449
=== modified file 'breezy/lockable_files.py'
--- breezy/lockable_files.py 2018-11-11 04:08:32 +0000
+++ breezy/lockable_files.py 2020-01-11 17:50:43 +0000
@@ -20,13 +20,15 @@
20lazy_import(globals(), """20lazy_import(globals(), """
21from breezy import (21from breezy import (
22 counted_lock,22 counted_lock,
23 errors,
24 lock,23 lock,
25 transactions,24 transactions,
26 urlutils,25 urlutils,
27 )26 )
28""")27""")
2928
29from . import (
30 errors,
31 )
30from .decorators import (32from .decorators import (
31 only_raises,33 only_raises,
32 )34 )
3335
=== modified file 'breezy/merge_directive.py'
--- breezy/merge_directive.py 2019-07-27 22:47:49 +0000
+++ breezy/merge_directive.py 2020-01-11 17:50:43 +0000
@@ -26,7 +26,6 @@
26 cleanup,26 cleanup,
27 diff,27 diff,
28 email_message,28 email_message,
29 errors,
30 gpg,29 gpg,
31 hooks,30 hooks,
32 registry,31 registry,
@@ -42,6 +41,9 @@
42 serializer as bundle_serializer,41 serializer as bundle_serializer,
43 )42 )
44""")43""")
44from . import (
45 errors,
46 )
45from .sixish import (47from .sixish import (
46 BytesIO,48 BytesIO,
47 )49 )
4850
=== modified file 'breezy/mergeable.py'
--- breezy/mergeable.py 2019-06-30 10:50:40 +0000
+++ breezy/mergeable.py 2020-01-11 17:50:43 +0000
@@ -19,7 +19,6 @@
19from .lazy_import import lazy_import19from .lazy_import import lazy_import
20lazy_import(globals(), """20lazy_import(globals(), """
21from breezy import (21from breezy import (
22 errors,
23 transport as _mod_transport,22 transport as _mod_transport,
24 urlutils,23 urlutils,
25 )24 )
@@ -28,6 +27,9 @@
28from breezy.i18n import gettext27from breezy.i18n import gettext
29""")28""")
3029
30from . import (
31 errors,
32 )
31from .sixish import (33from .sixish import (
32 BytesIO,34 BytesIO,
33 )35 )
3436
=== modified file 'breezy/multiparent.py'
--- breezy/multiparent.py 2019-03-02 21:46:18 +0000
+++ breezy/multiparent.py 2020-01-11 17:50:43 +0000
@@ -28,10 +28,12 @@
2828
29from breezy import (29from breezy import (
30 bencode,30 bencode,
31 errors,
32 ui,31 ui,
33 )32 )
34""")33""")
34from . import (
35 errors,
36 )
35from .i18n import gettext37from .i18n import gettext
36from .sixish import (38from .sixish import (
37 BytesIO,39 BytesIO,
3840
=== modified file 'breezy/plugin.py'
--- breezy/plugin.py 2019-10-14 00:07:00 +0000
+++ breezy/plugin.py 2020-01-11 17:50:43 +0000
@@ -51,12 +51,15 @@
51from breezy import (51from breezy import (
52 bedding,52 bedding,
53 debug,53 debug,
54 errors,
55 help_topics,54 help_topics,
56 trace,55 trace,
57 )56 )
58""")57""")
5958
59from . import (
60 errors,
61 )
62
6063
61_MODULE_PREFIX = "breezy.plugins."64_MODULE_PREFIX = "breezy.plugins."
6265
6366
=== added directory 'breezy/plugins/hg'
=== added file 'breezy/plugins/hg/__init__.py'
--- breezy/plugins/hg/__init__.py 1970-01-01 00:00:00 +0000
+++ breezy/plugins/hg/__init__.py 2020-01-11 17:50:43 +0000
@@ -0,0 +1,177 @@
1# Copyright (C) 2019 Jelmer Vernooij <jelmer@jelmer.uk>
2#
3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by
5# the Free Software Foundation; version 3 of the License or
6# (at your option) a later version.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with this program; if not, write to the Free Software
15# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
17"""Mercurial foreign branch support.
18
19Currently only tells the user that Mercurial is not supported.
20"""
21
22from __future__ import absolute_import
23
24from ... import (
25 controldir,
26 errors,
27 )
28
29from ... import version_info # noqa: F401
30
31
32class MercurialUnsupportedError(errors.UnsupportedFormatError):
33
34 _fmt = ('Mercurial branches are not yet supported. '
35 'To convert Mercurial branches to Bazaar branches or vice versa, '
36 'use the fastimport format. ')
37
38
39class LocalHgDirFormat(controldir.ControlDirFormat):
40 """Mercurial directory format."""
41
42 def get_converter(self):
43 raise NotImplementedError(self.get_converter)
44
45 def get_format_description(self):
46 return "Local Mercurial control directory"
47
48 def initialize_on_transport(self, transport):
49 raise errors.UninitializableFormat(self)
50
51 def is_supported(self):
52 return False
53
54 def supports_transport(self, transport):
55 return False
56
57 def check_support_status(self, allow_unsupported, recommend_upgrade=True,
58 basedir=None):
59 raise MercurialUnsupportedError()
60
61 def open(self, transport):
62 # Raise NotBranchError if there is nothing there
63 LocalHgProber().probe_transport(transport)
64 raise NotImplementedError(self.open)
65
66
67class LocalHgProber(controldir.Prober):
68
69 @classmethod
70 def priority(klass, transport):
71 return 100
72
73 @staticmethod
74 def _has_hg_dumb_repository(transport):
75 try:
76 return transport.has_any([".hg/requires", ".hg/00changelog.i"])
77 except (errors.NoSuchFile, errors.PermissionDenied,
78 errors.InvalidHttpResponse):
79 return False
80
81 @classmethod
82 def probe_transport(klass, transport):
83 """Our format is present if the transport has a '.hg/' subdir."""
84 if klass._has_hg_dumb_repository(transport):
85 return HgDirFormat()
86 raise errors.NotBranchError(path=transport.base)
87
88 @classmethod
89 def known_formats(cls):
90 return [LocalHgDirFormat()]
91
92
93class SmartHgDirFormat(controldir.ControlDirFormat):
94 """Mercurial directory format."""
95
96 def get_converter(self):
97 raise NotImplementedError(self.get_converter)
98
99 def get_format_description(self):
100 return "Smart Mercurial control directory"
101
102 def initialize_on_transport(self, transport):
103 raise errors.UninitializableFormat(self)
104
105 def is_supported(self):
106 return False
107
108 def supports_transport(self, transport):
109 return False
110
111 def check_support_status(self, allow_unsupported, recommend_upgrade=True,
112 basedir=None):
113 raise MercurialUnsupportedError()
114
115 def open(self, transport):
116 # Raise NotBranchError if there is nothing there
117 SmartHgProber().probe_transport(transport)
118 raise NotImplementedError(self.open)
119
120
121class SmartHgProber(controldir.Prober):
122
123 # Perhaps retrieve list from mercurial.hg.schemes ?
124 _supported_schemes = ["http", "https"]
125
126 @classmethod
127 def priority(klass, transport):
128 return 90
129
130 @staticmethod
131 def _has_hg_http_smart_server(transport, external_url):
132 """Check if there is a Mercurial smart server at the remote location.
133
134 :param transport: Transport to check
135 :param externa_url: External URL for transport
136 :return: Boolean indicating whether transport is backed onto hg
137 """
138 from breezy.urlutils import urlparse
139 parsed_url = urlparse.urlparse(external_url)
140 parsed_url = parsed_url._replace(
141 query='cmd=capabilities', path=parsed_url.path.rstrip('/') + '/hg')
142 url = urlparse.urlunparse(parsed_url)
143 resp = transport.request(
144 'GET', url, headers={'Accept': 'application/mercurial-0.1'})
145 if resp.status == 404:
146 return False
147 ct = resp.getheader("Content-Type")
148 if ct is None:
149 return False
150 return ct.startswith("application/mercurial")
151
152 @classmethod
153 def probe_transport(klass, transport):
154 try:
155 external_url = transport.external_url()
156 except errors.InProcessTransport:
157 raise errors.NotBranchError(path=transport.base)
158 scheme = external_url.split(":")[0]
159 if scheme not in klass._supported_schemes:
160 raise errors.NotBranchError(path=transport.base)
161 from breezy import urlutils
162 external_url = urlutils.split_segment_parameters(external_url)[0]
163 # Explicitly check for .hg directories here, so we avoid
164 # loading foreign branches through Mercurial.
165 if (external_url.startswith("http:") or
166 external_url.startswith("https:")):
167 if klass._has_hg_http_smart_server(transport, external_url):
168 return SmartHgDirFormat()
169 raise errors.NotBranchError(path=transport.base)
170
171 @classmethod
172 def known_formats(cls):
173 return [SmartHgDirFormat()]
174
175
176controldir.ControlDirFormat.register_prober(LocalHgProber)
177controldir.ControlDirFormat.register_prober(SmartHgProber)
0178
=== modified file 'breezy/plugins/netrc_credential_store/__init__.py'
--- breezy/plugins/netrc_credential_store/__init__.py 2018-11-11 04:08:32 +0000
+++ breezy/plugins/netrc_credential_store/__init__.py 2020-01-11 17:50:43 +0000
@@ -23,16 +23,13 @@
2323
24from ... import (24from ... import (
25 config,25 config,
26 errors,
26 lazy_import,27 lazy_import,
27 )28 )
2829
29lazy_import.lazy_import(globals(), """30lazy_import.lazy_import(globals(), """
30import errno31import errno
31import netrc32import netrc
32
33from breezy import (
34 errors,
35 )
36""")33""")
3734
3835
3936
=== modified file 'breezy/plugins/upload/cmds.py'
--- breezy/plugins/upload/cmds.py 2019-09-21 23:05:12 +0000
+++ breezy/plugins/upload/cmds.py 2020-01-11 17:50:43 +0000
@@ -21,6 +21,7 @@
21from ... import (21from ... import (
22 commands,22 commands,
23 config,23 config,
24 errors,
24 lazy_import,25 lazy_import,
25 option,26 option,
26 osutils,27 osutils,
@@ -30,7 +31,6 @@
3031
31from breezy import (32from breezy import (
32 controldir,33 controldir,
33 errors,
34 globbing,34 globbing,
35 ignores,35 ignores,
36 revision,36 revision,
3737
=== modified file 'breezy/tag.py'
--- breezy/tag.py 2019-06-22 16:20:00 +0000
+++ breezy/tag.py 2020-01-11 17:50:43 +0000
@@ -40,11 +40,14 @@
40from breezy import (40from breezy import (
41 bencode,41 bencode,
42 cleanup,42 cleanup,
43 errors,
44 trace,43 trace,
45 )44 )
46""")45""")
4746
47from . import (
48 errors,
49 )
50
4851
49def _reconcile_tags(source_dict, dest_dict, overwrite):52def _reconcile_tags(source_dict, dest_dict, overwrite):
50 """Do a two-way merge of two tag dictionaries.53 """Do a two-way merge of two tag dictionaries.
5154
=== modified file 'breezy/tests/test_lazy_import.py'
--- breezy/tests/test_lazy_import.py 2018-11-11 04:08:32 +0000
+++ breezy/tests/test_lazy_import.py 2020-01-11 17:50:43 +0000
@@ -354,7 +354,7 @@
354354
355 # However, the next access on test_obj3 should raise an error355 # However, the next access on test_obj3 should raise an error
356 # because only now are we able to detect the problem.356 # because only now are we able to detect the problem.
357 self.assertRaises(errors.IllegalUseOfScopeReplacer,357 self.assertRaises(lazy_import.IllegalUseOfScopeReplacer,
358 getattr, test_obj3, 'foo')358 getattr, test_obj3, 'foo')
359359
360 self.assertEqual([('__getattribute__', 'foo'),360 self.assertEqual([('__getattribute__', 'foo'),
@@ -448,7 +448,7 @@
448448
449 self.assertEqual(InstrumentedReplacer,449 self.assertEqual(InstrumentedReplacer,
450 object.__getattribute__(test_obj7, '__class__'))450 object.__getattribute__(test_obj7, '__class__'))
451 e = self.assertRaises(errors.IllegalUseOfScopeReplacer, test_obj7)451 e = self.assertRaises(lazy_import.IllegalUseOfScopeReplacer, test_obj7)
452 self.assertIn("replace itself", e.msg)452 self.assertIn("replace itself", e.msg)
453 self.assertEqual([('__call__', (), {}),453 self.assertEqual([('__call__', (), {}),
454 'factory'], actions)454 'factory'], actions)
@@ -917,7 +917,7 @@
917917
918 def test_missing_trailing(self):918 def test_missing_trailing(self):
919 proc = lazy_import.ImportProcessor()919 proc = lazy_import.ImportProcessor()
920 self.assertRaises(errors.InvalidImportLine,920 self.assertRaises(lazy_import.InvalidImportLine,
921 proc._canonicalize_import_text,921 proc._canonicalize_import_text,
922 "from foo import (\n bar\n")922 "from foo import (\n bar\n")
923923
@@ -1016,13 +1016,13 @@
10161016
1017 def test_incorrect_line(self):1017 def test_incorrect_line(self):
1018 proc = lazy_import.ImportProcessor()1018 proc = lazy_import.ImportProcessor()
1019 self.assertRaises(errors.InvalidImportLine,1019 self.assertRaises(lazy_import.InvalidImportLine,
1020 proc._build_map, 'foo bar baz')1020 proc._build_map, 'foo bar baz')
1021 self.assertRaises(errors.InvalidImportLine,1021 self.assertRaises(lazy_import.InvalidImportLine,
1022 proc._build_map, 'improt foo')1022 proc._build_map, 'improt foo')
1023 self.assertRaises(errors.InvalidImportLine,1023 self.assertRaises(lazy_import.InvalidImportLine,
1024 proc._build_map, 'importfoo')1024 proc._build_map, 'importfoo')
1025 self.assertRaises(errors.InvalidImportLine,1025 self.assertRaises(lazy_import.InvalidImportLine,
1026 proc._build_map, 'fromimport')1026 proc._build_map, 'fromimport')
10271027
1028 def test_name_collision(self):1028 def test_name_collision(self):
@@ -1031,11 +1031,11 @@
10311031
1032 # All of these would try to create an object with the1032 # All of these would try to create an object with the
1033 # same name as an existing object.1033 # same name as an existing object.
1034 self.assertRaises(errors.ImportNameCollision,1034 self.assertRaises(lazy_import.ImportNameCollision,
1035 proc._build_map, 'import bar as foo')1035 proc._build_map, 'import bar as foo')
1036 self.assertRaises(errors.ImportNameCollision,1036 self.assertRaises(lazy_import.ImportNameCollision,
1037 proc._build_map, 'from foo import bar as foo')1037 proc._build_map, 'from foo import bar as foo')
1038 self.assertRaises(errors.ImportNameCollision,1038 self.assertRaises(lazy_import.ImportNameCollision,
1039 proc._build_map, 'from bar import foo')1039 proc._build_map, 'from bar import foo')
10401040
1041 def test_relative_imports(self):1041 def test_relative_imports(self):
10421042
=== modified file 'breezy/trace.py'
--- breezy/trace.py 2019-07-13 14:35:12 +0000
+++ breezy/trace.py 2020-01-11 17:50:43 +0000
@@ -74,11 +74,13 @@
74from breezy import (74from breezy import (
75 bedding,75 bedding,
76 debug,76 debug,
77 errors,
78 osutils,77 osutils,
79 ui,78 ui,
80 )79 )
81""")80""")
81from . import (
82 errors,
83 )
8284
83from .sixish import (85from .sixish import (
84 PY3,86 PY3,
8587
=== modified file 'breezy/transport/http/__init__.py'
--- breezy/transport/http/__init__.py 2020-01-10 02:20:50 +0000
+++ breezy/transport/http/__init__.py 2020-01-11 17:50:43 +0000
@@ -1037,6 +1037,9 @@
1037 newurl = headers.get('uri')1037 newurl = headers.get('uri')
1038 else:1038 else:
1039 return1039 return
1040
1041 newurl = urljoin(req.get_full_url(), newurl)
1042
1040 if self._debuglevel >= 1:1043 if self._debuglevel >= 1:
1041 print('Redirected to: %s (followed: %r)' % (newurl,1044 print('Redirected to: %s (followed: %r)' % (newurl,
1042 req.follow_redirections))1045 req.follow_redirections))
@@ -1044,8 +1047,6 @@
1044 req.redirected_to = newurl1047 req.redirected_to = newurl
1045 return fp1048 return fp
10461049
1047 newurl = urljoin(req.get_full_url(), newurl)
1048
1049 # This call succeeds or raise an error. urllib_request returns1050 # This call succeeds or raise an error. urllib_request returns
1050 # if redirect_request returns None, but our1051 # if redirect_request returns None, but our
1051 # redirect_request never returns None.1052 # redirect_request never returns None.
@@ -1830,6 +1831,7 @@
1830 400,1831 400,
1831 403,1832 403,
1832 404, # Not found1833 404, # Not found
1834 405, # Method not allowed
1833 416,1835 416,
1834 422,1836 422,
1835 501, # Not implemented1837 501, # Not implemented
@@ -2018,6 +2020,10 @@
2018 return self._actual.code2020 return self._actual.code
20192021
2020 @property2022 @property
2023 def reason(self):
2024 return self._actual.reason
2025
2026 @property
2021 def data(self):2027 def data(self):
2022 if self._data is None:2028 if self._data is None:
2023 self._data = self._actual.read()2029 self._data = self._actual.read()
@@ -2081,16 +2087,28 @@
2081 if range_header is not None:2087 if range_header is not None:
2082 bytes = 'bytes=' + range_header2088 bytes = 'bytes=' + range_header
2083 headers = {'Range': bytes}2089 headers = {'Range': bytes}
2090 else:
2091 range_header = None
20842092
2085 response = self.request('GET', abspath, headers=headers)2093 response = self.request('GET', abspath, headers=headers)
20862094
2087 if response.status == 404: # not found2095 if response.status == 404: # not found
2088 raise errors.NoSuchFile(abspath)2096 raise errors.NoSuchFile(abspath)
2089 elif response.status in (400, 416):2097 elif response.status == 416:
2090 # We don't know which, but one of the ranges we specified was2098 # We don't know which, but one of the ranges we specified was
2091 # wrong.2099 # wrong.
2092 raise errors.InvalidHttpRange(abspath, range_header,2100 raise errors.InvalidHttpRange(abspath, range_header,
2093 'Server return code %d' % response.status)2101 'Server return code %d' % response.status)
2102 elif response.status == 400:
2103 if range_header:
2104 # We don't know which, but one of the ranges we specified was
2105 # wrong.
2106 raise errors.InvalidHttpRange(
2107 abspath, range_header,
2108 'Server return code %d' % response.status)
2109 else:
2110 raise errors.InvalidHttpResponse(
2111 abspath, 'Unexpected status %d' % response.status)
2094 elif response.status not in (200, 206):2112 elif response.status not in (200, 206):
2095 raise errors.InvalidHttpResponse(2113 raise errors.InvalidHttpResponse(
2096 abspath, 'Unexpected status %d' % response.status)2114 abspath, 'Unexpected status %d' % response.status)
20972115
=== modified file 'breezy/workingtree.py'
--- breezy/workingtree.py 2020-01-10 01:37:30 +0000
+++ breezy/workingtree.py 2020-01-11 17:50:43 +0000
@@ -43,7 +43,6 @@
43from breezy import (43from breezy import (
44 cleanup,44 cleanup,
45 conflicts as _mod_conflicts,45 conflicts as _mod_conflicts,
46 errors,
47 filters as _mod_filters,46 filters as _mod_filters,
48 merge,47 merge,
49 revision as _mod_revision,48 revision as _mod_revision,
@@ -56,6 +55,9 @@
56 )55 )
57""")56""")
5857
58from . import (
59 errors,
60 )
59from .controldir import (61from .controldir import (
60 ControlComponent,62 ControlComponent,
61 ControlComponentFormatRegistry,63 ControlComponentFormatRegistry,
6264
=== modified file 'doc/en/release-notes/brz-3.1.txt'
--- doc/en/release-notes/brz-3.1.txt 2020-01-02 11:31:03 +0000
+++ doc/en/release-notes/brz-3.1.txt 2020-01-11 17:50:43 +0000
@@ -46,6 +46,10 @@
46 have installed and speeds up import time since psutil brings in46 have installed and speeds up import time since psutil brings in
47 various other modules. (Jelmer Vernooij)47 various other modules. (Jelmer Vernooij)
4848
49 * Add a basic Mercurial plugin that mentions that .hg repositories
50 are unsupported when the user attempts to access one.
51 (Jelmer Vernooij)
52
49 * The ``2a`` format now officially supports storing tree references.53 * The ``2a`` format now officially supports storing tree references.
50 It always partially supported storing tree reference data,54 It always partially supported storing tree reference data,
51 and would happily pull in tree reference data from other repository55 and would happily pull in tree reference data from other repository

Subscribers

People subscribed via source and target branches