Merge lp:brz/3.3 into lp:brz

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: 7731
Merged at revision: 7671
Proposed branch: lp:brz/3.3
Merge into: lp:brz
Diff against target: 760 lines (+83/-98)
31 files modified
breezy/branch.py (+2/-2)
breezy/builtins.py (+6/-11)
breezy/bzr/__init__.py (+7/-1)
breezy/bzr/branch.py (+4/-8)
breezy/bzr/fullhistory.py (+0/-1)
breezy/bzr/remote.py (+0/-1)
breezy/bzr/tests/per_bzrdir/test_bzrdir.py (+1/-2)
breezy/bzr/tests/test__simple_set.py (+8/-4)
breezy/bzr/tests/test__static_tuple.py (+9/-6)
breezy/bzr/vf_repository.py (+0/-1)
breezy/bzr/workingtree.py (+1/-1)
breezy/bzr/workingtree_3.py (+1/-1)
breezy/controldir.py (+8/-8)
breezy/git/workingtree.py (+2/-2)
breezy/main.rs (+7/-7)
breezy/memorytree.py (+1/-2)
breezy/merge.py (+4/-9)
breezy/merge_directive.py (+0/-2)
breezy/plugins/weave_fmt/workingtree.py (+1/-1)
breezy/registry.py (+3/-1)
breezy/repository.py (+1/-1)
breezy/revision.py (+0/-9)
breezy/revisionspec.py (+2/-4)
breezy/switch.py (+1/-1)
breezy/tests/blackbox/test_serve.py (+1/-1)
breezy/tests/per_branch/test_update.py (+1/-2)
breezy/tests/per_workingtree/test_commit.py (+1/-2)
breezy/tests/per_workingtree/test_parents.py (+1/-2)
breezy/transactions.py (+6/-2)
breezy/workingtree.py (+3/-3)
setup.cfg (+1/-0)
To merge this branch: bzr merge lp:brz/3.3
Reviewer Review Type Date Requested Status
Jelmer Vernooij Approve
Review via email: mp+433071@code.launchpad.net

Commit message

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 :

There are additional revisions which have not been approved in review. Please seek review and approval of these new revisions.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'breezy/branch.py'
2--- breezy/branch.py 2022-11-13 20:26:24 +0000
3+++ breezy/branch.py 2022-11-15 21:31:51 +0000
4@@ -1930,7 +1930,7 @@
5 self._default_format = None
6
7
8-network_format_registry = registry.FormatRegistry()
9+network_format_registry = registry.FormatRegistry[BranchFormat]()
10 """Registry of formats indexed by their network name.
11
12 The network name for a branch format is an identifier that can be used when
13@@ -2237,7 +2237,7 @@
14
15 # what's the current last revision, before we fetch [and change it
16 # possibly]
17- last_rev = _mod_revision.ensure_null(self.target.last_revision())
18+ last_rev = self.target.last_revision()
19 # we fetch here so that we don't process data twice in the common
20 # case of having something to pull, and so that the check for
21 # already merged can operate on the just fetched graph, which will
22
23=== modified file 'breezy/builtins.py'
24--- breezy/builtins.py 2022-10-29 11:59:45 +0000
25+++ breezy/builtins.py 2022-11-15 21:31:51 +0000
26@@ -1833,7 +1833,7 @@
27 revision_id = revision[0].as_revision_id(branch)
28 else:
29 revision_id = branch.last_revision()
30- if revision_id == _mod_revision.ensure_null(tree.last_revision()):
31+ if revision_id == tree.last_revision():
32 revno = branch.revision_id_to_dotted_revno(revision_id)
33 note(gettext("Tree is up to date at revision {0} of branch {1}"
34 ).format('.'.join(map(str, revno)), branch_location))
35@@ -1855,8 +1855,7 @@
36 "brz update --revision only works"
37 " for a revision in the branch history")
38 % (exc.revision)) from exc
39- revno = tree.branch.revision_id_to_dotted_revno(
40- _mod_revision.ensure_null(tree.last_revision()))
41+ revno = tree.branch.revision_id_to_dotted_revno(tree.last_revision())
42 note(gettext('Updated to revision {0} of branch {1}').format(
43 '.'.join(map(str, revno)), branch_location))
44 parent_ids = tree.get_parent_ids()
45@@ -4346,14 +4345,12 @@
46
47 @display_command
48 def run(self, branch, other):
49- from .revision import ensure_null
50-
51 branch1 = Branch.open_containing(branch)[0]
52 branch2 = Branch.open_containing(other)[0]
53 self.enter_context(branch1.lock_read())
54 self.enter_context(branch2.lock_read())
55- last1 = ensure_null(branch1.last_revision())
56- last2 = ensure_null(branch2.last_revision())
57+ last1 = branch1.last_revision()
58+ last2 = branch2.last_revision()
59
60 graph = branch1.repository.get_graph(branch2.repository)
61 base_rev_id = graph.find_unique_lca(last1, last2)
62@@ -4670,8 +4667,7 @@
63 if len(revision) == 2:
64 base_revision_id = revision[0].as_revision_id(base_branch)
65 if other_revision_id is None:
66- other_revision_id = _mod_revision.ensure_null(
67- other_branch.last_revision())
68+ other_revision_id = other_branch.last_revision()
69 # Remember where we merge from. We need to remember if:
70 # - user specify a location (and we don't merge from the parent
71 # branch)
72@@ -5769,7 +5765,7 @@
73 def run(self, submit_branch=None, public_branch=None, patch_type='bundle',
74 sign=False, revision=None, mail_to=None, message=None,
75 directory=u'.'):
76- from .revision import ensure_null, NULL_REVISION
77+ from .revision import NULL_REVISION
78 include_patch, include_bundle = {
79 'plain': (False, False),
80 'diff': (True, False),
81@@ -5808,7 +5804,6 @@
82 base_revision_id = revision[0].as_revision_id(branch)
83 else:
84 revision_id = branch.last_revision()
85- revision_id = ensure_null(revision_id)
86 if revision_id == NULL_REVISION:
87 raise errors.CommandError(gettext('No revisions to bundle.'))
88 directive = merge_directive.MergeDirective2.from_objects(
89
90=== modified file 'breezy/bzr/__init__.py'
91--- breezy/bzr/__init__.py 2022-08-22 18:19:46 +0000
92+++ breezy/bzr/__init__.py 2022-11-15 21:31:51 +0000
93@@ -14,6 +14,8 @@
94 # along with this program; if not, write to the Free Software
95 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
96
97+from typing import TYPE_CHECKING
98+
99 from .. import (
100 config,
101 errors,
102@@ -24,6 +26,10 @@
103 )
104
105
106+if TYPE_CHECKING:
107+ from .bzrdir import BzrDirFormat
108+
109+
110 class LineEndingError(errors.BzrError):
111
112 _fmt = ("Line ending corrupted for file: %(file)s; "
113@@ -36,7 +42,7 @@
114 class BzrProber(controldir.Prober):
115 """Prober for formats that use a .bzr/ control directory."""
116
117- formats = registry.FormatRegistry(controldir.network_format_registry)
118+ formats = registry.FormatRegistry["BzrDirFormat"](controldir.network_format_registry)
119 """The known .bzr formats."""
120
121 @classmethod
122
123=== modified file 'breezy/bzr/branch.py'
124--- breezy/bzr/branch.py 2022-10-29 11:59:45 +0000
125+++ breezy/bzr/branch.py 2022-11-15 21:31:51 +0000
126@@ -240,7 +240,6 @@
127 if not revision_id or not isinstance(revision_id, bytes):
128 raise errors.InvalidRevisionId(
129 revision_id=revision_id, branch=self)
130- revision_id = _mod_revision.ensure_null(revision_id)
131 with self.lock_write():
132 old_revno, old_revid = self.last_revision_info()
133 if self.get_append_revisions_only():
134@@ -370,11 +369,10 @@
135 with self.lock_write():
136 master = self.get_master_branch(possible_transports)
137 if master is not None:
138- old_tip = _mod_revision.ensure_null(self.last_revision())
139+ old_tip = self.last_revision()
140 self.pull(master, overwrite=True)
141 if self.repository.get_graph().is_ancestor(
142- old_tip, _mod_revision.ensure_null(
143- self.last_revision())):
144+ old_tip, self.last_revision()):
145 return None
146 return old_tip
147 return None
148@@ -393,7 +391,6 @@
149
150 Does not update the revision_history cache.
151 """
152- revision_id = _mod_revision.ensure_null(revision_id)
153 out_string = b'%d %s\n' % (revno, revision_id)
154 self._transport.put_bytes('last-revision', out_string,
155 mode=self.controldir._get_file_mode())
156@@ -513,13 +510,12 @@
157 self._reference_info = None
158
159 def _check_history_violation(self, revision_id):
160- current_revid = self.last_revision()
161- last_revision = _mod_revision.ensure_null(current_revid)
162+ last_revision = self.last_revision()
163 if _mod_revision.is_null(last_revision):
164 return
165 graph = self.repository.get_graph()
166 for lh_ancestor in graph.iter_lefthand_ancestry(revision_id):
167- if lh_ancestor == current_revid:
168+ if lh_ancestor == last_revision:
169 return
170 raise errors.AppendRevisionsOnlyViolation(self.user_url)
171
172
173=== modified file 'breezy/bzr/fullhistory.py'
174--- breezy/bzr/fullhistory.py 2020-02-18 01:57:45 +0000
175+++ breezy/bzr/fullhistory.py 2022-11-15 21:31:51 +0000
176@@ -40,7 +40,6 @@
177 if not revision_id or not isinstance(revision_id, bytes):
178 raise errors.InvalidRevisionId(
179 revision_id=revision_id, branch=self)
180- revision_id = _mod_revision.ensure_null(revision_id)
181 with self.lock_write():
182 # this old format stores the full history, but this api doesn't
183 # provide it, so we must generate, and might as well check it's
184
185=== modified file 'breezy/bzr/remote.py'
186--- breezy/bzr/remote.py 2022-11-13 20:26:24 +0000
187+++ breezy/bzr/remote.py 2022-11-15 21:31:51 +0000
188@@ -1933,7 +1933,6 @@
189
190 def revision_tree(self, revision_id):
191 with self.lock_read():
192- revision_id = _mod_revision.ensure_null(revision_id)
193 if revision_id == _mod_revision.NULL_REVISION:
194 return InventoryRevisionTree(self,
195 Inventory(root_id=None), _mod_revision.NULL_REVISION)
196
197=== modified file 'breezy/bzr/tests/per_bzrdir/test_bzrdir.py'
198--- breezy/bzr/tests/per_bzrdir/test_bzrdir.py 2022-08-22 18:19:46 +0000
199+++ breezy/bzr/tests/per_bzrdir/test_bzrdir.py 2022-11-15 21:31:51 +0000
200@@ -437,8 +437,7 @@
201 self.assertTrue(repo.has_revision(b'1'))
202 try:
203 self.assertTrue(
204- _mod_revision.is_null(_mod_revision.ensure_null(
205- dir.open_branch().last_revision())))
206+ _mod_revision.is_null(dir.open_branch().last_revision()))
207 except errors.NotBranchError:
208 pass
209 target = dir.sprout(self.get_url('target'))
210
211=== modified file 'breezy/bzr/tests/test__simple_set.py'
212--- breezy/bzr/tests/test__simple_set.py 2022-09-24 17:01:11 +0000
213+++ breezy/bzr/tests/test__simple_set.py 2022-11-15 21:31:51 +0000
214@@ -104,10 +104,14 @@
215 assertRefcount actually creates a new pointer, as does calling
216 sys.getrefcount. So pass the expected value *before* the call.
217 """
218- # I'm not sure why the offset is 3, but I've check that in the caller,
219- # an offset of 1 works, which is expected. Not sure why assertRefcount
220- # is incrementing/decrementing 2 times
221- self.assertEqual(count, sys.getrefcount(obj) - 3)
222+ if sys.version_info < (3, 11):
223+ # I'm not sure why the offset is 3, but I've check that in the caller,
224+ # an offset of 1 works, which is expected. Not sure why assertRefcount
225+ # is incrementing/decrementing 2 times
226+ self.assertEqual(count, sys.getrefcount(obj) - 3)
227+ else:
228+ # On 3.11, the offset is 2
229+ self.assertEqual(count, sys.getrefcount(obj) - 2)
230
231 def test_initial(self):
232 obj = self.module.SimpleSet()
233
234=== modified file 'breezy/bzr/tests/test__static_tuple.py'
235--- breezy/bzr/tests/test__static_tuple.py 2022-09-23 03:17:56 +0000
236+++ breezy/bzr/tests/test__static_tuple.py 2022-11-15 21:31:51 +0000
237@@ -52,12 +52,15 @@
238 assertRefcount actually creates a new pointer, as does calling
239 sys.getrefcount. So pass the expected value *before* the call.
240 """
241- # I don't understand why it is getrefcount()-3 here, but it seems to be
242- # correct. If I check in the calling function, with:
243- # self.assertEqual(count, sys.getrefcount(obj)-1)
244- # Then it works fine. Something about passing it to assertRefcount is
245- # actually double-incrementing (and decrementing) the refcount
246- self.assertEqual(count, sys.getrefcount(obj) - 3)
247+ if sys.version_info < (3, 11):
248+ # I don't understand why it is getrefcount()-3 here, but it seems to be
249+ # correct. If I check in the calling function, with:
250+ # self.assertEqual(count, sys.getrefcount(obj)-1)
251+ # Then it works fine. Something about passing it to assertRefcount is
252+ # actually double-incrementing (and decrementing) the refcount
253+ self.assertEqual(count, sys.getrefcount(obj) - 3)
254+ else:
255+ self.assertEqual(count, sys.getrefcount(obj) - 2)
256
257 def test_create(self):
258 k = self.module.StaticTuple('foo')
259
260=== modified file 'breezy/bzr/vf_repository.py'
261--- breezy/bzr/vf_repository.py 2022-09-01 19:17:39 +0000
262+++ breezy/bzr/vf_repository.py 2022-11-15 21:31:51 +0000
263@@ -1554,7 +1554,6 @@
264
265 `revision_id` may be NULL_REVISION for the empty tree revision.
266 """
267- revision_id = _mod_revision.ensure_null(revision_id)
268 # TODO: refactor this to use an existing revision object
269 # so we don't need to read it in twice.
270 if revision_id == _mod_revision.NULL_REVISION:
271
272=== modified file 'breezy/bzr/workingtree.py'
273--- breezy/bzr/workingtree.py 2022-11-13 18:35:58 +0000
274+++ breezy/bzr/workingtree.py 2022-11-15 21:31:51 +0000
275@@ -1997,7 +1997,7 @@
276 self.add_parent_tree((old_tip, other_tree))
277 return len(nb_conflicts)
278
279- if last_rev != _mod_revision.ensure_null(revision):
280+ if last_rev != revision:
281 # the working tree is up to date with the branch
282 # we can merge the specified revision from master
283 to_tree = self.branch.repository.revision_tree(revision)
284
285=== modified file 'breezy/bzr/workingtree_3.py'
286--- breezy/bzr/workingtree_3.py 2022-08-22 18:19:46 +0000
287+++ breezy/bzr/workingtree_3.py 2022-11-15 21:31:51 +0000
288@@ -205,7 +205,7 @@
289 else:
290 branch = a_controldir.open_branch()
291 if revision_id is None:
292- revision_id = _mod_revision.ensure_null(branch.last_revision())
293+ revision_id = branch.last_revision()
294 # WorkingTree3 can handle an inventory which has a unique root id.
295 # as of bzr 0.12. However, bzr 0.11 and earlier fail to handle
296 # those trees. And because there isn't a format bump inbetween, we
297
298=== modified file 'breezy/controldir.py'
299--- breezy/controldir.py 2022-10-08 17:46:49 +0000
300+++ breezy/controldir.py 2022-11-15 21:31:51 +0000
301@@ -32,7 +32,6 @@
302
303 from breezy import (
304 branch as _mod_branch,
305- revision as _mod_revision,
306 ui,
307 urlutils,
308 )
309@@ -45,6 +44,7 @@
310 errors,
311 hooks,
312 registry,
313+ revision as _mod_revision,
314 trace,
315 transport as _mod_transport,
316 )
317@@ -998,7 +998,7 @@
318 raise NotImplementedError(cls.get_format_string)
319
320
321-class ControlComponentFormatRegistry(registry.FormatRegistry):
322+class ControlComponentFormatRegistry(registry.FormatRegistry[ControlComponentFormat]):
323 """A registry for control components (branch, workingtree, repository)."""
324
325 def __init__(self, other_registry=None):
326@@ -1185,14 +1185,14 @@
327 target_format.rich_root_data)
328
329 @classmethod
330- def register_prober(klass, prober):
331+ def register_prober(klass, prober: Type["Prober"]):
332 """Register a prober that can look for a control dir.
333
334 """
335 klass._probers.append(prober)
336
337 @classmethod
338- def unregister_prober(klass, prober):
339+ def unregister_prober(klass, prober: Type["Prober"]):
340 """Unregister a prober.
341
342 """
343@@ -1203,7 +1203,7 @@
344 return self.get_format_description().rstrip()
345
346 @classmethod
347- def all_probers(klass):
348+ def all_probers(klass) -> List[Type["Prober"]]:
349 return klass._probers
350
351 @classmethod
352@@ -1329,7 +1329,7 @@
353 this in the future - for instance to make bzr talk with svn working
354 trees.
355 """
356- raise NotImplementedError(self.is_control_filename)
357+ raise NotImplementedError(cls.is_control_filename)
358
359
360 class Prober(object):
361@@ -1394,7 +1394,7 @@
362 self.experimental = experimental
363
364
365-class ControlDirFormatRegistry(registry.Registry):
366+class ControlDirFormatRegistry(registry.Registry[str, ControlDirFormat]):
367 """Registry of user-selectable ControlDir subformats.
368
369 Differs from ControlDirFormat._formats in that it provides sub-formats,
370@@ -1677,7 +1677,7 @@
371 # on previous ones.
372 format_registry = ControlDirFormatRegistry()
373
374-network_format_registry = registry.FormatRegistry()
375+network_format_registry = registry.FormatRegistry[ControlDirFormat]()
376 """Registry of formats indexed by their network name.
377
378 The network name for a ControlDirFormat is an identifier that can be used when
379
380=== modified file 'breezy/git/workingtree.py'
381--- breezy/git/workingtree.py 2022-11-13 18:35:58 +0000
382+++ breezy/git/workingtree.py 2022-11-15 21:31:51 +0000
383@@ -382,7 +382,7 @@
384 This implementation reads the pending merges list and last_revision
385 value and uses that to decide what the parents list should be.
386 """
387- last_rev = _mod_revision.ensure_null(self._last_revision())
388+ last_rev = self._last_revision()
389 if _mod_revision.NULL_REVISION == last_rev:
390 parents = []
391 else:
392@@ -1537,7 +1537,7 @@
393 self.add_parent_tree((old_tip, other_tree))
394 return len(nb_conflicts)
395
396- if last_rev != _mod_revision.ensure_null(revision):
397+ if last_rev != revision:
398 to_tree = self.branch.repository.revision_tree(revision)
399
400 # determine the branch point
401
402=== modified file 'breezy/main.rs'
403--- breezy/main.rs 2022-11-03 17:14:55 +0000
404+++ breezy/main.rs 2022-11-15 21:31:51 +0000
405@@ -4,9 +4,9 @@
406
407
408 fn check_version(py: Python<'_>) -> PyResult<()> {
409- let MAJOR: u32 = env!("CARGO_PKG_VERSION_MAJOR").parse::<u32>().unwrap();
410- let MINOR: u32 = env!("CARGO_PKG_VERSION_MINOR").parse::<u32>().unwrap();
411- let PATCH: u32 = env!("CARGO_PKG_VERSION_PATCH").parse::<u32>().unwrap();
412+ let major: u32 = env!("CARGO_PKG_VERSION_MAJOR").parse::<u32>().unwrap();
413+ let minor: u32 = env!("CARGO_PKG_VERSION_MINOR").parse::<u32>().unwrap();
414+ let patch: u32 = env!("CARGO_PKG_VERSION_PATCH").parse::<u32>().unwrap();
415 let breezy = PyModule::import(py, "breezy").map_err(|e| {
416 eprintln!(
417 "brz: ERROR: Couldn't import breezy and dependencies.\n\
418@@ -19,7 +19,7 @@
419 .getattr("version_info")?
420 .extract::<(u32, u32, u32, String, u32)>()?;
421
422- if ver.0 != MAJOR || ver.1 != MINOR || ver.2 != PATCH {
423+ if ver.0 != major || ver.1 != minor || ver.2 != patch {
424 eprintln!(
425 "\
426 brz: WARNING: breezy version doesn't match the brz program.\n \
427@@ -27,9 +27,9 @@
428 breezy version is {}\n \
429 brz version is {}.{}.{}\n",
430 breezy.getattr("_format_version_tuple")?.call1((ver,))?,
431- MAJOR,
432- MINOR,
433- PATCH
434+ major,
435+ minor,
436+ patch
437 );
438 }
439 Ok(())
440
441=== modified file 'breezy/memorytree.py'
442--- breezy/memorytree.py 2022-08-22 18:19:46 +0000
443+++ breezy/memorytree.py 2022-11-15 21:31:51 +0000
444@@ -89,8 +89,7 @@
445 @staticmethod
446 def create_on_branch(branch):
447 """Create a MemoryTree for branch, using the last-revision of branch."""
448- revision_id = _mod_revision.ensure_null(branch.last_revision())
449- return MemoryTree(branch, revision_id)
450+ return MemoryTree(branch, branch.last_revision())
451
452 def _gather_kinds(self, files, kinds):
453 """See MutableTree._gather_kinds.
454
455=== modified file 'breezy/merge.py'
456--- breezy/merge.py 2022-11-13 20:26:24 +0000
457+++ breezy/merge.py 2022-11-15 21:31:51 +0000
458@@ -273,8 +273,7 @@
459 recurse='down', revision_graph=None):
460 object.__init__(self)
461 self.this_branch = this_branch
462- self.this_basis = _mod_revision.ensure_null(
463- this_branch.last_revision())
464+ self.this_basis = this_branch.last_revision()
465 self.this_rev_id = None
466 self.this_tree = this_tree
467 self.this_revision_tree = None
468@@ -436,7 +435,6 @@
469 revision_id = branch.last_revision()
470 else:
471 revision_id = branch.get_rev_id(revno)
472- revision_id = _mod_revision.ensure_null(revision_id)
473 return branch, self.revision_tree(revision_id, branch)
474
475 def set_interesting_files(self, file_list):
476@@ -472,8 +470,7 @@
477 self.other_branch, self.other_tree = self._get_tree(other_revision,
478 possible_transports)
479 if other_revision[1] == -1:
480- self.other_rev_id = _mod_revision.ensure_null(
481- self.other_branch.last_revision())
482+ self.other_rev_id = self.other_branch.last_revision()
483 if _mod_revision.is_null(self.other_rev_id):
484 raise errors.NoCommits(self.other_branch)
485 self.other_basis = self.other_rev_id
486@@ -518,8 +515,7 @@
487 target.fetch(source, revision_id)
488
489 def find_base(self):
490- revisions = [_mod_revision.ensure_null(self.this_basis),
491- _mod_revision.ensure_null(self.other_basis)]
492+ revisions = [self.this_basis, self.other_basis]
493 if _mod_revision.NULL_REVISION in revisions:
494 self.base_rev_id = _mod_revision.NULL_REVISION
495 self.base_tree = self.revision_tree(self.base_rev_id)
496@@ -591,8 +587,7 @@
497 elif base_revision[1] is None:
498 self.base_rev_id = _mod_revision.NULL_REVISION
499 else:
500- self.base_rev_id = _mod_revision.ensure_null(
501- base_branch.get_rev_id(base_revision[1]))
502+ self.base_rev_id = base_branch.get_rev_id(base_revision[1])
503 self._maybe_fetch(base_branch, self.this_branch, self.base_rev_id)
504
505 def make_merger(self):
506
507=== modified file 'breezy/merge_directive.py'
508--- breezy/merge_directive.py 2022-10-08 17:46:49 +0000
509+++ breezy/merge_directive.py 2022-11-15 21:31:51 +0000
510@@ -208,7 +208,6 @@
511 patch = None
512 else:
513 submit_revision_id = submit_branch.last_revision()
514- submit_revision_id = _mod_revision.ensure_null(submit_revision_id)
515 repository.fetch(submit_branch.repository, submit_revision_id)
516 graph = repository.get_graph()
517 ancestor_id = graph.find_unique_lca(revision_id,
518@@ -620,7 +619,6 @@
519 if submit_branch.get_public_branch() is not None:
520 target_branch = submit_branch.get_public_branch()
521 submit_revision_id = submit_branch.last_revision()
522- submit_revision_id = _mod_revision.ensure_null(submit_revision_id)
523 graph = repository.get_graph(submit_branch.repository)
524 ancestor_id = graph.find_unique_lca(revision_id,
525 submit_revision_id)
526
527=== modified file 'breezy/plugins/weave_fmt/workingtree.py'
528--- breezy/plugins/weave_fmt/workingtree.py 2022-08-22 18:19:46 +0000
529+++ breezy/plugins/weave_fmt/workingtree.py 2022-11-15 21:31:51 +0000
530@@ -94,7 +94,7 @@
531 else:
532 branch = a_controldir.open_branch()
533 if revision_id is None:
534- revision_id = _mod_revision.ensure_null(branch.last_revision())
535+ revision_id = branch.last_revision()
536 with branch.lock_write():
537 branch.generate_revision_history(revision_id)
538 inv = inventory.Inventory()
539
540=== modified file 'breezy/registry.py'
541--- breezy/registry.py 2022-11-13 20:26:24 +0000
542+++ breezy/registry.py 2022-11-15 21:31:51 +0000
543@@ -27,6 +27,7 @@
544 Dict,
545 Iterator,
546 Tuple,
547+ Callable,
548 )
549
550 from .pyutils import get_named_object
551@@ -293,7 +294,8 @@
552 " Can be set to any existing key.")
553
554
555-class FormatRegistry(Registry):
556+Format = TypeVar('Format')
557+class FormatRegistry(Registry[str, Union[Format, Callable[[], Format]]]):
558 """Registry specialised for handling formats."""
559
560 def __init__(self, other_registry=None):
561
562=== modified file 'breezy/repository.py'
563--- breezy/repository.py 2022-11-15 16:29:43 +0000
564+++ breezy/repository.py 2022-11-15 21:31:51 +0000
565@@ -1259,7 +1259,7 @@
566 return controldir.format_registry.make_controldir('default').repository_format
567
568
569-network_format_registry = registry.FormatRegistry()
570+network_format_registry = registry.FormatRegistry["RepositoryFormat"]()
571 """Registry of formats indexed by their network name.
572
573 The network name for a repository format is an identifier that can be used when
574
575=== modified file 'breezy/revision.py'
576--- breezy/revision.py 2022-09-24 20:50:15 +0000
577+++ breezy/revision.py 2022-11-15 21:31:51 +0000
578@@ -223,15 +223,6 @@
579 raise errors.ReservedId(revision_id)
580
581
582-def ensure_null(revision_id: RevisionID) -> RevisionID:
583- """Ensure only NULL_REVISION is used to represent the null revision"""
584- if revision_id is None:
585- raise ValueError(
586- 'NULL_REVISION should be used for the null'
587- ' revision instead of None.')
588- return revision_id
589-
590-
591 def is_null(revision_id: RevisionID) -> bool:
592 if revision_id is None:
593 raise ValueError('NULL_REVISION should be used for the null'
594
595=== modified file 'breezy/revisionspec.py'
596--- breezy/revisionspec.py 2022-11-13 20:26:24 +0000
597+++ breezy/revisionspec.py 2022-11-15 21:31:51 +0000
598@@ -784,14 +784,14 @@
599 from .branch import Branch
600
601 with branch.lock_read():
602- revision_a = revision.ensure_null(branch.last_revision())
603+ revision_a = branch.last_revision()
604 if revision_a == revision.NULL_REVISION:
605 raise errors.NoCommits(branch)
606 if other_location == '':
607 other_location = branch.get_parent()
608 other_branch = Branch.open(other_location)
609 with other_branch.lock_read():
610- revision_b = revision.ensure_null(other_branch.last_revision())
611+ revision_b = other_branch.last_revision()
612 if revision_b == revision.NULL_REVISION:
613 raise errors.NoCommits(other_branch)
614 graph = branch.repository.get_graph(other_branch.repository)
615@@ -835,7 +835,6 @@
616 from .branch import Branch
617 other_branch = Branch.open(self.spec)
618 last_revision = other_branch.last_revision()
619- last_revision = revision.ensure_null(last_revision)
620 context_branch.fetch(other_branch, last_revision)
621 if last_revision == revision.NULL_REVISION:
622 raise errors.NoCommits(other_branch)
623@@ -845,7 +844,6 @@
624 from .branch import Branch
625 other_branch = Branch.open(self.spec)
626 last_revision = other_branch.last_revision()
627- last_revision = revision.ensure_null(last_revision)
628 if last_revision == revision.NULL_REVISION:
629 raise errors.NoCommits(other_branch)
630 return other_branch.repository.revision_tree(last_revision)
631
632=== modified file 'breezy/switch.py'
633--- breezy/switch.py 2020-06-23 01:02:30 +0000
634+++ breezy/switch.py 2022-11-15 21:31:51 +0000
635@@ -169,7 +169,7 @@
636
637 def _any_local_commits(this_branch, possible_transports):
638 """Does this branch have any commits not in the master branch?"""
639- last_rev = revision.ensure_null(this_branch.last_revision())
640+ last_rev = this_branch.last_revision()
641 if last_rev != revision.NULL_REVISION:
642 other_branch = this_branch.get_master_branch(possible_transports)
643 with this_branch.lock_read(), other_branch.lock_read():
644
645=== modified file 'breezy/tests/blackbox/test_serve.py'
646--- breezy/tests/blackbox/test_serve.py 2022-09-24 20:50:15 +0000
647+++ breezy/tests/blackbox/test_serve.py 2022-11-15 21:31:51 +0000
648@@ -157,7 +157,7 @@
649 with branch.lock_read():
650 branch.repository.all_revision_ids()
651 self.assertEqual(_mod_revision.NULL_REVISION,
652- _mod_revision.ensure_null(branch.last_revision()))
653+ branch.last_revision())
654
655 def start_server_inet(self, extra_options=()):
656 """Start a brz server subprocess using the --inet option.
657
658=== modified file 'breezy/tests/per_branch/test_update.py'
659--- breezy/tests/per_branch/test_update.py 2021-12-25 14:55:24 +0000
660+++ breezy/tests/per_branch/test_update.py 2022-11-15 21:31:51 +0000
661@@ -32,8 +32,7 @@
662 def test_update_unbound_works(self):
663 b = self.make_branch('.')
664 b.update()
665- self.assertEqual(_mod_revision.NULL_REVISION,
666- _mod_revision.ensure_null(b.last_revision()))
667+ self.assertEqual(_mod_revision.NULL_REVISION, b.last_revision())
668
669 def test_update_prefix_returns_none(self):
670 # update in a branch when its a prefix of the master should
671
672=== modified file 'breezy/tests/per_workingtree/test_commit.py'
673--- breezy/tests/per_workingtree/test_commit.py 2022-07-02 13:44:01 +0000
674+++ breezy/tests/per_workingtree/test_commit.py 2022-11-15 21:31:51 +0000
675@@ -263,8 +263,7 @@
676 return
677 committed_id = tree.commit('foo', local=True)
678 self.assertFalse(master.repository.has_revision(committed_id))
679- self.assertEqual(_mod_revision.NULL_REVISION,
680- (_mod_revision.ensure_null(master.last_revision())))
681+ self.assertEqual(_mod_revision.NULL_REVISION, master.last_revision())
682
683 def test_record_initial_ghost(self):
684 """The working tree needs to record ghosts during commit."""
685
686=== modified file 'breezy/tests/per_workingtree/test_parents.py'
687--- breezy/tests/per_workingtree/test_parents.py 2021-12-08 18:46:11 +0000
688+++ breezy/tests/per_workingtree/test_parents.py 2022-11-15 21:31:51 +0000
689@@ -51,8 +51,7 @@
690 """
691 self.assertEqual(expected, tree.get_parent_ids())
692 if expected == []:
693- self.assertEqual(_mod_revision.NULL_REVISION,
694- _mod_revision.ensure_null(tree.last_revision()))
695+ self.assertEqual(_mod_revision.NULL_REVISION, tree.last_revision())
696 else:
697 self.assertEqual(expected[0], tree.last_revision())
698
699
700=== modified file 'breezy/transactions.py'
701--- breezy/transactions.py 2020-02-18 01:57:45 +0000
702+++ breezy/transactions.py 2022-11-15 21:31:51 +0000
703@@ -98,8 +98,12 @@
704 # the map backwards
705 # _clean_objects
706 # _clean_queue
707- # 1 missing ?
708- if (sys.getrefcount(self._clean_queue[offset]) <= 7
709+ if sys.version_info >= (3, 11):
710+ ref_threshold = 6
711+ else:
712+ # 1 missing on Python < 3.11
713+ ref_threshold = 7
714+ if (sys.getrefcount(self._clean_queue[offset]) <= ref_threshold
715 and not self._clean_queue[offset] in self._precious_objects):
716 removed = self._clean_queue[offset]
717 self._clean_objects.remove(removed)
718
719=== modified file 'breezy/workingtree.py'
720--- breezy/workingtree.py 2022-10-30 14:30:21 +0000
721+++ breezy/workingtree.py 2022-11-15 21:31:51 +0000
722@@ -403,7 +403,7 @@
723 This implementation reads the pending merges list and last_revision
724 value and uses that to decide what the parents list should be.
725 """
726- last_rev = _mod_revision.ensure_null(self._last_revision())
727+ last_rev = self._last_revision()
728 if _mod_revision.NULL_REVISION == last_rev:
729 parents = []
730 else:
731@@ -646,7 +646,7 @@
732 if not force and self.has_changes():
733 raise errors.UncommittedChanges(self)
734 if to_revision is None:
735- to_revision = _mod_revision.ensure_null(branch.last_revision())
736+ to_revision = branch.last_revision()
737 merger.other_rev_id = to_revision
738 if _mod_revision.is_null(merger.other_rev_id):
739 raise errors.NoCommits(branch)
740@@ -928,7 +928,7 @@
741 def _last_revision(self):
742 """helper for get_parent_ids."""
743 with self.lock_read():
744- return _mod_revision.ensure_null(self.branch.last_revision())
745+ return self.branch.last_revision()
746
747 def is_locked(self):
748 """Check if this tree is locked."""
749
750=== modified file 'setup.cfg'
751--- setup.cfg 2022-10-30 01:37:08 +0000
752+++ setup.cfg 2022-11-15 21:31:51 +0000
753@@ -119,6 +119,7 @@
754 tests/ssl_certs/server_without_pass.key
755 tests/ssl_certs/server_with_pass.key
756 tests/ssl_certs/server.crt
757+ py.typed
758
759 [mypy]
760 ignore_missing_imports = True

Subscribers

People subscribed via source and target branches