Merge lp:~jelmer/brz/ruff-format into lp:brz

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: no longer in the source branch.
Merged at revision: 7889
Proposed branch: lp:~jelmer/brz/ruff-format
Merge into: lp:brz
Diff against target: 387715 lines (+127812/-101117)
995 files modified
.flake8 (+0/-44)
Makefile (+27/-15)
apport/source_brz.py (+13/-12)
breezy/__init__.py (+29/-28)
breezy/__main__.py (+12/-8)
breezy/_annotator_py.py (+35/-29)
breezy/_known_graph_py.py (+28/-22)
breezy/add.py (+11/-11)
breezy/annotate.py (+112/-80)
breezy/archive/__init__.py (+42/-26)
breezy/archive/tar.py (+50/-34)
breezy/archive/zip.py (+15/-16)
breezy/atomicfile.py (+15/-14)
breezy/bisect.py (+45/-39)
breezy/bisect_multi.py (+2/-2)
breezy/branch.py (+475/-301)
breezy/branchbuilder.py (+63/-43)
breezy/breakin.py (+11/-8)
breezy/bugtracker.py (+60/-64)
breezy/builtins.py (+3152/-2161)
breezy/bzr/__init__.py (+363/-307)
breezy/bzr/_btree_serializer_py.py (+18/-13)
breezy/bzr/_chk_map_py.py (+28/-20)
breezy/bzr/_dirstate_helpers_py.py (+41/-31)
breezy/bzr/_groupcompress_py.py (+35/-29)
breezy/bzr/_knit_load_data_py.py (+16/-12)
breezy/bzr/_static_tuple_py.py (+7/-5)
breezy/bzr/branch.py (+253/-179)
breezy/bzr/btree_index.py (+154/-118)
breezy/bzr/bundle/apply_bundle.py (+6/-7)
breezy/bzr/bundle/bundle_data.py (+140/-121)
breezy/bzr/bundle/commands.py (+44/-27)
breezy/bzr/bundle/serializer/__init__.py (+27/-30)
breezy/bzr/bundle/serializer/v08.py (+152/-129)
breezy/bzr/bundle/serializer/v09.py (+2/-3)
breezy/bzr/bundle/serializer/v4.py (+183/-125)
breezy/bzr/bzrdir.py (+458/-281)
breezy/bzr/check.py (+103/-68)
breezy/bzr/chk_map.py (+279/-201)
breezy/bzr/chk_serializer.py (+40/-26)
breezy/bzr/conflicts.py (+103/-94)
breezy/bzr/debug_commands.py (+27/-22)
breezy/bzr/dirstate.py (+1080/-777)
breezy/bzr/fetch.py (+77/-49)
breezy/bzr/fullhistory.py (+24/-22)
breezy/bzr/groupcompress.py (+436/-314)
breezy/bzr/groupcompress_repo.py (+462/-303)
breezy/bzr/index.py (+217/-175)
breezy/bzr/inventory.py (+404/-237)
breezy/bzr/inventory_delta.py (+10/-3)
breezy/bzr/inventorytree.py (+314/-204)
breezy/bzr/knit.py (+625/-465)
breezy/bzr/knitpack_repo.py (+348/-205)
breezy/bzr/knitrepo.py (+124/-85)
breezy/bzr/lockable_files.py (+27/-20)
breezy/bzr/pack.py (+38/-46)
breezy/bzr/pack_repo.py (+531/-321)
breezy/bzr/reconcile.py (+89/-79)
breezy/bzr/remote.py (+1293/-899)
breezy/bzr/repository.py (+38/-28)
breezy/bzr/rio_patch.py (+19/-21)
breezy/bzr/serializer.py (+26/-16)
breezy/bzr/smart/branch.py (+91/-91)
breezy/bzr/smart/bzrdir.py (+164/-139)
breezy/bzr/smart/client.py (+97/-72)
breezy/bzr/smart/medium.py (+147/-109)
breezy/bzr/smart/message.py (+55/-46)
breezy/bzr/smart/packrepository.py (+3/-4)
breezy/bzr/smart/ping.py (+9/-7)
breezy/bzr/smart/protocol.py (+251/-223)
breezy/bzr/smart/repository.py (+288/-247)
breezy/bzr/smart/request.py (+624/-351)
breezy/bzr/smart/server.py (+87/-64)
breezy/bzr/smart/signals.py (+3/-3)
breezy/bzr/smart/vfs.py (+49/-51)
breezy/bzr/static_tuple.py (+3/-2)
breezy/bzr/tag.py (+11/-8)
breezy/bzr/testament.py (+52/-44)
breezy/bzr/tests/__init__.py (+57/-54)
breezy/bzr/tests/blackbox/__init__.py (+8/-7)
breezy/bzr/tests/blackbox/test_dump_btree.py (+49/-52)
breezy/bzr/tests/matchers.py (+9/-6)
breezy/bzr/tests/per_bzrdir/__init__.py (+27/-18)
breezy/bzr/tests/per_bzrdir/test_bzrdir.py (+374/-288)
breezy/bzr/tests/per_inventory/__init__.py (+22/-15)
breezy/bzr/tests/per_inventory/basics.py (+352/-225)
breezy/bzr/tests/per_pack_repository.py (+403/-360)
breezy/bzr/tests/per_repository_chk/__init__.py (+11/-12)
breezy/bzr/tests/per_repository_chk/test_supported.py (+139/-104)
breezy/bzr/tests/per_repository_chk/test_unsupported.py (+1/-2)
breezy/bzr/tests/per_repository_vf/__init__.py (+17/-16)
breezy/bzr/tests/per_repository_vf/helpers.py (+19/-16)
breezy/bzr/tests/per_repository_vf/test__generate_text_key_index.py (+1/-2)
breezy/bzr/tests/per_repository_vf/test_add_inventory_by_delta.py (+33/-23)
breezy/bzr/tests/per_repository_vf/test_check.py (+24/-25)
breezy/bzr/tests/per_repository_vf/test_check_reconcile.py (+460/-318)
breezy/bzr/tests/per_repository_vf/test_fetch.py (+13/-7)
breezy/bzr/tests/per_repository_vf/test_fileid_involved.py (+174/-141)
breezy/bzr/tests/per_repository_vf/test_find_text_key_references.py (+1/-2)
breezy/bzr/tests/per_repository_vf/test_merge_directive.py (+25/-18)
breezy/bzr/tests/per_repository_vf/test_reconcile.py (+140/-128)
breezy/bzr/tests/per_repository_vf/test_refresh_data.py (+14/-14)
breezy/bzr/tests/per_repository_vf/test_repository.py (+181/-153)
breezy/bzr/tests/per_repository_vf/test_write_group.py (+230/-159)
breezy/bzr/tests/per_versionedfile.py (+1500/-1187)
breezy/bzr/tests/test__btree_serializer.py (+57/-59)
breezy/bzr/tests/test__chk_map.py (+117/-70)
breezy/bzr/tests/test__dirstate_helpers.py (+469/-415)
breezy/bzr/tests/test__groupcompress.py (+215/-187)
breezy/bzr/tests/test__simple_set.py (+62/-66)
breezy/bzr/tests/test__static_tuple.py (+181/-154)
breezy/bzr/tests/test_btree_index.py (+583/-421)
breezy/bzr/tests/test_bundle.py (+844/-693)
breezy/bzr/tests/test_bzrdir.py (+696/-619)
breezy/bzr/tests/test_chk_map.py (+1490/-1133)
breezy/bzr/tests/test_chk_serializer.py (+74/-47)
breezy/bzr/tests/test_conflicts.py (+41/-41)
breezy/bzr/tests/test_dirstate.py (+1835/-1322)
breezy/bzr/tests/test_generate_ids.py (+47/-46)
breezy/bzr/tests/test_groupcompress.py (+591/-511)
breezy/bzr/tests/test_hashcache.py (+27/-27)
breezy/bzr/tests/test_index.py (+1073/-712)
breezy/bzr/tests/test_inv.py (+920/-475)
breezy/bzr/tests/test_inventory_delta.py (+460/-207)
breezy/bzr/tests/test_knit.py (+1454/-1101)
breezy/bzr/tests/test_lockable_files.py (+45/-47)
breezy/bzr/tests/test_matchers.py (+11/-6)
breezy/bzr/tests/test_pack.py (+151/-153)
breezy/bzr/tests/test_read_bundle.py (+23/-21)
breezy/bzr/tests/test_remote.py (+2400/-1770)
breezy/bzr/tests/test_repository.py (+581/-512)
breezy/bzr/tests/test_rio.py (+150/-123)
breezy/bzr/tests/test_serializer.py (+16/-10)
breezy/bzr/tests/test_smart.py (+1396/-1222)
breezy/bzr/tests/test_smart_request.py (+69/-58)
breezy/bzr/tests/test_smart_signals.py (+49/-46)
breezy/bzr/tests/test_smart_transport.py (+1460/-1308)
breezy/bzr/tests/test_tag.py (+2/-3)
breezy/bzr/tests/test_testament.py (+104/-92)
breezy/bzr/tests/test_transform.py (+217/-189)
breezy/bzr/tests/test_tuned_gzip.py (+11/-11)
breezy/bzr/tests/test_versionedfile.py (+62/-58)
breezy/bzr/tests/test_vf_search.py (+129/-98)
breezy/bzr/tests/test_vfs_ratchet.py (+169/-182)
breezy/bzr/tests/test_weave.py (+381/-378)
breezy/bzr/tests/test_workingtree.py (+6/-5)
breezy/bzr/tests/test_workingtree_4.py (+357/-288)
breezy/bzr/tests/test_xml.py (+160/-110)
breezy/bzr/textinv.py (+28/-22)
breezy/bzr/transform.py (+421/-331)
breezy/bzr/tuned_gzip.py (+22/-17)
breezy/bzr/versionedfile.py (+511/-285)
breezy/bzr/vf_repository.py (+635/-479)
breezy/bzr/vf_search.py (+68/-37)
breezy/bzr/weave.py (+168/-125)
breezy/bzr/weavefile.py (+34/-33)
breezy/bzr/workingtree.py (+445/-299)
breezy/bzr/workingtree_3.py (+50/-33)
breezy/bzr/workingtree_4.py (+548/-384)
breezy/bzr/xml5.py (+31/-16)
breezy/bzr/xml6.py (+1/-1)
breezy/bzr/xml7.py (+2/-2)
breezy/bzr/xml8.py (+44/-35)
breezy/bzr/xml_serializer.py (+161/-108)
breezy/cache_utf8.py (+16/-12)
breezy/cethread.py (+10/-4)
breezy/check.py (+8/-6)
breezy/chunk_writer.py (+13/-10)
breezy/clean_tree.py (+29/-15)
breezy/cmd_test_script.py (+5/-8)
breezy/cmd_version_info.py (+58/-37)
breezy/cmdline.py (+12/-12)
breezy/colordiff.py (+40/-36)
breezy/commands.py (+241/-189)
breezy/commit.py (+174/-125)
breezy/commit_signature_commands.py (+31/-27)
breezy/config.py (+857/-639)
breezy/conflicts.py (+69/-53)
breezy/controldir.py (+294/-158)
breezy/counted_lock.py (+3/-3)
breezy/crash.py (+65/-58)
breezy/debug.py (+5/-3)
breezy/decorators.py (+5/-4)
breezy/delta.py (+203/-120)
breezy/diff.py (+406/-239)
breezy/directory_service.py (+42/-28)
breezy/dirty_tracker.py (+0/-2)
breezy/doc/__init__.py (+2/-2)
breezy/doc/api/__init__.py (+7/-5)
breezy/doc_generate/__init__.py (+2/-3)
breezy/doc_generate/autodoc_bash_completion.py (+6/-6)
breezy/doc_generate/autodoc_man.py (+37/-30)
breezy/doc_generate/autodoc_rstx.py (+19/-16)
breezy/doc_generate/conf.py (+49/-51)
breezy/email_message.py (+30/-22)
breezy/errors.py (+268/-381)
breezy/export.py (+51/-37)
breezy/export_pot.py (+49/-41)
breezy/externalcommand.py (+5/-4)
breezy/fetch_ghosts.py (+2/-4)
breezy/fifo_cache.py (+12/-8)
breezy/filter_tree.py (+3/-2)
breezy/filters/__init__.py (+8/-9)
breezy/filters/eol.py (+18/-21)
breezy/foreign.py (+2/-1)
breezy/forge.py (+47/-32)
breezy/git/__init__.py (+161/-115)
breezy/git/annotate.py (+41/-32)
breezy/git/branch.py (+353/-262)
breezy/git/cache.py (+101/-93)
breezy/git/commands.py (+73/-59)
breezy/git/commit.py (+32/-21)
breezy/git/config.py (+23/-20)
breezy/git/dir.py (+222/-128)
breezy/git/directory.py (+1/-2)
breezy/git/errors.py (+4/-2)
breezy/git/fetch.py (+283/-129)
breezy/git/filegraph.py (+23/-18)
breezy/git/git_remote_helper.py (+18/-13)
breezy/git/hg.py (+8/-10)
breezy/git/interrepo.py (+186/-121)
breezy/git/mapping.py (+193/-146)
breezy/git/memorytree.py (+11/-10)
breezy/git/object_store.py (+183/-101)
breezy/git/pristine_tar.py (+18/-21)
breezy/git/push.py (+4/-6)
breezy/git/refs.py (+4/-5)
breezy/git/remote.py (+247/-188)
breezy/git/repository.py (+98/-63)
breezy/git/revspec.py (+18/-9)
breezy/git/roundtrip.py (+4/-7)
breezy/git/send.py (+126/-52)
breezy/git/server.py (+28/-20)
breezy/git/tests/__init__.py (+78/-66)
breezy/git/tests/test_blackbox.py (+385/-310)
breezy/git/tests/test_branch.py (+67/-62)
breezy/git/tests/test_builder.py (+149/-140)
breezy/git/tests/test_cache.py (+99/-36)
breezy/git/tests/test_dir.py (+28/-29)
breezy/git/tests/test_fetch.py (+154/-73)
breezy/git/tests/test_git_remote_helper.py (+48/-46)
breezy/git/tests/test_mapping.py (+142/-98)
breezy/git/tests/test_memorytree.py (+73/-78)
breezy/git/tests/test_object_store.py (+117/-110)
breezy/git/tests/test_pristine_tar.py (+34/-20)
breezy/git/tests/test_push.py (+11/-13)
breezy/git/tests/test_refs.py (+20/-20)
breezy/git/tests/test_remote.py (+490/-414)
breezy/git/tests/test_repository.py (+123/-98)
breezy/git/tests/test_revspec.py (+0/-1)
breezy/git/tests/test_roundtrip.py (+19/-16)
breezy/git/tests/test_server.py (+27/-34)
breezy/git/tests/test_transform.py (+13/-15)
breezy/git/tests/test_transportgit.py (+16/-13)
breezy/git/tests/test_tree.py (+559/-244)
breezy/git/tests/test_unpeel_map.py (+13/-9)
breezy/git/tests/test_urls.py (+31/-31)
breezy/git/tests/test_workingtree.py (+234/-164)
breezy/git/transform.py (+226/-166)
breezy/git/transportgit.py (+98/-70)
breezy/git/tree.py (+475/-344)
breezy/git/unpeel_map.py (+1/-2)
breezy/git/urls.py (+11/-11)
breezy/git/workingtree.py (+359/-249)
breezy/globbing.py (+62/-66)
breezy/gpg.py (+111/-90)
breezy/graph.py (+188/-140)
breezy/grep.py (+99/-83)
breezy/help.py (+33/-30)
breezy/help_topics/__init__.py (+52/-43)
breezy/hooks.py (+75/-61)
breezy/i18n.py (+13/-10)
breezy/identitymap.py (+2/-2)
breezy/ignores.py (+32/-29)
breezy/info.py (+178/-156)
breezy/inter.py (+5/-4)
breezy/lazy_import.py (+80/-77)
breezy/lazy_regex.py (+23/-12)
breezy/library_state.py (+10/-6)
breezy/location.py (+16/-10)
breezy/lock.py (+55/-43)
breezy/lockdir.py (+68/-58)
breezy/log.py (+587/-406)
breezy/lru_cache.py (+20/-15)
breezy/lsprof.py (+59/-37)
breezy/mail_client.py (+233/-179)
breezy/memorybranch.py (+7/-6)
breezy/memorytree.py (+25/-22)
breezy/merge.py (+590/-397)
breezy/merge_directive.py (+252/-161)
breezy/mergeable.py (+15/-9)
breezy/mergetools.py (+33/-28)
breezy/missing.py (+76/-46)
breezy/msgeditor.py (+74/-56)
breezy/multiparent.py (+109/-88)
breezy/multiwalker.py (+36/-30)
breezy/mutabletree.py (+58/-39)
breezy/option.py (+179/-116)
breezy/osutils.py (+107/-81)
breezy/patch.py (+10/-3)
breezy/patches.py (+62/-66)
breezy/plugin.py (+73/-62)
breezy/plugins/bash_completion/__init__.py (+10/-8)
breezy/plugins/bash_completion/bashcomp.py (+121/-75)
breezy/plugins/bash_completion/tests/__init__.py (+5/-4)
breezy/plugins/bash_completion/tests/test_bashcomp.py (+135/-127)
breezy/plugins/changelog_merge/__init__.py (+13/-6)
breezy/plugins/changelog_merge/changelog_merge.py (+30/-30)
breezy/plugins/changelog_merge/tests/__init__.py (+5/-4)
breezy/plugins/changelog_merge/tests/test_changelog_merge.py (+108/-83)
breezy/plugins/commitfromnews/__init__.py (+20/-10)
breezy/plugins/commitfromnews/committemplate.py (+23/-20)
breezy/plugins/commitfromnews/tests/__init__.py (+6/-5)
breezy/plugins/commitfromnews/tests/test_committemplate.py (+62/-39)
breezy/plugins/commitfromnews/tests/test_msgeditor.py (+1/-2)
breezy/plugins/cvs/__init__.py (+10/-10)
breezy/plugins/darcs/__init__.py (+9/-8)
breezy/plugins/email/__init__.py (+59/-30)
breezy/plugins/email/emailer.py (+89/-77)
breezy/plugins/email/tests/testemail.py (+128/-104)
breezy/plugins/fastimport/__init__.py (+15/-10)
breezy/plugins/fastimport/branch_mapper.py (+11/-11)
breezy/plugins/fastimport/branch_updater.py (+20/-16)
breezy/plugins/fastimport/bzr_commit_handler.py (+216/-122)
breezy/plugins/fastimport/cache_manager.py (+25/-21)
breezy/plugins/fastimport/cmds.py (+175/-112)
breezy/plugins/fastimport/exporter.py (+180/-108)
breezy/plugins/fastimport/helpers.py (+23/-16)
breezy/plugins/fastimport/idmapfile.py (+2/-2)
breezy/plugins/fastimport/marks_file.py (+11/-13)
breezy/plugins/fastimport/processors/generic_processor.py (+90/-72)
breezy/plugins/fastimport/revision_store.py (+92/-53)
breezy/plugins/fastimport/tests/__init__.py (+12/-10)
breezy/plugins/fastimport/tests/test_branch_mapper.py (+21/-22)
breezy/plugins/fastimport/tests/test_commands.py (+52/-41)
breezy/plugins/fastimport/tests/test_exporter.py (+49/-59)
breezy/plugins/fastimport/tests/test_generic_processor.py (+1344/-957)
breezy/plugins/fastimport/tests/test_head_tracking.py (+36/-27)
breezy/plugins/fastimport/tests/test_marks_file.py (+28/-13)
breezy/plugins/fastimport/tests/test_revision_store.py (+103/-69)
breezy/plugins/fastimport/user_mapper.py (+4/-5)
breezy/plugins/flake8/__init__.py (+0/-134)
breezy/plugins/fossil/__init__.py (+12/-9)
breezy/plugins/github/__init__.py (+2/-1)
breezy/plugins/github/cmds.py (+15/-10)
breezy/plugins/github/forge.py (+365/-250)
breezy/plugins/github/tests/test_forge.py (+2/-3)
breezy/plugins/gitlab/__init__.py (+2/-1)
breezy/plugins/gitlab/cmds.py (+14/-11)
breezy/plugins/gitlab/forge.py (+329/-248)
breezy/plugins/gitlab/tests/test_forge.py (+25/-18)
breezy/plugins/hg/__init__.py (+22/-17)
breezy/plugins/launchpad/__init__.py (+26/-20)
breezy/plugins/launchpad/account.py (+15/-13)
breezy/plugins/launchpad/cmds.py (+46/-40)
breezy/plugins/launchpad/forge.py (+362/-237)
breezy/plugins/launchpad/lp_api.py (+72/-55)
breezy/plugins/launchpad/lp_directory.py (+46/-34)
breezy/plugins/launchpad/test_account.py (+51/-47)
breezy/plugins/launchpad/test_lp_api.py (+9/-7)
breezy/plugins/launchpad/test_lp_directory.py (+9/-11)
breezy/plugins/launchpad/test_lp_login.py (+20/-22)
breezy/plugins/launchpad/uris.py (+21/-25)
breezy/plugins/mtn/__init__.py (+9/-8)
breezy/plugins/netrc_credential_store/__init__.py (+10/-8)
breezy/plugins/netrc_credential_store/tests/__init__.py (+5/-4)
breezy/plugins/netrc_credential_store/tests/test_netrc.py (+16/-16)
breezy/plugins/news_merge/__init__.py (+9/-2)
breezy/plugins/news_merge/news_merge.py (+12/-10)
breezy/plugins/news_merge/parser.py (+20/-18)
breezy/plugins/po_merge/__init__.py (+21/-13)
breezy/plugins/po_merge/po_merge.py (+50/-35)
breezy/plugins/po_merge/tests/__init__.py (+5/-4)
breezy/plugins/po_merge/tests/test_po_merge.py (+95/-57)
breezy/plugins/propose/__init__.py (+8/-5)
breezy/plugins/propose/cmds.py (+191/-136)
breezy/plugins/pypi/__init__.py (+6/-3)
breezy/plugins/pypi/directory.py (+8/-10)
breezy/plugins/quilt/__init__.py (+81/-46)
breezy/plugins/quilt/merge.py (+12/-6)
breezy/plugins/quilt/quilt.py (+46/-20)
breezy/plugins/quilt/tests/__init__.py (+7/-6)
breezy/plugins/quilt/tests/test_merge.py (+214/-136)
breezy/plugins/quilt/tests/test_wrapper.py (+51/-37)
breezy/plugins/quilt/wrapper.py (+87/-41)
breezy/plugins/repodebug/__init__.py (+15/-18)
breezy/plugins/repodebug/check_chk.py (+20/-11)
breezy/plugins/repodebug/chk_used_by.py (+8/-8)
breezy/plugins/repodebug/fetch_all_records.py (+12/-12)
breezy/plugins/repodebug/file_refs.py (+6/-7)
breezy/plugins/repodebug/missing_keys_for_stacking_fixer.py (+19/-13)
breezy/plugins/repodebug/repo_has_key.py (+1/-1)
breezy/plugins/repodebug/repo_keys.py (+2/-2)
breezy/plugins/repodebug/tests/__init__.py (+38/-38)
breezy/plugins/rewrite/__init__.py (+18/-9)
breezy/plugins/rewrite/commands.py (+150/-90)
breezy/plugins/rewrite/maptree.py (+6/-3)
breezy/plugins/rewrite/pseudonyms.py (+14/-10)
breezy/plugins/rewrite/rebase.py (+87/-50)
breezy/plugins/rewrite/tests/__init__.py (+9/-7)
breezy/plugins/rewrite/tests/test_blackbox.py (+251/-241)
breezy/plugins/rewrite/tests/test_maptree.py (+13/-17)
breezy/plugins/rewrite/tests/test_pseudonyms.py (+25/-9)
breezy/plugins/rewrite/tests/test_rebase.py (+218/-160)
breezy/plugins/rewrite/tests/test_upgrade.py (+0/-1)
breezy/plugins/rewrite/upgrade.py (+78/-35)
breezy/plugins/stats/__init__.py (+15/-11)
breezy/plugins/stats/classify.py (+16/-4)
breezy/plugins/stats/cmds.py (+80/-72)
breezy/plugins/stats/test_blackbox.py (+25/-16)
breezy/plugins/stats/test_stats.py (+186/-67)
breezy/plugins/svn/__init__.py (+29/-29)
breezy/plugins/svn/revspec.py (+1/-1)
breezy/plugins/upload/__init__.py (+31/-26)
breezy/plugins/upload/cmds.py (+142/-114)
breezy/plugins/upload/tests/__init__.py (+6/-5)
breezy/plugins/upload/tests/test_auto_upload_hook.py (+24/-27)
breezy/plugins/upload/tests/test_upload.py (+254/-251)
breezy/plugins/weave_fmt/__init__.py (+69/-53)
breezy/plugins/weave_fmt/branch.py (+45/-31)
breezy/plugins/weave_fmt/bzrdir.py (+275/-173)
breezy/plugins/weave_fmt/repository.py (+265/-163)
breezy/plugins/weave_fmt/store/__init__.py (+27/-19)
breezy/plugins/weave_fmt/store/text.py (+5/-5)
breezy/plugins/weave_fmt/store/versioned.py (+63/-30)
breezy/plugins/weave_fmt/test_bzrdir.py (+283/-255)
breezy/plugins/weave_fmt/test_repository.py (+72/-90)
breezy/plugins/weave_fmt/test_store.py (+138/-151)
breezy/plugins/weave_fmt/test_workingtree.py (+39/-39)
breezy/plugins/weave_fmt/workingtree.py (+41/-29)
breezy/plugins/weave_fmt/xml4.py (+93/-78)
breezy/plugins/webdav/__init__.py (+11/-9)
breezy/plugins/webdav/tests/__init__.py (+6/-4)
breezy/plugins/webdav/tests/dav_server.py (+60/-58)
breezy/plugins/webdav/tests/test_webdav.py (+40/-33)
breezy/plugins/webdav/webdav.py (+157/-133)
breezy/plugins/zsh_completion/__init__.py (+8/-8)
breezy/plugins/zsh_completion/tests/__init__.py (+5/-4)
breezy/plugins/zsh_completion/tests/test_zshcomp.py (+0/-1)
breezy/plugins/zsh_completion/zshcomp.py (+75/-52)
breezy/progress.py (+11/-13)
breezy/push.py (+100/-49)
breezy/pyutils.py (+12/-11)
breezy/reconcile.py (+18/-17)
breezy/reconfigure.py (+60/-60)
breezy/registry.py (+87/-44)
breezy/rename_map.py (+27/-26)
breezy/repository.py (+194/-141)
breezy/revision.py (+10/-4)
breezy/revisionspec.py (+115/-104)
breezy/revisiontree.py (+7/-8)
breezy/rules.py (+5/-9)
breezy/send.py (+129/-75)
breezy/shelf.py (+104/-56)
breezy/shelf_ui.py (+137/-104)
breezy/shellcomplete.py (+10/-6)
breezy/smtp_connection.py (+37/-31)
breezy/status.py (+161/-87)
breezy/strace.py (+5/-6)
breezy/switch.py (+45/-25)
breezy/symbol_versioning.py (+74/-53)
breezy/tag.py (+47/-32)
breezy/terminal.py (+30/-28)
breezy/tests/EncodingAdapter.py (+78/-61)
breezy/tests/TestUtil.py (+7/-5)
breezy/tests/__init__.py (+954/-774)
breezy/tests/blackbox/__init__.py (+112/-109)
breezy/tests/blackbox/test_add.py (+152/-154)
breezy/tests/blackbox/test_added.py (+17/-19)
breezy/tests/blackbox/test_alias.py (+24/-26)
breezy/tests/blackbox/test_aliases.py (+31/-30)
breezy/tests/blackbox/test_ancestry.py (+41/-42)
breezy/tests/blackbox/test_annotate.py (+189/-164)
breezy/tests/blackbox/test_big_file.py (+27/-27)
breezy/tests/blackbox/test_bisect.py (+67/-61)
breezy/tests/blackbox/test_bound_branches.py (+190/-180)
breezy/tests/blackbox/test_branch.py (+308/-307)
breezy/tests/blackbox/test_branches.py (+37/-42)
breezy/tests/blackbox/test_break_lock.py (+30/-25)
breezy/tests/blackbox/test_bundle_info.py (+24/-20)
breezy/tests/blackbox/test_cat.py (+126/-117)
breezy/tests/blackbox/test_cat_revision.py (+34/-33)
breezy/tests/blackbox/test_check.py (+55/-50)
breezy/tests/blackbox/test_checkout.py (+99/-88)
breezy/tests/blackbox/test_clean_tree.py (+63/-59)
breezy/tests/blackbox/test_clone.py (+24/-25)
breezy/tests/blackbox/test_command_encoding.py (+26/-33)
breezy/tests/blackbox/test_commit.py (+557/-489)
breezy/tests/blackbox/test_config.py (+207/-107)
breezy/tests/blackbox/test_conflicts.py (+50/-40)
breezy/tests/blackbox/test_cp.py (+53/-42)
breezy/tests/blackbox/test_debug.py (+10/-12)
breezy/tests/blackbox/test_deleted.py (+7/-8)
breezy/tests/blackbox/test_diff.py (+257/-219)
breezy/tests/blackbox/test_exceptions.py (+33/-33)
breezy/tests/blackbox/test_export.py (+227/-228)
breezy/tests/blackbox/test_export_pot.py (+10/-10)
breezy/tests/blackbox/test_fetch_ghosts.py (+12/-13)
breezy/tests/blackbox/test_filesystem_cicp.py (+153/-93)
breezy/tests/blackbox/test_filtered_view_ops.py (+104/-96)
breezy/tests/blackbox/test_find_merge_base.py (+12/-13)
breezy/tests/blackbox/test_help.py (+71/-65)
breezy/tests/blackbox/test_hooks.py (+42/-34)
breezy/tests/blackbox/test_ignore.py (+86/-78)
breezy/tests/blackbox/test_ignored.py (+14/-14)
breezy/tests/blackbox/test_import.py (+42/-43)
breezy/tests/blackbox/test_info.py (+425/-294)
breezy/tests/blackbox/test_init.py (+116/-101)
breezy/tests/blackbox/test_inventory.py (+43/-46)
breezy/tests/blackbox/test_join.py (+33/-35)
breezy/tests/blackbox/test_link_tree.py (+9/-10)
breezy/tests/blackbox/test_locale.py (+70/-33)
breezy/tests/blackbox/test_log.py (+450/-426)
breezy/tests/blackbox/test_logformats.py (+40/-37)
breezy/tests/blackbox/test_lookup_revision.py (+5/-6)
breezy/tests/blackbox/test_ls.py (+148/-154)
breezy/tests/blackbox/test_lsprof.py (+6/-7)
breezy/tests/blackbox/test_merge.py (+514/-461)
breezy/tests/blackbox/test_merge_directive.py (+145/-115)
breezy/tests/blackbox/test_missing.py (+116/-109)
breezy/tests/blackbox/test_mkdir.py (+18/-19)
breezy/tests/blackbox/test_modified.py (+24/-28)
breezy/tests/blackbox/test_mv.py (+290/-270)
breezy/tests/blackbox/test_nick.py (+30/-32)
breezy/tests/blackbox/test_non_ascii.py (+249/-240)
breezy/tests/blackbox/test_outside_wt.py (+23/-21)
breezy/tests/blackbox/test_pack.py (+26/-27)
breezy/tests/blackbox/test_patch.py (+15/-16)
breezy/tests/blackbox/test_ping.py (+8/-7)
breezy/tests/blackbox/test_plugins.py (+11/-12)
breezy/tests/blackbox/test_pull.py (+304/-300)
breezy/tests/blackbox/test_push.py (+457/-403)
breezy/tests/blackbox/test_re_sign.py (+11/-12)
breezy/tests/blackbox/test_reconcile.py (+23/-23)
breezy/tests/blackbox/test_reconfigure.py (+138/-124)
breezy/tests/blackbox/test_reference.py (+42/-42)
breezy/tests/blackbox/test_remember_option.py (+65/-46)
breezy/tests/blackbox/test_remerge.py (+117/-89)
breezy/tests/blackbox/test_remove.py (+112/-107)
breezy/tests/blackbox/test_remove_tree.py (+101/-88)
breezy/tests/blackbox/test_repair_workingtree.py (+24/-24)
breezy/tests/blackbox/test_resolve.py (+61/-42)
breezy/tests/blackbox/test_resolve_location.py (+11/-12)
breezy/tests/blackbox/test_revert.py (+131/-129)
breezy/tests/blackbox/test_revision_history.py (+27/-29)
breezy/tests/blackbox/test_revision_info.py (+53/-55)
breezy/tests/blackbox/test_revno.py (+97/-88)
breezy/tests/blackbox/test_rmbranch.py (+46/-43)
breezy/tests/blackbox/test_script.py (+45/-25)
breezy/tests/blackbox/test_selftest.py (+39/-37)
breezy/tests/blackbox/test_send.py (+192/-197)
breezy/tests/blackbox/test_serve.py (+119/-117)
breezy/tests/blackbox/test_shared_repository.py (+26/-26)
breezy/tests/blackbox/test_shell_complete.py (+13/-12)
breezy/tests/blackbox/test_shelve.py (+66/-68)
breezy/tests/blackbox/test_sign_my_commits.py (+41/-38)
breezy/tests/blackbox/test_split.py (+27/-29)
breezy/tests/blackbox/test_status.py (+545/-483)
breezy/tests/blackbox/test_switch.py (+260/-245)
breezy/tests/blackbox/test_tags.py (+275/-235)
breezy/tests/blackbox/test_testament.py (+16/-16)
breezy/tests/blackbox/test_too_much.py (+315/-322)
breezy/tests/blackbox/test_uncommit.py (+152/-144)
breezy/tests/blackbox/test_unknowns.py (+14/-15)
breezy/tests/blackbox/test_update.py (+291/-242)
breezy/tests/blackbox/test_upgrade.py (+106/-97)
breezy/tests/blackbox/test_verify_signatures.py (+64/-38)
breezy/tests/blackbox/test_version.py (+31/-30)
breezy/tests/blackbox/test_version_info.py (+84/-77)
breezy/tests/blackbox/test_versioning.py (+72/-71)
breezy/tests/blackbox/test_view.py (+43/-42)
breezy/tests/blackbox/test_whoami.py (+67/-55)
breezy/tests/commands/__init__.py (+13/-13)
breezy/tests/commands/test_branch.py (+4/-5)
breezy/tests/commands/test_cat.py (+6/-7)
breezy/tests/commands/test_checkout.py (+4/-5)
breezy/tests/commands/test_commit.py (+16/-15)
breezy/tests/commands/test_init.py (+0/-1)
breezy/tests/commands/test_init_repository.py (+0/-1)
breezy/tests/commands/test_merge.py (+5/-6)
breezy/tests/commands/test_missing.py (+5/-6)
breezy/tests/commands/test_pull.py (+10/-12)
breezy/tests/commands/test_push.py (+7/-7)
breezy/tests/commands/test_revert.py (+2/-6)
breezy/tests/commands/test_update.py (+5/-6)
breezy/tests/fake_command.py (+0/-1)
breezy/tests/features.py (+80/-79)
breezy/tests/fixtures.py (+14/-12)
breezy/tests/http_server.py (+92/-86)
breezy/tests/http_utils.py (+93/-83)
breezy/tests/https_server.py (+50/-30)
breezy/tests/lock_helpers.py (+15/-15)
breezy/tests/matchers.py (+57/-40)
breezy/tests/per_branch/__init__.py (+83/-66)
breezy/tests/per_branch/test_branch.py (+299/-274)
breezy/tests/per_branch/test_break_lock.py (+4/-7)
breezy/tests/per_branch/test_check.py (+25/-24)
breezy/tests/per_branch/test_commit.py (+184/-87)
breezy/tests/per_branch/test_config.py (+8/-10)
breezy/tests/per_branch/test_create_checkout.py (+27/-24)
breezy/tests/per_branch/test_create_clone.py (+58/-56)
breezy/tests/per_branch/test_dotted_revno_to_revision_id.py (+26/-25)
breezy/tests/per_branch/test_get_rev_id.py (+4/-5)
breezy/tests/per_branch/test_get_revision_id_to_revno_map.py (+32/-21)
breezy/tests/per_branch/test_hooks.py (+81/-67)
breezy/tests/per_branch/test_http.py (+17/-9)
breezy/tests/per_branch/test_iter_merge_sorted_revisions.py (+168/-117)
breezy/tests/per_branch/test_last_revision_info.py (+22/-20)
breezy/tests/per_branch/test_locking.py (+187/-130)
breezy/tests/per_branch/test_parent.py (+26/-28)
breezy/tests/per_branch/test_permissions.py (+25/-30)
breezy/tests/per_branch/test_pull.py (+191/-136)
breezy/tests/per_branch/test_push.py (+200/-147)
breezy/tests/per_branch/test_reconcile.py (+19/-18)
breezy/tests/per_branch/test_revision_id_to_dotted_revno.py (+10/-13)
breezy/tests/per_branch/test_revision_id_to_revno.py (+25/-21)
breezy/tests/per_branch/test_sprout.py (+72/-66)
breezy/tests/per_branch/test_stacking.py (+182/-177)
breezy/tests/per_branch/test_tags.py (+213/-204)
breezy/tests/per_branch/test_uncommit.py (+68/-34)
breezy/tests/per_branch/test_update.py (+20/-20)
breezy/tests/per_controldir/__init__.py (+36/-26)
breezy/tests/per_controldir/test_controldir.py (+579/-564)
breezy/tests/per_controldir/test_format.py (+6/-5)
breezy/tests/per_controldir/test_push.py (+64/-67)
breezy/tests/per_controldir_colo/__init__.py (+31/-20)
breezy/tests/per_controldir_colo/test_supported.py (+69/-54)
breezy/tests/per_controldir_colo/test_unsupported.py (+25/-16)
breezy/tests/per_foreign_vcs/__init__.py (+16/-11)
breezy/tests/per_foreign_vcs/test_branch.py (+4/-5)
breezy/tests/per_foreign_vcs/test_repository.py (+3/-7)
breezy/tests/per_interbranch/__init__.py (+61/-41)
breezy/tests/per_interbranch/test_copy_content_into.py (+10/-12)
breezy/tests/per_interbranch/test_fetch.py (+29/-32)
breezy/tests/per_interbranch/test_get.py (+6/-6)
breezy/tests/per_interbranch/test_pull.py (+156/-102)
breezy/tests/per_interbranch/test_push.py (+225/-161)
breezy/tests/per_interrepository/__init__.py (+97/-60)
breezy/tests/per_interrepository/test_fetch.py (+274/-218)
breezy/tests/per_interrepository/test_interrepository.py (+79/-68)
breezy/tests/per_intertree/__init__.py (+97/-64)
breezy/tests/per_intertree/test_compare.py (+1389/-979)
breezy/tests/per_intertree/test_file_content_matches.py (+22/-20)
breezy/tests/per_intertree/test_find_path.py (+84/-68)
breezy/tests/per_lock/__init__.py (+15/-7)
breezy/tests/per_lock/test_lock.py (+38/-40)
breezy/tests/per_lock/test_temporary_write_lock.py (+11/-15)
breezy/tests/per_merger.py (+177/-149)
breezy/tests/per_repository/__init__.py (+56/-46)
breezy/tests/per_repository/test_add_fallback_repository.py (+23/-15)
breezy/tests/per_repository/test_break_lock.py (+5/-4)
breezy/tests/per_repository/test_check.py (+22/-9)
breezy/tests/per_repository/test_commit_builder.py (+374/-281)
breezy/tests/per_repository/test_fetch.py (+212/-133)
breezy/tests/per_repository/test_file_graph.py (+6/-6)
breezy/tests/per_repository/test_get_parent_map.py (+25/-24)
breezy/tests/per_repository/test_get_rev_id_for_revno.py (+14/-15)
breezy/tests/per_repository/test_has_revisions.py (+8/-11)
breezy/tests/per_repository/test_has_same_location.py (+33/-27)
breezy/tests/per_repository/test_locking.py (+6/-8)
breezy/tests/per_repository/test_pack.py (+7/-9)
breezy/tests/per_repository/test_reconcile.py (+2/-3)
breezy/tests/per_repository/test_refresh_data.py (+4/-5)
breezy/tests/per_repository/test_repository.py (+397/-352)
breezy/tests/per_repository/test_revision.py (+57/-50)
breezy/tests/per_repository/test_signatures.py (+67/-55)
breezy/tests/per_repository/test_statistics.py (+16/-14)
breezy/tests/per_repository/test_write_group.py (+12/-13)
breezy/tests/per_repository_reference/__init__.py (+40/-38)
breezy/tests/per_repository_reference/test__make_parents_provider.py (+6/-8)
breezy/tests/per_repository_reference/test_add_inventory.py (+6/-9)
breezy/tests/per_repository_reference/test_add_revision.py (+4/-5)
breezy/tests/per_repository_reference/test_add_signature_text.py (+5/-7)
breezy/tests/per_repository_reference/test_all_revision_ids.py (+18/-19)
breezy/tests/per_repository_reference/test_break_lock.py (+5/-5)
breezy/tests/per_repository_reference/test_check.py (+10/-10)
breezy/tests/per_repository_reference/test_commit_with_stacking.py (+111/-99)
breezy/tests/per_repository_reference/test_default_stacking.py (+7/-9)
breezy/tests/per_repository_reference/test_fetch.py (+92/-86)
breezy/tests/per_repository_reference/test_get_record_stream.py (+124/-81)
breezy/tests/per_repository_reference/test_get_rev_id_for_revno.py (+14/-14)
breezy/tests/per_repository_reference/test_graph.py (+43/-46)
breezy/tests/per_repository_reference/test_initialize.py (+14/-10)
breezy/tests/per_repository_reference/test_unlock.py (+26/-22)
breezy/tests/per_transport.py (+738/-624)
breezy/tests/per_tree/__init__.py (+135/-84)
breezy/tests/per_tree/test_annotate_iter.py (+22/-19)
breezy/tests/per_tree/test_archive.py (+32/-41)
breezy/tests/per_tree/test_export.py (+36/-41)
breezy/tests/per_tree/test_get_file_mtime.py (+10/-9)
breezy/tests/per_tree/test_get_file_with_stat.py (+10/-11)
breezy/tests/per_tree/test_get_root_id.py (+8/-9)
breezy/tests/per_tree/test_get_symlink_target.py (+14/-18)
breezy/tests/per_tree/test_ids.py (+48/-50)
breezy/tests/per_tree/test_is_executable.py (+3/-5)
breezy/tests/per_tree/test_iter_search_rules.py (+25/-28)
breezy/tests/per_tree/test_list_files.py (+64/-52)
breezy/tests/per_tree/test_locking.py (+1/-2)
breezy/tests/per_tree/test_path_content_summary.py (+68/-61)
breezy/tests/per_tree/test_revision_tree.py (+4/-4)
breezy/tests/per_tree/test_symlinks.py (+24/-27)
breezy/tests/per_tree/test_test_trees.py (+253/-213)
breezy/tests/per_tree/test_transform.py (+372/-325)
breezy/tests/per_tree/test_tree.py (+151/-156)
breezy/tests/per_tree/test_walkdirs.py (+55/-38)
breezy/tests/per_uifactory/__init__.py (+33/-40)
breezy/tests/per_workingtree/__init__.py (+78/-70)
breezy/tests/per_workingtree/test_add.py (+118/-105)
breezy/tests/per_workingtree/test_add_reference.py (+38/-43)
breezy/tests/per_workingtree/test_annotate_iter.py (+171/-104)
breezy/tests/per_workingtree/test_basis_inventory.py (+33/-32)
breezy/tests/per_workingtree/test_basis_tree.py (+20/-20)
breezy/tests/per_workingtree/test_break_lock.py (+2/-4)
breezy/tests/per_workingtree/test_canonical_path.py (+37/-39)
breezy/tests/per_workingtree/test_changes_from.py (+12/-15)
breezy/tests/per_workingtree/test_check.py (+15/-15)
breezy/tests/per_workingtree/test_check_state.py (+20/-24)
breezy/tests/per_workingtree/test_commit.py (+266/-255)
breezy/tests/per_workingtree/test_content_filters.py (+139/-135)
breezy/tests/per_workingtree/test_eol_conversion.py (+295/-162)
breezy/tests/per_workingtree/test_executable.py (+34/-33)
breezy/tests/per_workingtree/test_flush.py (+9/-10)
breezy/tests/per_workingtree/test_get_file_mtime.py (+33/-32)
breezy/tests/per_workingtree/test_get_parent_ids.py (+17/-17)
breezy/tests/per_workingtree/test_inv.py (+148/-86)
breezy/tests/per_workingtree/test_is_control_filename.py (+5/-7)
breezy/tests/per_workingtree/test_is_ignored.py (+141/-138)
breezy/tests/per_workingtree/test_locking.py (+21/-22)
breezy/tests/per_workingtree/test_merge_from_branch.py (+189/-146)
breezy/tests/per_workingtree/test_mkdir.py (+8/-11)
breezy/tests/per_workingtree/test_move.py (+372/-349)
breezy/tests/per_workingtree/test_nested_specifics.py (+22/-23)
breezy/tests/per_workingtree/test_parents.py (+435/-369)
breezy/tests/per_workingtree/test_paths2ids.py (+92/-83)
breezy/tests/per_workingtree/test_pull.py (+46/-44)
breezy/tests/per_workingtree/test_put_file.py (+11/-12)
breezy/tests/per_workingtree/test_read_working_inventory.py (+11/-11)
breezy/tests/per_workingtree/test_readonly.py (+11/-11)
breezy/tests/per_workingtree/test_remove.py (+118/-116)
breezy/tests/per_workingtree/test_rename_one.py (+238/-226)
breezy/tests/per_workingtree/test_revision_tree.py (+39/-40)
breezy/tests/per_workingtree/test_set_root_id.py (+18/-19)
breezy/tests/per_workingtree/test_shelf_manager.py (+1/-2)
breezy/tests/per_workingtree/test_smart_add.py (+174/-151)
breezy/tests/per_workingtree/test_symlinks.py (+87/-81)
breezy/tests/per_workingtree/test_transform.py (+880/-691)
breezy/tests/per_workingtree/test_uncommit.py (+2/-3)
breezy/tests/per_workingtree/test_unversion.py (+118/-97)
breezy/tests/per_workingtree/test_views.py (+64/-68)
breezy/tests/per_workingtree/test_walkdirs.py (+128/-98)
breezy/tests/per_workingtree/test_workingtree.py (+744/-657)
breezy/tests/scenarios.py (+1/-1)
breezy/tests/script.py (+94/-78)
breezy/tests/ssl_certs/create_ssls.py (+158/-102)
breezy/tests/stub_sftp.py (+90/-69)
breezy/tests/test__annotator.py (+217/-139)
breezy/tests/test__known_graph.py (+516/-493)
breezy/tests/test_ancestry.py (+5/-5)
breezy/tests/test_annotate.py (+372/-225)
breezy/tests/test_atomicfile.py (+34/-34)
breezy/tests/test_bad_files.py (+26/-27)
breezy/tests/test_bedding.py (+76/-82)
breezy/tests/test_bisect.py (+17/-16)
breezy/tests/test_bisect_multi.py (+222/-181)
breezy/tests/test_branch.py (+243/-234)
breezy/tests/test_branchbuilder.py (+338/-248)
breezy/tests/test_bugtracker.py (+192/-157)
breezy/tests/test_cache_utf8.py (+16/-18)
breezy/tests/test_cethread.py (+15/-18)
breezy/tests/test_chunk_writer.py (+21/-14)
breezy/tests/test_clean_tree.py (+36/-37)
breezy/tests/test_cmdline.py (+57/-48)
breezy/tests/test_commands.py (+144/-139)
breezy/tests/test_commit.py (+548/-491)
breezy/tests/test_commit_merge.py (+51/-49)
breezy/tests/test_config.py (+1908/-1639)
breezy/tests/test_conflicts.py (+593/-355)
breezy/tests/test_controldir.py (+43/-52)
breezy/tests/test_counted_lock.py (+23/-33)
breezy/tests/test_crash.py (+19/-23)
breezy/tests/test_debug.py (+4/-6)
breezy/tests/test_decorators.py (+0/-1)
breezy/tests/test_delta.py (+342/-179)
breezy/tests/test_diff.py (+692/-534)
breezy/tests/test_directory_service.py (+64/-63)
breezy/tests/test_dirty_tracker.py (+26/-29)
breezy/tests/test_email_message.py (+99/-78)
breezy/tests/test_eol_filters.py (+12/-9)
breezy/tests/test_errors.py (+213/-184)
breezy/tests/test_estimate_compressed_size.py (+21/-14)
breezy/tests/test_export.py (+150/-139)
breezy/tests/test_export_pot.py (+117/-114)
breezy/tests/test_extract.py (+40/-39)
breezy/tests/test_features.py (+41/-37)
breezy/tests/test_fetch.py (+236/-191)
breezy/tests/test_fetch_ghosts.py (+9/-10)
breezy/tests/test_fifo_cache.py (+61/-60)
breezy/tests/test_filter_tree.py (+10/-18)
breezy/tests/test_filters.py (+47/-48)
breezy/tests/test_fixtures.py (+0/-2)
breezy/tests/test_foreign.py (+153/-104)
breezy/tests/test_forge.py (+45/-27)
breezy/tests/test_generate_docs.py (+4/-4)
breezy/tests/test_globbing.py (+330/-267)
breezy/tests/test_gpg.py (+53/-40)
breezy/tests/test_graph.py (+882/-679)
breezy/tests/test_grep.py (+1650/-1543)
breezy/tests/test_help.py (+180/-123)
breezy/tests/test_hooks.py (+111/-81)
breezy/tests/test_http.py (+715/-622)
breezy/tests/test_http_response.py (+197/-145)
breezy/tests/test_https_ca_bundle.py (+15/-16)
breezy/tests/test_https_urllib.py (+13/-15)
breezy/tests/test_i18n.py (+28/-30)
breezy/tests/test_identitymap.py (+1/-3)
breezy/tests/test_ignores.py (+72/-70)
breezy/tests/test_import_tariff.py (+174/-165)
breezy/tests/test_info.py (+301/-191)
breezy/tests/test_iterablefile.py (+26/-26)
breezy/tests/test_lazy_import.py (+696/-501)
breezy/tests/test_lazy_regex.py (+48/-48)
breezy/tests/test_library_state.py (+9/-8)
breezy/tests/test_location.py (+43/-32)
breezy/tests/test_lock.py (+43/-36)
breezy/tests/test_lockdir.py (+134/-134)
breezy/tests/test_log.py (+852/-544)
breezy/tests/test_lru_cache.py (+96/-90)
breezy/tests/test_lsprof.py (+15/-12)
breezy/tests/test_mail_client.py (+162/-150)
breezy/tests/test_matchers.py (+54/-58)
breezy/tests/test_memorybranch.py (+4/-6)
breezy/tests/test_memorytree.py (+89/-89)
breezy/tests/test_merge.py (+2326/-1861)
breezy/tests/test_merge_core.py (+383/-300)
breezy/tests/test_merge_directive.py (+651/-308)
breezy/tests/test_mergeable.py (+10/-12)
breezy/tests/test_mergetools.py (+77/-64)
breezy/tests/test_missing.py (+294/-188)
breezy/tests/test_msgeditor.py (+165/-141)
breezy/tests/test_multiparent.py (+146/-135)
breezy/tests/test_multiwalker.py (+142/-143)
breezy/tests/test_mutabletree.py (+12/-20)
breezy/tests/test_nonascii.py (+51/-43)
breezy/tests/test_options.py (+268/-219)
breezy/tests/test_osutils.py (+711/-720)
breezy/tests/test_osutils_encodings.py (+47/-43)
breezy/tests/test_patch.py (+34/-26)
breezy/tests/test_patches.py (+105/-91)
breezy/tests/test_permissions.py (+97/-99)
breezy/tests/test_plugins.py (+338/-310)
breezy/tests/test_progress.py (+49/-31)
breezy/tests/test_pyutils.py (+18/-21)
breezy/tests/test_reconcile.py (+5/-7)
breezy/tests/test_reconfigure.py (+228/-207)
breezy/tests/test_registry.py (+169/-169)
breezy/tests/test_rename_map.py (+111/-111)
breezy/tests/test_revert.py (+75/-72)
breezy/tests/test_revision.py (+249/-93)
breezy/tests/test_revisionspec.py (+322/-322)
breezy/tests/test_revisiontree.py (+22/-21)
breezy/tests/test_rules.py (+49/-67)
breezy/tests/test_sampler.py (+0/-1)
breezy/tests/test_scenarios.py (+20/-32)
breezy/tests/test_script.py (+286/-220)
breezy/tests/test_selftest.py (+1450/-1080)
breezy/tests/test_server.py (+107/-93)
breezy/tests/test_setup.py (+2/-3)
breezy/tests/test_sftp_transport.py (+114/-103)
breezy/tests/test_shelf.py (+357/-314)
breezy/tests/test_shelf_ui.py (+253/-212)
breezy/tests/test_smart_add.py (+55/-50)
breezy/tests/test_smtp_connection.py (+147/-116)
breezy/tests/test_source.py (+120/-103)
breezy/tests/test_ssh_transport.py (+129/-93)
breezy/tests/test_status.py (+110/-79)
breezy/tests/test_strace.py (+17/-11)
breezy/tests/test_subsume.py (+43/-59)
breezy/tests/test_switch.py (+117/-114)
breezy/tests/test_symbol_versioning.py (+127/-96)
breezy/tests/test_tag.py (+98/-98)
breezy/tests/test_test_server.py (+40/-51)
breezy/tests/test_textfile.py (+11/-13)
breezy/tests/test_textmerge.py (+9/-7)
breezy/tests/test_timestamp.py (+91/-75)
breezy/tests/test_trace.py (+95/-97)
breezy/tests/test_transactions.py (+34/-35)
breezy/tests/test_transform.py (+497/-487)
breezy/tests/test_transport.py (+402/-348)
breezy/tests/test_transport_log.py (+15/-18)
breezy/tests/test_tree.py (+123/-110)
breezy/tests/test_treebuilder.py (+4/-10)
breezy/tests/test_treeshape.py (+12/-12)
breezy/tests/test_tsort.py (+434/-418)
breezy/tests/test_ui.py (+192/-180)
breezy/tests/test_uncommit.py (+41/-33)
breezy/tests/test_upgrade.py (+93/-81)
breezy/tests/test_upgrade_stacked.py (+28/-23)
breezy/tests/test_upstream_import.py (+113/-112)
breezy/tests/test_url_policy_open.py (+93/-100)
breezy/tests/test_urlutils.py (+707/-627)
breezy/tests/test_utextwrap.py (+77/-61)
breezy/tests/test_version.py (+10/-14)
breezy/tests/test_version_info.py (+248/-257)
breezy/tests/test_views.py (+9/-8)
breezy/tests/test_whitebox.py (+10/-12)
breezy/tests/test_win32utils.py (+146/-129)
breezy/tests/test_workingtree.py (+207/-186)
breezy/tests/test_workspace.py (+91/-89)
breezy/tests/test_wsgi.py (+121/-116)
breezy/tests/transport_util.py (+3/-3)
breezy/tests/treeshape.py (+8/-9)
breezy/tests/ui_testing.py (+1/-4)
breezy/textfile.py (+1/-1)
breezy/textmerge.py (+17/-12)
breezy/trace.py (+37/-22)
breezy/transactions.py (+9/-7)
breezy/transform.py (+190/-132)
breezy/transport/__init__.py (+271/-225)
breezy/transport/brokenrename.py (+1/-1)
breezy/transport/chroot.py (+2/-1)
breezy/transport/decorator.py (+12/-9)
breezy/transport/fakenfs.py (+6/-3)
breezy/transport/fakevfat.py (+6/-3)
breezy/transport/gio_transport.py (+101/-79)
breezy/transport/http/__init__.py (+31/-27)
breezy/transport/http/ca_bundle.py (+7/-7)
breezy/transport/http/response.py (+66/-46)
breezy/transport/http/urllib.py (+539/-432)
breezy/transport/http/wsgi.py (+40/-30)
breezy/transport/local.py (+10/-6)
breezy/transport/log.py (+52/-31)
breezy/transport/memory.py (+39/-38)
breezy/transport/nosmart.py (+2/-1)
breezy/transport/pathfilter.py (+21/-21)
breezy/transport/readonly.py (+13/-12)
breezy/transport/remote.py (+143/-111)
breezy/transport/sftp.py (+176/-129)
breezy/transport/ssh/__init__.py (+116/-85)
breezy/transport/ssh/paramiko.py (+49/-38)
breezy/transport/trace.py (+35/-19)
breezy/transport/unlistable.py (+5/-2)
breezy/tree.py (+168/-105)
breezy/treebuilder.py (+1/-1)
breezy/ui/__init__.py (+65/-43)
breezy/ui/text.py (+100/-87)
breezy/uncommit.py (+14/-6)
breezy/upgrade.py (+52/-41)
breezy/upstream_import.py (+44/-49)
breezy/url_policy_open.py (+29/-21)
breezy/urlutils.py (+88/-64)
breezy/utextwrap.py (+33/-22)
breezy/util/simplemapi.py (+51/-34)
breezy/version.py (+22/-22)
breezy/version_info_formats/__init__.py (+59/-48)
breezy/version_info_formats/format_custom.py (+11/-13)
breezy/version_info_formats/format_python.py (+24/-23)
breezy/version_info_formats/format_rio.py (+31/-23)
breezy/version_info_formats/format_yaml.py (+43/-29)
breezy/views.py (+28/-29)
breezy/win32utils.py (+106/-88)
breezy/workingtree.py (+127/-76)
breezy/workspace.py (+28/-21)
crates/osutils/src/lib.rs (+4/-1)
crates/osutils/src/path.rs (+1/-1)
crates/osutils/src/tests.rs (+2/-3)
crates/urlutils/src/lib.rs (+15/-13)
doc/developers/conf.py (+55/-35)
doc/en/conf.py (+106/-51)
profile_imports.py (+35/-29)
pyproject.toml (+0/-1)
setup.py (+106/-70)
tarmac.conf (+3/-2)
tools/brz_epydoc_uid.py (+1/-2)
tools/brzflakes.py (+13/-6)
tools/capture_tree.py (+11/-10)
tools/check-newsbugs.py (+12/-8)
tools/fixed-in.py (+51/-35)
tools/flake8_lazy_import.py (+3/-3)
tools/generate_docs.py (+39/-21)
tools/generate_release_notes.py (+18/-17)
tools/package_docs.py (+10/-9)
tools/package_mf.py (+13/-16)
tools/prepare_for_latex.py (+40/-34)
tools/rst2html.py (+20/-14)
tools/rst2pdf.py (+34/-17)
tools/rst2prettyhtml.py (+15/-10)
tools/time_graph.py (+23/-15)
tools/win32/bootstrap.py (+39/-19)
tools/win32/brz-win32-bdist-postinstall.py (+39/-34)
tools/win32/brz_postinstall.py (+98/-81)
tools/win32/build_release.py (+66/-57)
tools/win32/file_version.py (+6/-4)
tools/win32/ostools.py (+10/-10)
tools/win32/py2exe_boot_common.py (+8/-2)
tools/win32/run_script.py (+2/-2)
To merge this branch: bzr merge lp:~jelmer/brz/ruff-format
Reviewer Review Type Date Requested Status
Jelmer Vernooij Approve
Review via email: mp+455254@code.launchpad.net

Commit message

Drop flake8, use ruff for formatting

Description of the change

Drop flake8, use ruff for formatting

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 :
Download full text (10.7 KiB)

The attempt to merge lp:~jelmer/brz/ruff-format into lp:brz failed. Command exited with 2.
Below is the output from the failed tests.

Collecting setuptools-gettext
  Using cached setuptools_gettext-0.1.7-py3-none-any.whl.metadata (1.5 kB)
Requirement already satisfied: setuptools>=46.1 in ./lib/python3.11/site-packages (from setuptools-gettext) (68.1.2)
Using cached setuptools_gettext-0.1.7-py3-none-any.whl (5.5 kB)
Installing collected packages: setuptools-gettext
Successfully installed setuptools-gettext-0.1.7
Obtaining file:///tmp/tarmac/branch.yd5f78qt
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Checking if build backend supports build_editable: started
  Checking if build backend supports build_editable: finished with status 'done'
  Getting requirements to build editable: started
  Getting requirements to build editable: finished with status 'done'
  Installing backend dependencies: started
  Installing backend dependencies: finished with status 'done'
  Preparing editable metadata (pyproject.toml): started
  Preparing editable metadata (pyproject.toml): finished with status 'done'
Requirement already satisfied: configobj in /usr/lib/python3/dist-packages (5.0.8)
Requirement already satisfied: fastbencode in /usr/lib/python3/dist-packages (0.2)
Requirement already satisfied: patiencediff in /usr/lib/python3/dist-packages (0.2.13)
Requirement already satisfied: merge3 in /usr/lib/python3/dist-packages (0.0.8)
Requirement already satisfied: dulwich>=0.21.6 in /usr/lib/python3/dist-packages (0.21.6)
Requirement already satisfied: urllib3>=1.24.1 in /usr/lib/python3/dist-packages (1.26.18)
Requirement already satisfied: pyyaml in /usr/lib/python3/dist-packages (6.0.1)
Collecting testtools>=0.9.5
  Using cached testtools-2.7.1-py3-none-any.whl.metadata (5.3 kB)
Collecting testscenarios
  Using cached testscenarios-0.5.0-py2.py3-none-any.whl (21 kB)
Collecting python-subunit
  Using cached python_subunit-1.4.3-py3-none-any.whl.metadata (22 kB)
Collecting cython>=0.29
  Using cached Cython-3.0.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (3.2 kB)
Collecting ruff
  Using cached ruff-0.1.4-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (22 kB)
Collecting docutils
  Using cached docutils-0.20.1-py3-none-any.whl.metadata (2.8 kB)
Requirement already satisfied: setuptools in ./lib/python3.11/site-packages (68.1.2)
Collecting sphinx
  Using cached sphinx-7.2.6-py3-none-any.whl.metadata (5.9 kB)
Collecting sphinx-epytext
  Using cached sphinx_epytext-0.0.4-py3-none-any.whl
Collecting fastimport
  Using cached fastimport-0.9.14-py2.py3-none-any.whl
Requirement already satisfied: launchpadlib>=1.6.3 in /usr/lib/python3/dist-packages (1.11.0)
Requirement already satisfied: paramiko>=1.6.2 in /usr/local/lib/python3.11/dist-packages (3.3.1)
Requirement already satisfied: gpg in /usr/lib/python3/dist-packages (1.18.0)
Requirement already satisfied: httplib2 in /usr/lib/python3/dist-packages (from launchpadlib>=1.6.3) (0.20.4)
Requirement already satisfied: lazr.restfulclient>=0.14.2 in /usr/lib/python3/dist-packages (from launchpadlib>=1.6.3) (0.14.5)
Re...

Revision history for this message
The Breezy Bot (the-breezy-bot) wrote :
Download full text (14.7 KiB)

The attempt to merge lp:~jelmer/brz/ruff-format into lp:brz failed. Command exited with 1.
Below is the output from the failed tests.

Collecting setuptools-gettext
  Downloading setuptools_gettext-0.1.7-py3-none-any.whl.metadata (1.5 kB)
Requirement already satisfied: setuptools>=46.1 in ./lib/python3.11/site-packages (from setuptools-gettext) (68.1.2)
Downloading setuptools_gettext-0.1.7-py3-none-any.whl (5.5 kB)
Installing collected packages: setuptools-gettext
Successfully installed setuptools-gettext-0.1.7
Obtaining file:///tmp/tarmac/branch.6aetwkax
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Checking if build backend supports build_editable: started
  Checking if build backend supports build_editable: finished with status 'done'
  Getting requirements to build editable: started
  Getting requirements to build editable: finished with status 'done'
  Installing backend dependencies: started
  Installing backend dependencies: finished with status 'done'
  Preparing editable metadata (pyproject.toml): started
  Preparing editable metadata (pyproject.toml): finished with status 'done'
Requirement already satisfied: configobj in /usr/lib/python3/dist-packages (5.0.8)
Requirement already satisfied: fastbencode in /usr/lib/python3/dist-packages (0.2)
Requirement already satisfied: patiencediff in /usr/lib/python3/dist-packages (0.2.13)
Requirement already satisfied: merge3 in /usr/lib/python3/dist-packages (0.0.8)
Requirement already satisfied: dulwich>=0.21.6 in /usr/lib/python3/dist-packages (0.21.6)
Requirement already satisfied: urllib3>=1.24.1 in /usr/lib/python3/dist-packages (1.26.18)
Requirement already satisfied: pyyaml in /usr/lib/python3/dist-packages (6.0.1)
Collecting testtools>=0.9.5
  Downloading testtools-2.7.1-py3-none-any.whl.metadata (5.3 kB)
Collecting testscenarios
  Downloading testscenarios-0.5.0-py2.py3-none-any.whl (21 kB)
Collecting python-subunit
  Downloading python_subunit-1.4.3-py3-none-any.whl.metadata (22 kB)
Collecting cython>=0.29
  Using cached Cython-3.0.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (3.2 kB)
Collecting ruff
  Downloading ruff-0.1.4-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (22 kB)
Collecting docutils
  Downloading docutils-0.20.1-py3-none-any.whl.metadata (2.8 kB)
Requirement already satisfied: setuptools in ./lib/python3.11/site-packages (68.1.2)
Collecting sphinx
  Downloading sphinx-7.2.6-py3-none-any.whl.metadata (5.9 kB)
Collecting sphinx-epytext
  Downloading sphinx-epytext-0.0.4.tar.gz (3.6 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Collecting fastimport
  Downloading fastimport-0.9.14.tar.gz (41 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 41.8/41.8 kB 2.1 MB/s eta 0:00:00
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Requirement already satisfied: launchpadlib>=1.6.3 in /usr/lib/python3/dist-packages (1.11.0)
Requirement already satisfied: paramiko>=1.6.2 in /usr/local/lib/python3.11/dist-packages (3.3.1)
Requirement already satisfied: gpg in /usr/lib/pyth...

Revision history for this message
The Breezy Bot (the-breezy-bot) wrote :
Download full text (11.3 KiB)

The attempt to merge lp:~jelmer/brz/ruff-format into lp:brz failed. Command exited with 2.
Below is the output from the failed tests.

Collecting setuptools-gettext
  Downloading setuptools_gettext-0.1.7-py3-none-any.whl.metadata (1.5 kB)
Requirement already satisfied: setuptools>=46.1 in ./lib/python3.11/site-packages (from setuptools-gettext) (68.1.2)
Downloading setuptools_gettext-0.1.7-py3-none-any.whl (5.5 kB)
Installing collected packages: setuptools-gettext
Successfully installed setuptools-gettext-0.1.7
Obtaining file:///tmp/tarmac/branch.5dxco0m3
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Checking if build backend supports build_editable: started
  Checking if build backend supports build_editable: finished with status 'done'
  Getting requirements to build editable: started
  Getting requirements to build editable: finished with status 'done'
  Installing backend dependencies: started
  Installing backend dependencies: finished with status 'done'
  Preparing editable metadata (pyproject.toml): started
  Preparing editable metadata (pyproject.toml): finished with status 'done'
Requirement already satisfied: configobj in /usr/lib/python3/dist-packages (5.0.8)
Requirement already satisfied: fastbencode in /usr/lib/python3/dist-packages (0.2)
Requirement already satisfied: patiencediff in /usr/lib/python3/dist-packages (0.2.13)
Requirement already satisfied: merge3 in /usr/lib/python3/dist-packages (0.0.8)
Requirement already satisfied: dulwich>=0.21.6 in /usr/lib/python3/dist-packages (0.21.6)
Requirement already satisfied: urllib3>=1.24.1 in /usr/lib/python3/dist-packages (1.26.18)
Requirement already satisfied: pyyaml in /usr/lib/python3/dist-packages (6.0.1)
Collecting testtools>=0.9.5
  Downloading testtools-2.7.1-py3-none-any.whl.metadata (5.3 kB)
Collecting testscenarios
  Downloading testscenarios-0.5.0-py2.py3-none-any.whl (21 kB)
Collecting python-subunit
  Downloading python_subunit-1.4.3-py3-none-any.whl.metadata (22 kB)
Collecting cython>=0.29
  Using cached Cython-3.0.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (3.2 kB)
Collecting ruff
  Downloading ruff-0.1.4-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (22 kB)
Collecting docutils
  Downloading docutils-0.20.1-py3-none-any.whl.metadata (2.8 kB)
Requirement already satisfied: setuptools in ./lib/python3.11/site-packages (68.1.2)
Collecting sphinx
  Downloading sphinx-7.2.6-py3-none-any.whl.metadata (5.9 kB)
Collecting sphinx-epytext
  Downloading sphinx-epytext-0.0.4.tar.gz (3.6 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Collecting fastimport
  Downloading fastimport-0.9.14.tar.gz (41 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 41.8/41.8 kB 2.2 MB/s eta 0:00:00
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Requirement already satisfied: launchpadlib>=1.6.3 in /usr/lib/python3/dist-packages (1.11.0)
Requirement already satisfied: paramiko>=1.6.2 in /usr/local/lib/python3.11/dist-packages (3.3.1)
Requirement already satisfied: gpg in /usr/lib/pyth...

lp:~jelmer/brz/ruff-format updated
7889. By Jelmer Vernooij

Drop flake8, use ruff for formatting

by jelmer review by jelmer

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== removed file '.flake8'
2--- .flake8 2023-03-08 22:44:15 +0000
3+++ .flake8 1970-01-01 00:00:00 +0000
4@@ -1,44 +0,0 @@
5-[flake8]
6-# Ignore E402 ("module level import not at top of file"),
7-# because even with the lazy import plugin it still triggers
8-# for lazy_import statements before other imports.
9-exclude = .git,__pycache__,build,dist,target,.eggs,lib
10-ignore =
11- D
12- I
13- E12
14- E261
15- E265
16- E266
17- E301
18- E302
19- E303
20- E305
21- E306
22- E401
23- E402
24- E501
25- E502
26- E702
27- E704
28- E722
29- E731
30- E741
31- F401
32- F402
33- F403
34- F405
35- F811
36- F812
37- F821
38- F841
39- W391
40- W503
41- W504
42- W605
43-filename = *.py
44-
45-[flake8:local-plugins]
46-extension =
47- MC1 = flake8_lazy_import:LazyImport
48-paths = ./tools/
49
50=== modified file 'Makefile'
51--- Makefile 2023-09-29 18:07:58 +0000
52+++ Makefile 2023-11-07 18:55:36 +0000
53@@ -32,7 +32,7 @@
54 sw = $(sort $(wildcard $(1)))
55
56
57-.PHONY: all clean realclean extensions flake8 api-docs check-nodocs check clippy clippy-fix ruff ruff-fix
58+.PHONY: all clean realclean extensions api-docs check-nodocs check clippy clippy-fix
59
60 all: extensions
61
62@@ -40,7 +40,7 @@
63 @echo "building extension modules."
64 $(PYTHON) setup.py build_ext -i $(PYTHON_BUILDFLAGS)
65
66-check: docs check-nodocs
67+check:: docs check-nodocs
68
69 check-nodocs: brz
70 -$(RM) -f selftest.log
71@@ -67,20 +67,16 @@
72 brz:
73 $(PYTHON) setup.py build_rust -i $(PYTHON_BUILDFLAGS)
74
75-# Run Python style checker (apt-get install flake8)
76-#
77-# Note that at present this gives many false warnings, because it doesn't
78-# know about identifiers loaded through lazy_import.
79-flake8:
80- $(PYTHON) -m flake8 breezy
81-
82-fmt-check:
83- find crates breezy -name '*.rs' | xargs rustfmt --check
84- flake8 breezy
85+check:: mypy
86
87 mypy:
88 $(PYTHON) -m mypy breezy
89
90+check:: cargo-check
91+
92+cargo-check:
93+ cargo check --all
94+
95 clean:
96 $(PYTHON) setup.py clean
97 -find . -name "*.pyc" -o -name "*.pyo" -o -name "*.so" | xargs rm -f
98@@ -320,8 +316,8 @@
99 rm -rf $$tmpdir
100
101 reformat:
102- isort .
103- find breezy crates -name '*.rs' | xargs rustfmt
104+ cargo fmt --all
105+ ruff format .
106
107 clippy-fix:
108 cargo clippy --fix --all --allow-no-vcs
109@@ -329,15 +325,31 @@
110 clippy:
111 cargo clippy --all
112
113+.PHONY: ruff
114+
115+check:: ruff
116+
117 ruff:
118 ruff check .
119
120+.PHONY: ruff-fix
121+
122 ruff-fix:
123 ruff check --fix .
124
125-fix: clippy ruff-fix
126+fix:: clippy-fix ruff-fix
127 $(MAKE) reformat
128
129+fmt-check:: rust-fmt-check
130+
131+rust-fmt-check:
132+ cargo fmt --all --check
133+
134+fmt-check:: ruff-fmt-check
135+
136+ruff-fmt-check:
137+ $(MAKE) ruff --check
138+
139 .testrepository:
140 testr init
141
142
143=== modified file 'apport/source_brz.py'
144--- apport/source_brz.py 2023-06-24 13:01:43 +0000
145+++ apport/source_brz.py 2023-11-07 18:55:36 +0000
146@@ -8,12 +8,13 @@
147
148 from apport.hookutils import * # noqa: F403
149
150-brz_log = os.path.expanduser('~/.brz.log')
151-dot_brz = os.path.expanduser('~/.config/breezy')
152+brz_log = os.path.expanduser("~/.brz.log")
153+dot_brz = os.path.expanduser("~/.config/breezy")
154+
155
156 def _add_log_tail(report):
157 # may have already been added in-process
158- if 'BrzLogTail' in report:
159+ if "BrzLogTail" in report:
160 return
161
162 with open(brz_log) as f:
163@@ -23,33 +24,33 @@
164 brz_log_tail = []
165 blanks = 0
166 for line in brz_log_lines:
167- if line == '\n':
168+ if line == "\n":
169 blanks += 1
170 brz_log_tail.append(line)
171 if blanks >= 2:
172 break
173
174 brz_log_tail.reverse()
175- report['BrzLogTail'] = ''.join(brz_log_tail)
176+ report["BrzLogTail"] = "".join(brz_log_tail)
177
178
179 def add_info(report):
180 _add_log_tail(report)
181- if 'BrzPlugins' not in report:
182+ if "BrzPlugins" not in report:
183 # may already be present in-process
184- report['BrzPlugins'] = command_output(['brz', 'plugins', '-v'])
185+ report["BrzPlugins"] = command_output(["brz", "plugins", "-v"])
186
187 # by default assume brz crashes are upstream bugs; this relies on
188 # having a brz entry under /etc/apport/crashdb.conf.d/
189- report['CrashDB'] = 'brz'
190+ report["CrashDB"] = "brz"
191
192 # these may contain some sensitive info (smtp_passwords)
193 # TODO: strip that out and attach the rest
194
195- #attach_file_if_exists(report,
196- # os.path.join(dot_brz, 'breezy.conf', 'BrzConfig')
197- #attach_file_if_exists(report,
198- # os.path.join(dot_brz, 'locations.conf', 'BrzLocations')
199+ # attach_file_if_exists(report,
200+ # os.path.join(dot_brz, 'breezy.conf', 'BrzConfig')
201+ # attach_file_if_exists(report,
202+ # os.path.join(dot_brz, 'locations.conf', 'BrzLocations')
203
204
205 # vim: expandtab shiftwidth=4
206
207=== modified file 'breezy/__init__.py'
208--- breezy/__init__.py 2023-09-27 23:19:21 +0000
209+++ breezy/__init__.py 2023-11-07 18:55:36 +0000
210@@ -39,8 +39,7 @@
211 import sys
212
213 __copyright__ = (
214- "Copyright 2005-2012 Canonical Ltd.\n"
215- "Copyright 2017-2023 Breezy developers"
216+ "Copyright 2005-2012 Canonical Ltd.\n" "Copyright 2017-2023 Breezy developers"
217 )
218
219 # same format as sys.version_info: "A tuple containing the five components of
220@@ -50,7 +49,7 @@
221 # Python version 2.0 is (2, 0, 0, 'final', 0)." Additionally we use a
222 # releaselevel of 'dev' for unreleased under-development code.
223
224-version_info = (3, 4, 0, 'dev', 0)
225+version_info = (3, 4, 0, "dev", 0)
226
227
228 def _format_version_tuple(version_info):
229@@ -82,38 +81,38 @@
230 1.4.0.wibble.0
231 """
232 if len(version_info) == 2:
233- main_version = '%d.%d' % version_info[:2]
234+ main_version = "%d.%d" % version_info[:2]
235 else:
236- main_version = '%d.%d.%d' % version_info[:3]
237+ main_version = "%d.%d.%d" % version_info[:3]
238 if len(version_info) <= 3:
239 return main_version
240
241 release_type = version_info[3]
242 sub = version_info[4]
243
244- if release_type == 'final' and sub == 0:
245- sub_string = ''
246- elif release_type == 'final':
247- sub_string = '.' + str(sub)
248- elif release_type == 'dev' and sub == 0:
249- sub_string = '.dev'
250- elif release_type == 'dev':
251- sub_string = '.dev' + str(sub)
252- elif release_type in ('alpha', 'beta'):
253+ if release_type == "final" and sub == 0:
254+ sub_string = ""
255+ elif release_type == "final":
256+ sub_string = "." + str(sub)
257+ elif release_type == "dev" and sub == 0:
258+ sub_string = ".dev"
259+ elif release_type == "dev":
260+ sub_string = ".dev" + str(sub)
261+ elif release_type in ("alpha", "beta"):
262 if version_info[2] == 0:
263- main_version = '%d.%d' % version_info[:2]
264- sub_string = '.' + release_type[0] + str(sub)
265- elif release_type == 'candidate':
266- sub_string = '.rc' + str(sub)
267+ main_version = "%d.%d" % version_info[:2]
268+ sub_string = "." + release_type[0] + str(sub)
269+ elif release_type == "candidate":
270+ sub_string = ".rc" + str(sub)
271 else:
272- return '.'.join(map(str, version_info))
273+ return ".".join(map(str, version_info))
274
275 return main_version + sub_string
276
277
278 __version__ = _format_version_tuple(version_info)
279 version_string = __version__
280-_core_version_string = '.'.join(map(str, version_info[:3]))
281+_core_version_string = ".".join(map(str, version_info[:3]))
282
283
284 def _patch_filesystem_default_encoding(new_enc):
285@@ -129,15 +128,14 @@
286 """
287 try:
288 import ctypes
289- pythonapi = getattr(ctypes, 'pythonapi', None)
290+
291+ pythonapi = getattr(ctypes, "pythonapi", None)
292 if pythonapi is not None:
293- old_ptr = ctypes.c_void_p.in_dll(pythonapi,
294- "Py_FileSystemDefaultEncoding")
295- has_enc = ctypes.c_int.in_dll(pythonapi,
296- "Py_HasFileSystemDefaultEncoding")
297+ old_ptr = ctypes.c_void_p.in_dll(pythonapi, "Py_FileSystemDefaultEncoding")
298+ has_enc = ctypes.c_int.in_dll(pythonapi, "Py_HasFileSystemDefaultEncoding")
299 as_utf8 = ctypes.PYFUNCTYPE(
300- ctypes.POINTER(ctypes.c_char), ctypes.py_object)(
301- ("PyUnicode_AsUTF8", pythonapi))
302+ ctypes.POINTER(ctypes.c_char), ctypes.py_object
303+ )(("PyUnicode_AsUTF8", pythonapi))
304 except (ImportError, ValueError):
305 return # No ctypes or not CPython implementation, do nothing
306 new_enc = sys.intern(new_enc)
307@@ -154,7 +152,7 @@
308 # just ensure a usable locale is set via the $LANG variable on posix systems.
309 _fs_enc = sys.getfilesystemencoding()
310 if getattr(sys, "_brz_default_fs_enc", None) is not None:
311- if (_fs_enc is None or codecs.lookup(_fs_enc).name == "ascii"):
312+ if _fs_enc is None or codecs.lookup(_fs_enc).name == "ascii":
313 _fs_enc = _patch_filesystem_default_encoding(sys._brz_default_fs_enc) # type: ignore
314 if _fs_enc is None:
315 _fs_enc = "ascii"
316@@ -202,8 +200,10 @@
317 BzrLibraryState directly.
318 """
319 from breezy import library_state, trace
320+
321 if setup_ui:
322 import breezy.ui
323+
324 stdin = stdin or sys.stdin
325 stdout = stdout or sys.stdout
326 stderr = stderr or sys.stderr
327@@ -225,4 +225,5 @@
328
329 def test_suite():
330 import tests
331+
332 return tests.test_suite()
333
334=== modified file 'breezy/__main__.py'
335--- breezy/__main__.py 2023-05-12 08:24:43 +0000
336+++ breezy/__main__.py 2023-11-07 18:55:36 +0000
337@@ -21,23 +21,26 @@
338 import sys
339
340 profiling = False
341-if '--profile-imports' in sys.argv:
342+if "--profile-imports" in sys.argv:
343 import profile_imports
344+
345 profile_imports.install()
346 profiling = True
347
348
349 if os.name == "posix":
350 import locale
351+
352 try:
353- locale.setlocale(locale.LC_ALL, '')
354+ locale.setlocale(locale.LC_ALL, "")
355 except locale.Error as e:
356 sys.stderr.write(
357- 'brz: warning: %s\n'
358- ' bzr could not set the application locale.\n'
359- ' Although this should be no problem for bzr itself, it might\n'
360- ' cause problems with some plugins. To investigate the issue,\n'
361- ' look at the output of the locale(1p) tool.\n' % e)
362+ "brz: warning: %s\n"
363+ " bzr could not set the application locale.\n"
364+ " Although this should be no problem for bzr itself, it might\n"
365+ " cause problems with some plugins. To investigate the issue,\n"
366+ " look at the output of the locale(1p) tool.\n" % e
367+ )
368 # Use better default than ascii with posix filesystems that deal in bytes
369 # natively even when the C locale or no locale at all is given. Note that
370 # we need an immortal string for the hack, hence the lack of a hyphen.
371@@ -46,6 +49,7 @@
372
373 def main():
374 import breezy.breakin
375+
376 breezy.breakin.hook_debugger_to_signal()
377
378 import breezy.commands
379@@ -69,5 +73,5 @@
380 os._exit(exit_val)
381
382
383-if __name__ == '__main__':
384+if __name__ == "__main__":
385 main()
386
387=== modified file 'breezy/_annotator_py.py'
388--- breezy/_annotator_py.py 2023-06-30 09:01:43 +0000
389+++ breezy/_annotator_py.py 2023-11-07 18:55:36 +0000
390@@ -81,8 +81,9 @@
391 parent_keys = ()
392 next_parent_map[key] = ()
393 self._update_needed_children(key, parent_keys)
394- needed_keys.update([key for key in parent_keys
395- if key not in parent_map])
396+ needed_keys.update(
397+ [key for key in parent_keys if key not in parent_map]
398+ )
399 parent_map.update(next_parent_map)
400 # _heads_provider does some graph caching, so it is only valid
401 # while self._parent_map hasn't changed
402@@ -100,15 +101,15 @@
403 """
404 keys, ann_keys = self._get_needed_keys(key)
405 if pb is not None:
406- pb.update('getting stream', 0, len(keys))
407- stream = self._vf.get_record_stream(keys, 'topological', True)
408+ pb.update("getting stream", 0, len(keys))
409+ stream = self._vf.get_record_stream(keys, "topological", True)
410 for _idx, record in enumerate(stream):
411 if pb is not None:
412- pb.update('extracting', 0, len(keys))
413- if record.storage_kind == 'absent':
414+ pb.update("extracting", 0, len(keys))
415+ if record.storage_kind == "absent":
416 raise errors.RevisionNotPresent(record.key, self._vf)
417 this_key = record.key
418- lines = record.get_bytes_as('lines')
419+ lines = record.get_bytes_as("lines")
420 num_lines = len(lines)
421 self._text_cache[this_key] = lines
422 yield this_key, lines, num_lines
423@@ -132,28 +133,32 @@
424 parent_annotations = self._annotations_cache[parent_key]
425 # PatienceSequenceMatcher should probably be part of Policy
426 from patiencediff import PatienceSequenceMatcher
427- matcher = PatienceSequenceMatcher(
428- None, parent_lines, text)
429+
430+ matcher = PatienceSequenceMatcher(None, parent_lines, text)
431 matching_blocks = matcher.get_matching_blocks()
432 return parent_annotations, matching_blocks
433
434 def _update_from_first_parent(self, key, annotations, lines, parent_key):
435 """Reannotate this text relative to its first parent."""
436- (parent_annotations,
437- matching_blocks) = self._get_parent_annotations_and_matches(
438- key, lines, parent_key)
439+ (
440+ parent_annotations,
441+ matching_blocks,
442+ ) = self._get_parent_annotations_and_matches(key, lines, parent_key)
443
444 for parent_idx, lines_idx, match_len in matching_blocks:
445 # For all matching regions we copy across the parent annotations
446- annotations[lines_idx:lines_idx + match_len] = \
447- parent_annotations[parent_idx:parent_idx + match_len]
448+ annotations[lines_idx : lines_idx + match_len] = parent_annotations[
449+ parent_idx : parent_idx + match_len
450+ ]
451
452- def _update_from_other_parents(self, key, annotations, lines,
453- this_annotation, parent_key):
454+ def _update_from_other_parents(
455+ self, key, annotations, lines, this_annotation, parent_key
456+ ):
457 """Reannotate this text relative to a second (or more) parent."""
458- (parent_annotations,
459- matching_blocks) = self._get_parent_annotations_and_matches(
460- key, lines, parent_key)
461+ (
462+ parent_annotations,
463+ matching_blocks,
464+ ) = self._get_parent_annotations_and_matches(key, lines, parent_key)
465
466 last_ann = None
467 last_parent = None
468@@ -167,8 +172,8 @@
469 for parent_idx, lines_idx, match_len in matching_blocks:
470 # For lines which match this parent, we will now resolve whether
471 # this parent wins over the current annotation
472- ann_sub = annotations[lines_idx:lines_idx + match_len]
473- par_sub = parent_annotations[parent_idx:parent_idx + match_len]
474+ ann_sub = annotations[lines_idx : lines_idx + match_len]
475+ par_sub = parent_annotations[parent_idx : parent_idx + match_len]
476 if ann_sub == par_sub:
477 continue
478 for idx in range(match_len):
479@@ -214,11 +219,11 @@
480 annotations = [this_annotation] * num_lines
481 parent_keys = self._parent_map[key]
482 if parent_keys:
483- self._update_from_first_parent(key, annotations, text,
484- parent_keys[0])
485+ self._update_from_first_parent(key, annotations, text, parent_keys[0])
486 for parent in parent_keys[1:]:
487- self._update_from_other_parents(key, annotations, text,
488- this_annotation, parent)
489+ self._update_from_other_parents(
490+ key, annotations, text, this_annotation, parent
491+ )
492 self._record_annotation(key, parent_keys, annotations)
493
494 def add_special_text(self, key, parent_keys, text):
495@@ -246,8 +251,7 @@
496 lines the text of "key" as a list of lines
497 """
498 with ui.ui_factory.nested_progress_bar() as pb:
499- for text_key, text, num_lines in self._get_needed_texts(
500- key, pb=pb):
501+ for text_key, text, num_lines in self._get_needed_texts(key, pb=pb):
502 self._annotate_one(text_key, text, num_lines)
503 try:
504 annotations = self._annotations_cache[key]
505@@ -281,6 +285,7 @@
506 A list of tuples with a single annotation key for each line.
507 """
508 from .annotate import _break_annotation_tie
509+
510 custom_tiebreaker = _break_annotation_tie
511 annotations, lines = self.annotate(key)
512 out = []
513@@ -295,7 +300,8 @@
514 # get the item out of the set
515 head = next(iter(the_heads))
516 else:
517- head = self._resolve_annotation_tie(the_heads, line,
518- custom_tiebreaker)
519+ head = self._resolve_annotation_tie(
520+ the_heads, line, custom_tiebreaker
521+ )
522 append((head, line))
523 return out
524
525=== modified file 'breezy/_known_graph_py.py'
526--- breezy/_known_graph_py.py 2023-09-29 18:19:23 +0000
527+++ breezy/_known_graph_py.py 2023-11-07 18:55:36 +0000
528@@ -24,7 +24,7 @@
529 class _KnownGraphNode:
530 """Represents a single object in the known graph."""
531
532- __slots__ = ('key', 'parent_keys', 'child_keys', 'gdfo')
533+ __slots__ = ("key", "parent_keys", "child_keys", "gdfo")
534
535 def __init__(self, key, parent_keys):
536 self.key = key
537@@ -34,15 +34,19 @@
538 self.gdfo = None
539
540 def __repr__(self):
541- return '{}({} gdfo:{} par:{} child:{})'.format(
542- self.__class__.__name__, self.key, self.gdfo,
543- self.parent_keys, self.child_keys)
544+ return "{}({} gdfo:{} par:{} child:{})".format(
545+ self.__class__.__name__,
546+ self.key,
547+ self.gdfo,
548+ self.parent_keys,
549+ self.child_keys,
550+ )
551
552
553 class _MergeSortNode:
554 """Information about a specific node in the merge graph."""
555
556- __slots__ = ('key', 'merge_depth', 'revno', 'end_of_merge')
557+ __slots__ = ("key", "merge_depth", "revno", "end_of_merge")
558
559 def __init__(self, key, merge_depth, revno, end_of_merge):
560 self.key = key
561@@ -92,12 +96,10 @@
562 parent_node.child_keys.append(key)
563
564 def _find_tails(self):
565- return [node for node in self._nodes.values()
566- if not node.parent_keys]
567+ return [node for node in self._nodes.values() if not node.parent_keys]
568
569 def _find_tips(self):
570- return [node for node in self._nodes.values()
571- if not node.child_keys]
572+ return [node for node in self._nodes.values() if not node.child_keys]
573
574 def _find_gdfo(self):
575 nodes = self._nodes
576@@ -157,8 +159,9 @@
577 return # Identical content
578 else:
579 raise ValueError(
580- f'Parent key mismatch, existing node {key}'
581- f' has parents of {existing_parent_keys} not {parent_keys}')
582+ f"Parent key mismatch, existing node {key}"
583+ f" has parents of {existing_parent_keys} not {parent_keys}"
584+ )
585 else:
586 node = _KnownGraphNode(key, parent_keys)
587 nodes[key] = node
588@@ -301,7 +304,7 @@
589 prefix_tips = {}
590 for node in tips:
591 if node.key.__class__ is str or len(node.key) == 1:
592- prefix = ''
593+ prefix = ""
594 else:
595 prefix = node.key[0]
596 prefix_tips.setdefault(prefix, []).append(node)
597@@ -310,8 +313,7 @@
598
599 result = []
600 for prefix in sorted(prefix_tips):
601- pending = sorted(prefix_tips[prefix], key=lambda n: n.key,
602- reverse=True)
603+ pending = sorted(prefix_tips[prefix], key=lambda n: n.key, reverse=True)
604 while pending:
605 node = pending.pop()
606 if node.parent_keys is None:
607@@ -333,17 +335,21 @@
608 def merge_sort(self, tip_key):
609 """Compute the merge sorted graph output."""
610 from breezy import tsort
611- as_parent_map = {node.key: node.parent_keys
612- for node in self._nodes.values()
613- if node.parent_keys is not None}
614+
615+ as_parent_map = {
616+ node.key: node.parent_keys
617+ for node in self._nodes.values()
618+ if node.parent_keys is not None
619+ }
620 # We intentionally always generate revnos and never force the
621 # mainline_revisions
622 # Strip the sequence_number that merge_sort generates
623- return [_MergeSortNode(key, merge_depth, revno, end_of_merge)
624- for _, key, merge_depth, revno, end_of_merge
625- in tsort.merge_sort(as_parent_map, tip_key,
626- mainline_revisions=None,
627- generate_revno=True)]
628+ return [
629+ _MergeSortNode(key, merge_depth, revno, end_of_merge)
630+ for _, key, merge_depth, revno, end_of_merge in tsort.merge_sort(
631+ as_parent_map, tip_key, mainline_revisions=None, generate_revno=True
632+ )
633+ ]
634
635 def get_parent_keys(self, key):
636 """Get the parents for a key.
637
638=== modified file 'breezy/add.py'
639--- breezy/add.py 2023-06-24 13:01:43 +0000
640+++ breezy/add.py 2023-11-07 18:55:36 +0000
641@@ -50,7 +50,7 @@
642 :param kind: The kind of the object being added.
643 """
644 if self.should_print:
645- self._to_file.write(f'adding {_quote(path)}\n')
646+ self._to_file.write(f"adding {_quote(path)}\n")
647 return None
648
649 def skip_file(self, tree, path, kind, stat_value=None):
650@@ -74,9 +74,9 @@
651 _max_size = None
652
653 def skip_file(self, tree, path, kind, stat_value=None):
654- if kind != 'file':
655+ if kind != "file":
656 return False
657- opt_name = 'add.maximum_file_size'
658+ opt_name = "add.maximum_file_size"
659 if self._max_size is None:
660 config = tree.get_config_stack()
661 self._max_size = config.get(opt_name)
662@@ -85,9 +85,11 @@
663 else:
664 file_size = stat_value.st_size
665 if self._max_size > 0 and file_size > self._max_size:
666- ui.ui_factory.show_warning(gettext(
667- "skipping {0} (larger than {1} of {2} bytes)").format(
668- path, opt_name, self._max_size))
669+ ui.ui_factory.show_warning(
670+ gettext("skipping {0} (larger than {1} of {2} bytes)").format(
671+ path, opt_name, self._max_size
672+ )
673+ )
674 return True
675 return False
676
677@@ -96,8 +98,7 @@
678 """This class will try to extract file ids from another tree."""
679
680 def __init__(self, base_tree, base_path, to_file=None, should_print=None):
681- super().__init__(to_file=to_file,
682- should_print=should_print)
683+ super().__init__(to_file=to_file, should_print=should_print)
684 self.base_tree = base_tree
685 self.base_path = base_path
686
687@@ -107,12 +108,11 @@
688 file_id, base_path = self._get_base_file_id(path, parent_ie)
689 if file_id is not None:
690 if self.should_print:
691- self._to_file.write(f'adding {path} w/ file id from {base_path}\n')
692+ self._to_file.write(f"adding {path} w/ file id from {base_path}\n")
693 else:
694 # we aren't doing anything special, so let the default
695 # reporter happen
696- file_id = super().__call__(
697- inv, parent_ie, path, kind)
698+ file_id = super().__call__(inv, parent_ie, path, kind)
699 return file_id
700
701 def _get_base_file_id(self, path, parent_ie):
702
703=== modified file 'breezy/annotate.py'
704--- breezy/annotate.py 2023-05-12 08:24:43 +0000
705+++ breezy/annotate.py 2023-11-07 18:55:36 +0000
706@@ -33,8 +33,9 @@
707 from .revision import CURRENT_REVISION, Revision
708
709
710-def annotate_file_tree(tree, path, to_file, verbose=False, full=False,
711- show_ids=False, branch=None):
712+def annotate_file_tree(
713+ tree, path, to_file, verbose=False, full=False, show_ids=False, branch=None
714+):
715 """Annotate path in a tree.
716
717 The tree should already be read_locked() when annotate_file_tree is called.
718@@ -64,21 +65,22 @@
719 # Should get some more pending commit attributes, like pending tags,
720 # bugfixes etc.
721 try:
722- committer = branch.get_config_stack().get('email')
723+ committer = branch.get_config_stack().get("email")
724 except errors.NoWhoami:
725- committer = 'local user'
726+ committer = "local user"
727 current_rev = Revision(
728- CURRENT_REVISION,
729- parent_ids=tree.get_parent_ids(),
730- committer=committer, message="?",
731- properties={},
732- inventory_sha1=None,
733- timestamp=round(time.time(), 3),
734- timezone=osutils.local_time_offset())
735+ CURRENT_REVISION,
736+ parent_ids=tree.get_parent_ids(),
737+ committer=committer,
738+ message="?",
739+ properties={},
740+ inventory_sha1=None,
741+ timestamp=round(time.time(), 3),
742+ timezone=osutils.local_time_offset(),
743+ )
744 else:
745 current_rev = None
746- annotation = list(_expand_annotations(
747- annotations, branch, current_rev))
748+ annotation = list(_expand_annotations(annotations, branch, current_rev))
749 _print_annotations(annotation, verbose, to_file, full, encoding)
750
751
752@@ -100,21 +102,26 @@
753 max_revno_len = max(max_revno_len, 3)
754
755 # Output the annotations
756- prevanno = ''
757- for (revno_str, author, date_str, _line_rev_id, text) in annotation:
758+ prevanno = ""
759+ for revno_str, author, date_str, _line_rev_id, text in annotation:
760 if verbose:
761- anno = '%-*s %-*s %8s ' % (max_revno_len, revno_str,
762- max_origin_len, author, date_str)
763+ anno = "%-*s %-*s %8s " % (
764+ max_revno_len,
765+ revno_str,
766+ max_origin_len,
767+ author,
768+ date_str,
769+ )
770 else:
771 if len(revno_str) > max_revno_len:
772- revno_str = revno_str[:max_revno_len - 1] + '>'
773+ revno_str = revno_str[: max_revno_len - 1] + ">"
774 anno = "%-*s %-7s " % (max_revno_len, revno_str, author[:7])
775 if anno.lstrip() == "" and full:
776 anno = prevanno
777 # GZ 2017-05-21: Writing both unicode annotation and bytes from file
778 # which the given to_file must cope with.
779 to_file.write(anno)
780- to_file.write(f'| {text.decode(encoding)}\n')
781+ to_file.write(f"| {text.decode(encoding)}\n")
782 prevanno = anno
783
784
785@@ -127,9 +134,10 @@
786 if full or last_rev_id != origin:
787 this = origin
788 else:
789- this = b''
790- to_file.write('%*s | %s' % (
791- max_origin_len, this.decode('utf-8'), text.decode(encoding)))
792+ this = b""
793+ to_file.write(
794+ "%*s | %s" % (max_origin_len, this.decode("utf-8"), text.decode(encoding))
795+ )
796 last_rev_id = origin
797 return
798
799@@ -145,6 +153,7 @@
800 :param branch: A locked branch to query for revision details.
801 """
802 from . import tsort
803+
804 repository = branch.repository
805 revision_ids = {o for o, t in annotations}
806 if current_rev is not None:
807@@ -158,19 +167,19 @@
808 # VF.get_known_graph_ancestry().
809 graph = repository.get_graph()
810 revision_graph = {
811- key: value for key, value in
812- graph.iter_ancestry(current_rev.parent_ids) if value is not None}
813+ key: value
814+ for key, value in graph.iter_ancestry(current_rev.parent_ids)
815+ if value is not None
816+ }
817 revision_graph = _strip_NULL_ghosts(revision_graph)
818 revision_graph[last_revision] = current_rev.parent_ids
819 merge_sorted_revisions = tsort.merge_sort(
820- revision_graph,
821- last_revision,
822- None,
823- generate_revno=True)
824+ revision_graph, last_revision, None, generate_revno=True
825+ )
826 revision_id_to_revno = {
827 rev_id: revno
828- for seq_num, rev_id, depth, revno, end_of_merge in
829- merge_sorted_revisions}
830+ for seq_num, rev_id, depth, revno, end_of_merge in merge_sorted_revisions
831+ }
832 else:
833 # TODO(jelmer): Only look up the revision ids that we need (i.e. those
834 # in revision_ids). Possibly add a HPSS call that can look those up
835@@ -179,28 +188,26 @@
836 last_origin = None
837 revisions = {}
838 if CURRENT_REVISION in revision_ids:
839- revision_id_to_revno[CURRENT_REVISION] = (
840- "%d?" % (branch.revno() + 1),)
841+ revision_id_to_revno[CURRENT_REVISION] = ("%d?" % (branch.revno() + 1),)
842 revisions[CURRENT_REVISION] = current_rev
843 revisions.update(
844- entry for entry in
845- repository.iter_revisions(revision_ids)
846- if entry[1] is not None)
847+ entry
848+ for entry in repository.iter_revisions(revision_ids)
849+ if entry[1] is not None
850+ )
851 for origin, text in annotations:
852- text = text.rstrip(b'\r\n')
853+ text = text.rstrip(b"\r\n")
854 if origin == last_origin:
855- (revno_str, author, date_str) = ('', '', '')
856+ (revno_str, author, date_str) = ("", "", "")
857 else:
858 last_origin = origin
859 if origin not in revisions:
860- (revno_str, author, date_str) = ('?', '?', '?')
861+ (revno_str, author, date_str) = ("?", "?", "?")
862 else:
863- revno_str = '.'.join(
864- str(i) for i in revision_id_to_revno[origin])
865+ revno_str = ".".join(str(i) for i in revision_id_to_revno[origin])
866 rev = revisions[origin]
867 tz = rev.timezone or 0
868- date_str = time.strftime('%Y%m%d',
869- time.gmtime(rev.timestamp + tz))
870+ date_str = time.strftime("%Y%m%d", time.gmtime(rev.timestamp + tz))
871 # a lazy way to get something like the email address
872 # TODO: Get real email address
873 author = rev.get_apparent_authors()[0]
874@@ -210,9 +217,13 @@
875 yield (revno_str, author, date_str, origin, text)
876
877
878-def reannotate(parents_lines, new_lines, new_revision_id,
879- _left_matching_blocks=None,
880- heads_provider=None):
881+def reannotate(
882+ parents_lines,
883+ new_lines,
884+ new_revision_id,
885+ _left_matching_blocks=None,
886+ heads_provider=None,
887+):
888 """Create a new annotated version from new lines and parent annotations.
889
890 :param parents_lines: List of annotated lines for all parents
891@@ -231,19 +242,25 @@
892 if len(parents_lines) == 0:
893 lines = [(new_revision_id, line) for line in new_lines]
894 elif len(parents_lines) == 1:
895- lines = _reannotate(parents_lines[0], new_lines, new_revision_id,
896- _left_matching_blocks)
897+ lines = _reannotate(
898+ parents_lines[0], new_lines, new_revision_id, _left_matching_blocks
899+ )
900 elif len(parents_lines) == 2:
901- left = _reannotate(parents_lines[0], new_lines, new_revision_id,
902- _left_matching_blocks)
903- lines = _reannotate_annotated(parents_lines[1], new_lines,
904- new_revision_id, left,
905- heads_provider)
906+ left = _reannotate(
907+ parents_lines[0], new_lines, new_revision_id, _left_matching_blocks
908+ )
909+ lines = _reannotate_annotated(
910+ parents_lines[1], new_lines, new_revision_id, left, heads_provider
911+ )
912 else:
913- reannotations = [_reannotate(parents_lines[0], new_lines,
914- new_revision_id, _left_matching_blocks)]
915- reannotations.extend(_reannotate(p, new_lines, new_revision_id)
916- for p in parents_lines[1:])
917+ reannotations = [
918+ _reannotate(
919+ parents_lines[0], new_lines, new_revision_id, _left_matching_blocks
920+ )
921+ ]
922+ reannotations.extend(
923+ _reannotate(p, new_lines, new_revision_id) for p in parents_lines[1:]
924+ )
925 lines = []
926 for annos in zip(*reannotations):
927 origins = {a for a, l in annos}
928@@ -261,26 +278,28 @@
929 return lines
930
931
932-def _reannotate(parent_lines, new_lines, new_revision_id,
933- matching_blocks=None):
934+def _reannotate(parent_lines, new_lines, new_revision_id, matching_blocks=None):
935 import patiencediff
936+
937 new_cur = 0
938 if matching_blocks is None:
939 plain_parent_lines = [l for r, l in parent_lines]
940 matcher = patiencediff.PatienceSequenceMatcher(
941- None, plain_parent_lines, new_lines)
942+ None, plain_parent_lines, new_lines
943+ )
944 matching_blocks = matcher.get_matching_blocks()
945 lines = []
946 for i, j, n in matching_blocks:
947 for line in new_lines[new_cur:j]:
948 lines.append((new_revision_id, line))
949- lines.extend(parent_lines[i:i + n])
950+ lines.extend(parent_lines[i : i + n])
951 new_cur = j + n
952 return lines
953
954
955 def _get_matching_blocks(old, new):
956 import patiencediff
957+
958 matcher = patiencediff.PatienceSequenceMatcher(None, old, new)
959 return matcher.get_matching_blocks()
960
961@@ -309,10 +328,18 @@
962 return sorted(annotated_lines)[0]
963
964
965-def _find_matching_unannotated_lines(output_lines, plain_child_lines,
966- child_lines, start_child, end_child,
967- right_lines, start_right, end_right,
968- heads_provider, revision_id):
969+def _find_matching_unannotated_lines(
970+ output_lines,
971+ plain_child_lines,
972+ child_lines,
973+ start_child,
974+ end_child,
975+ right_lines,
976+ start_right,
977+ end_right,
978+ heads_provider,
979+ revision_id,
980+):
981 """Find lines in plain_right_lines that match the existing lines.
982
983 :param output_lines: Append final annotated lines to this list
984@@ -344,8 +371,9 @@
985 for right_idx, child_idx, match_len in match_blocks:
986 # All the lines that don't match are just passed along
987 if child_idx > last_child_idx:
988- output_extend(child_lines[start_child + last_child_idx:
989- start_child + child_idx])
990+ output_extend(
991+ child_lines[start_child + last_child_idx : start_child + child_idx]
992+ )
993 for offset in range(match_len):
994 left = child_lines[start_child + child_idx + offset]
995 right = right_lines[start_right + right_idx + offset]
996@@ -370,15 +398,15 @@
997 # performance degradation as criss-cross merges will
998 # flip-flop the attribution.
999 if _break_annotation_tie is None:
1000- output_append(
1001- _old_break_annotation_tie([left, right]))
1002+ output_append(_old_break_annotation_tie([left, right]))
1003 else:
1004 output_append(_break_annotation_tie([left, right]))
1005 last_child_idx = child_idx + match_len
1006
1007
1008-def _reannotate_annotated(right_parent_lines, new_lines, new_revision_id,
1009- annotated_lines, heads_provider):
1010+def _reannotate_annotated(
1011+ right_parent_lines, new_lines, new_revision_id, annotated_lines, heads_provider
1012+):
1013 """Update the annotations for a node based on another parent.
1014
1015 :param right_parent_lines: A list of annotated lines for the right-hand
1016@@ -401,8 +429,7 @@
1017 # The line just after the last match from the right side
1018 last_right_idx = 0
1019 last_left_idx = 0
1020- matching_left_and_right = _get_matching_blocks(right_parent_lines,
1021- annotated_lines)
1022+ matching_left_and_right = _get_matching_blocks(right_parent_lines, annotated_lines)
1023 for right_idx, left_idx, match_len in matching_left_and_right:
1024 # annotated lines from last_left_idx to left_idx did not match the
1025 # lines from last_right_idx to right_idx, the raw lines should be
1026@@ -412,17 +439,22 @@
1027 lines_extend(annotated_lines[last_left_idx:left_idx])
1028 else:
1029 # We need to see if any of the unannotated lines match
1030- _find_matching_unannotated_lines(lines,
1031- new_lines, annotated_lines,
1032- last_left_idx, left_idx,
1033- right_parent_lines,
1034- last_right_idx, right_idx,
1035- heads_provider,
1036- new_revision_id)
1037+ _find_matching_unannotated_lines(
1038+ lines,
1039+ new_lines,
1040+ annotated_lines,
1041+ last_left_idx,
1042+ left_idx,
1043+ right_parent_lines,
1044+ last_right_idx,
1045+ right_idx,
1046+ heads_provider,
1047+ new_revision_id,
1048+ )
1049 last_right_idx = right_idx + match_len
1050 last_left_idx = left_idx + match_len
1051 # If left and right agree on a range, just push that into the output
1052- lines_extend(annotated_lines[left_idx:left_idx + match_len])
1053+ lines_extend(annotated_lines[left_idx : left_idx + match_len])
1054 return lines
1055
1056
1057
1058=== modified file 'breezy/archive/__init__.py'
1059--- breezy/archive/__init__.py 2023-05-12 08:24:43 +0000
1060+++ breezy/archive/__init__.py 2023-11-07 18:55:36 +0000
1061@@ -22,7 +22,6 @@
1062
1063
1064 class ArchiveFormatInfo:
1065-
1066 def __init__(self, extensions):
1067 self.extensions = extensions
1068
1069@@ -40,14 +39,15 @@
1070
1071 def register(self, key, factory, extensions, help=None):
1072 """Register an archive format."""
1073- registry.Registry.register(self, key, factory, help,
1074- ArchiveFormatInfo(extensions))
1075+ registry.Registry.register(
1076+ self, key, factory, help, ArchiveFormatInfo(extensions)
1077+ )
1078 self._register_extensions(key, extensions)
1079
1080- def register_lazy(self, key, module_name, member_name, extensions,
1081- help=None):
1082- registry.Registry.register_lazy(self, key, module_name, member_name,
1083- help, ArchiveFormatInfo(extensions))
1084+ def register_lazy(self, key, module_name, member_name, extensions, help=None):
1085+ registry.Registry.register_lazy(
1086+ self, key, module_name, member_name, help, ArchiveFormatInfo(extensions)
1087+ )
1088 self._register_extensions(key, extensions)
1089
1090 def _register_extensions(self, name, extensions):
1091@@ -67,29 +67,45 @@
1092 return None
1093
1094
1095-def create_archive(format, tree, name, root=None, subdir=None,
1096- force_mtime=None, recurse_nested=False) -> Iterator[bytes]:
1097+def create_archive(
1098+ format, tree, name, root=None, subdir=None, force_mtime=None, recurse_nested=False
1099+) -> Iterator[bytes]:
1100 try:
1101 archive_fn = format_registry.get(format)
1102 except KeyError as exc:
1103 raise errors.NoSuchExportFormat(format) from exc
1104- return cast(Iterator[bytes],
1105- archive_fn(
1106- tree, name, root=root, subdir=subdir,
1107- force_mtime=force_mtime,
1108- recurse_nested=recurse_nested))
1109+ return cast(
1110+ Iterator[bytes],
1111+ archive_fn(
1112+ tree,
1113+ name,
1114+ root=root,
1115+ subdir=subdir,
1116+ force_mtime=force_mtime,
1117+ recurse_nested=recurse_nested,
1118+ ),
1119+ )
1120
1121
1122 format_registry = ArchiveFormatRegistry()
1123-format_registry.register_lazy('tar', 'breezy.archive.tar',
1124- 'plain_tar_generator', ['.tar'], )
1125-format_registry.register_lazy('tgz', 'breezy.archive.tar',
1126- 'tgz_generator', ['.tar.gz', '.tgz'])
1127-format_registry.register_lazy('tbz2', 'breezy.archive.tar',
1128- 'tbz_generator', ['.tar.bz2', '.tbz2'])
1129-format_registry.register_lazy('tlzma', 'breezy.archive.tar',
1130- 'tar_lzma_generator', ['.tar.lzma'])
1131-format_registry.register_lazy('txz', 'breezy.archive.tar',
1132- 'tar_xz_generator', ['.tar.xz'])
1133-format_registry.register_lazy('zip', 'breezy.archive.zip',
1134- 'zip_archive_generator', ['.zip'])
1135+format_registry.register_lazy(
1136+ "tar",
1137+ "breezy.archive.tar",
1138+ "plain_tar_generator",
1139+ [".tar"],
1140+)
1141+format_registry.register_lazy(
1142+ "tgz", "breezy.archive.tar", "tgz_generator", [".tar.gz", ".tgz"]
1143+)
1144+format_registry.register_lazy(
1145+ "tbz2", "breezy.archive.tar", "tbz_generator", [".tar.bz2", ".tbz2"]
1146+)
1147+format_registry.register_lazy(
1148+ "tlzma", "breezy.archive.tar", "tar_lzma_generator", [".tar.lzma"]
1149+)
1150+format_registry.register_lazy(
1151+ "txz", "breezy.archive.tar", "tar_xz_generator", [".tar.xz"]
1152+)
1153+format_registry.register_lazy(
1154+ "zip", "breezy.archive.zip", "zip_archive_generator", [".zip"]
1155+)
1156
1157=== modified file 'breezy/archive/tar.py'
1158--- breezy/archive/tar.py 2023-11-01 20:32:05 +0000
1159+++ breezy/archive/tar.py 2023-11-07 18:55:36 +0000
1160@@ -58,7 +58,7 @@
1161 fileobj = BytesIO(content)
1162 elif entry.kind in ("directory", "tree-reference"):
1163 item.type = tarfile.DIRTYPE
1164- item.name += '/'
1165+ item.name += "/"
1166 item.size = 0
1167 item.mode = 0o755
1168 fileobj = None
1169@@ -69,11 +69,15 @@
1170 item.linkname = tree.get_symlink_target(tree_path)
1171 fileobj = None
1172 else:
1173- raise errors.BzrError(f"don't know how to export {{{final_path}}} of kind {entry.kind!r}")
1174+ raise errors.BzrError(
1175+ f"don't know how to export {{{final_path}}} of kind {entry.kind!r}"
1176+ )
1177 return (item, fileobj)
1178
1179
1180-def tarball_generator(tree, root, subdir=None, force_mtime=None, format='', recurse_nested=False):
1181+def tarball_generator(
1182+ tree, root, subdir=None, force_mtime=None, format="", recurse_nested=False
1183+):
1184 """Export tree contents to a tarball.
1185
1186 Args:
1187@@ -89,9 +93,11 @@
1188 buf = BytesIO()
1189 with closing(tarfile.open(None, f"w:{format}", buf)) as ball, tree.lock_read():
1190 for final_path, tree_path, entry in _export_iter_entries(
1191- tree, subdir, recurse_nested=recurse_nested):
1192+ tree, subdir, recurse_nested=recurse_nested
1193+ ):
1194 (item, fileobj) = prepare_tarball_item(
1195- tree, root, final_path, tree_path, entry, force_mtime)
1196+ tree, root, final_path, tree_path, entry, force_mtime
1197+ )
1198 ball.addfile(item, fileobj)
1199 # Yield the data that was written so far, rinse, repeat.
1200 yield buf.getvalue()
1201@@ -108,15 +114,17 @@
1202 """
1203 with tree.lock_read():
1204 import gzip
1205+
1206 if force_mtime is not None:
1207 root_mtime = force_mtime
1208- elif (getattr(tree, "repository", None) and
1209- getattr(tree, "get_revision_id", None)):
1210+ elif getattr(tree, "repository", None) and getattr(
1211+ tree, "get_revision_id", None
1212+ ):
1213 # If this is a revision tree, use the revisions' timestamp
1214 rev = tree.repository.get_revision(tree.get_revision_id())
1215 root_mtime = rev.timestamp
1216- elif tree.is_versioned(''):
1217- root_mtime = tree.get_file_mtime('')
1218+ elif tree.is_versioned(""):
1219+ root_mtime = tree.get_file_mtime("")
1220 else:
1221 root_mtime = None
1222
1223@@ -126,11 +134,10 @@
1224 # dest. (bug 102234)
1225 basename = os.path.basename(dest)
1226 buf = BytesIO()
1227- zipstream = gzip.GzipFile(basename, 'w', fileobj=buf,
1228- mtime=root_mtime)
1229+ zipstream = gzip.GzipFile(basename, "w", fileobj=buf, mtime=root_mtime)
1230 for chunk in tarball_generator(
1231- tree, root, subdir, force_mtime,
1232- recurse_nested=recurse_nested):
1233+ tree, root, subdir, force_mtime, recurse_nested=recurse_nested
1234+ ):
1235 zipstream.write(chunk)
1236 # Yield the data that was written so far, rinse, repeat.
1237 yield buf.getvalue()
1238@@ -148,30 +155,38 @@
1239 already exists, it will be clobbered, like with "tar -c".
1240 """
1241 return tarball_generator(
1242- tree, root, subdir, force_mtime, format='bz2',
1243- recurse_nested=recurse_nested)
1244-
1245-
1246-def plain_tar_generator(tree, dest, root, subdir,
1247- force_mtime=None, recurse_nested=False):
1248+ tree, root, subdir, force_mtime, format="bz2", recurse_nested=recurse_nested
1249+ )
1250+
1251+
1252+def plain_tar_generator(
1253+ tree, dest, root, subdir, force_mtime=None, recurse_nested=False
1254+):
1255 """Export this tree to a new tar file.
1256
1257 `dest` will be created holding the contents of this tree; if it
1258 already exists, it will be clobbered, like with "tar -c".
1259 """
1260 return tarball_generator(
1261- tree, root, subdir, force_mtime, format='',
1262- recurse_nested=recurse_nested)
1263+ tree, root, subdir, force_mtime, format="", recurse_nested=recurse_nested
1264+ )
1265
1266
1267 def tar_xz_generator(tree, dest, root, subdir, force_mtime=None, recurse_nested=False):
1268 return tar_lzma_generator(
1269- tree, dest, root, subdir, force_mtime, "xz",
1270- recurse_nested=recurse_nested)
1271-
1272-
1273-def tar_lzma_generator(tree, dest, root, subdir, force_mtime=None,
1274- compression_format="alone", recurse_nested=False):
1275+ tree, dest, root, subdir, force_mtime, "xz", recurse_nested=recurse_nested
1276+ )
1277+
1278+
1279+def tar_lzma_generator(
1280+ tree,
1281+ dest,
1282+ root,
1283+ subdir,
1284+ force_mtime=None,
1285+ compression_format="alone",
1286+ recurse_nested=False,
1287+):
1288 """Export this tree to a new .tar.lzma file.
1289
1290 `dest` will be created holding the contents of this tree; if it
1291@@ -180,18 +195,19 @@
1292 try:
1293 import lzma
1294 except ModuleNotFoundError as exc:
1295- raise errors.DependencyNotPresent('lzma', e) from exc
1296+ raise errors.DependencyNotPresent("lzma", e) from exc
1297
1298 compressor = lzma.LZMACompressor(
1299 format={
1300- 'xz': lzma.FORMAT_XZ,
1301- 'raw': lzma.FORMAT_RAW,
1302- 'alone': lzma.FORMAT_ALONE,
1303- }[compression_format])
1304+ "xz": lzma.FORMAT_XZ,
1305+ "raw": lzma.FORMAT_RAW,
1306+ "alone": lzma.FORMAT_ALONE,
1307+ }[compression_format]
1308+ )
1309
1310 for chunk in tarball_generator(
1311- tree, root, subdir, force_mtime=force_mtime,
1312- recurse_nested=recurse_nested):
1313+ tree, root, subdir, force_mtime=force_mtime, recurse_nested=recurse_nested
1314+ ):
1315 yield compressor.compress(chunk)
1316
1317 yield compressor.flush()
1318
1319=== modified file 'breezy/archive/zip.py'
1320--- breezy/archive/zip.py 2023-05-12 08:24:43 +0000
1321+++ breezy/archive/zip.py 2023-11-07 18:55:36 +0000
1322@@ -28,16 +28,17 @@
1323
1324 # Windows expects this bit to be set in the 'external_attr' section,
1325 # or it won't consider the entry a directory.
1326-ZIP_DIRECTORY_BIT = (1 << 4)
1327-FILE_PERMISSIONS = (0o644 << 16)
1328-DIR_PERMISSIONS = (0o755 << 16)
1329+ZIP_DIRECTORY_BIT = 1 << 4
1330+FILE_PERMISSIONS = 0o644 << 16
1331+DIR_PERMISSIONS = 0o755 << 16
1332
1333 _FILE_ATTR = stat.S_IFREG | FILE_PERMISSIONS
1334 _DIR_ATTR = stat.S_IFDIR | ZIP_DIRECTORY_BIT | DIR_PERMISSIONS
1335
1336
1337-def zip_archive_generator(tree, dest, root, subdir=None,
1338- force_mtime=None, recurse_nested=False):
1339+def zip_archive_generator(
1340+ tree, dest, root, subdir=None, force_mtime=None, recurse_nested=False
1341+):
1342 """Export this tree to a new zip file.
1343
1344 `dest` will be created holding the contents of this tree; if it
1345@@ -45,10 +46,10 @@
1346 """
1347 compression = zipfile.ZIP_DEFLATED
1348 with tempfile.SpooledTemporaryFile() as buf:
1349- with closing(zipfile.ZipFile(buf, "w", compression)) as zipf, \
1350- tree.lock_read():
1351+ with closing(zipfile.ZipFile(buf, "w", compression)) as zipf, tree.lock_read():
1352 for dp, tp, ie in _export_iter_entries(
1353- tree, subdir, recurse_nested=recurse_nested):
1354+ tree, subdir, recurse_nested=recurse_nested
1355+ ):
1356 mutter(" export {%s} kind %s to %s", tp, ie.kind, dest)
1357
1358 # zipfile.ZipFile switches all paths to forward
1359@@ -60,9 +61,7 @@
1360 date_time = time.localtime(mtime)[:6]
1361 filename = osutils.pathjoin(root, dp)
1362 if ie.kind == "file":
1363- zinfo = zipfile.ZipInfo(
1364- filename=filename,
1365- date_time=date_time)
1366+ zinfo = zipfile.ZipInfo(filename=filename, date_time=date_time)
1367 zinfo.compress_type = compression
1368 zinfo.external_attr = _FILE_ATTR
1369 content = tree.get_file_text(tp)
1370@@ -72,15 +71,15 @@
1371 # to the zip routine that they are really directories and
1372 # not just empty files.
1373 zinfo = zipfile.ZipInfo(
1374- filename=filename + '/',
1375- date_time=date_time)
1376+ filename=filename + "/", date_time=date_time
1377+ )
1378 zinfo.compress_type = compression
1379 zinfo.external_attr = _DIR_ATTR
1380- zipf.writestr(zinfo, '')
1381+ zipf.writestr(zinfo, "")
1382 elif ie.kind == "symlink":
1383 zinfo = zipfile.ZipInfo(
1384- filename=(filename + '.lnk'),
1385- date_time=date_time)
1386+ filename=(filename + ".lnk"), date_time=date_time
1387+ )
1388 zinfo.compress_type = compression
1389 zinfo.external_attr = _FILE_ATTR
1390 zipf.writestr(zinfo, tree.get_symlink_target(tp))
1391
1392=== modified file 'breezy/atomicfile.py'
1393--- breezy/atomicfile.py 2023-05-12 08:24:43 +0000
1394+++ breezy/atomicfile.py 2023-11-07 18:55:36 +0000
1395@@ -25,9 +25,7 @@
1396
1397
1398 class AtomicFileAlreadyClosed(errors.PathError):
1399-
1400- _fmt = ('"%(function)s" called on an AtomicFile after it was closed:'
1401- ' "%(path)s"')
1402+ _fmt = '"%(function)s" called on an AtomicFile after it was closed:' ' "%(path)s"'
1403
1404 def __init__(self, path, function):
1405 errors.PathError.__init__(self, path=path, extra=None)
1406@@ -43,9 +41,9 @@
1407 place or abort() to cancel.
1408 """
1409
1410- __slots__ = ['tmpfilename', 'realfilename', '_fd']
1411+ __slots__ = ["tmpfilename", "realfilename", "_fd"]
1412
1413- def __init__(self, filename, mode='wb', new_mode=None):
1414+ def __init__(self, filename, mode="wb", new_mode=None):
1415 global _hostname
1416
1417 self._fd = None
1418@@ -53,15 +51,19 @@
1419 if _hostname is None:
1420 _hostname = osutils.get_host_name()
1421
1422- self.tmpfilename = '%s.%d.%s.%s.tmp' % (filename, _pid, _hostname,
1423- osutils.rand_chars(10))
1424+ self.tmpfilename = "%s.%d.%s.%s.tmp" % (
1425+ filename,
1426+ _pid,
1427+ _hostname,
1428+ osutils.rand_chars(10),
1429+ )
1430
1431 self.realfilename = filename
1432
1433 flags = os.O_EXCL | os.O_CREAT | os.O_WRONLY | osutils.O_NOINHERIT
1434- if mode == 'wb':
1435+ if mode == "wb":
1436 flags |= osutils.O_BINARY
1437- elif mode != 'wt':
1438+ elif mode != "wt":
1439 raise ValueError(f"invalid AtomicFile mode {mode!r}")
1440
1441 if new_mode is not None:
1442@@ -81,7 +83,7 @@
1443 osutils.chmod_if_possible(self.tmpfilename, new_mode)
1444
1445 def __repr__(self):
1446- return f'{self.__class__.__name__}({self.realfilename!r})'
1447+ return f"{self.__class__.__name__}({self.realfilename!r})"
1448
1449 def write(self, data):
1450 """Write some data to the file. Like file.write()."""
1451@@ -90,20 +92,19 @@
1452 def _close_tmpfile(self, func_name):
1453 """Close the local temp file in preparation for commit or abort."""
1454 if self._fd is None:
1455- raise AtomicFileAlreadyClosed(path=self.realfilename,
1456- function=func_name)
1457+ raise AtomicFileAlreadyClosed(path=self.realfilename, function=func_name)
1458 fd = self._fd
1459 self._fd = None
1460 os.close(fd)
1461
1462 def commit(self):
1463 """Close the file and move to final name."""
1464- self._close_tmpfile('commit')
1465+ self._close_tmpfile("commit")
1466 osutils.rename(self.tmpfilename, self.realfilename)
1467
1468 def abort(self):
1469 """Discard temporary file without committing changes."""
1470- self._close_tmpfile('abort')
1471+ self._close_tmpfile("abort")
1472 os.remove(self.tmpfilename)
1473
1474 def close(self):
1475
1476=== modified file 'breezy/bisect.py'
1477--- breezy/bisect.py 2023-05-12 08:24:43 +0000
1478+++ breezy/bisect.py 2023-11-07 18:55:36 +0000
1479@@ -37,15 +37,15 @@
1480 self._controldir = controldir
1481 self._branch = self._controldir.open_branch()
1482 if self._controldir.control_transport.has(filename):
1483- self._revid = self._controldir.control_transport.get_bytes(
1484- filename).strip()
1485+ self._revid = self._controldir.control_transport.get_bytes(filename).strip()
1486 else:
1487 self._revid = self._branch.last_revision()
1488
1489 def _save(self):
1490 """Save the current revision."""
1491 self._controldir.control_transport.put_bytes(
1492- self._filename, self._revid + b"\n")
1493+ self._filename, self._revid + b"\n"
1494+ )
1495
1496 def get_current_revid(self):
1497 """Return the current revision id."""
1498@@ -79,8 +79,7 @@
1499 revid = self._branch.get_rev_id(revid)
1500 elif isinstance(revid, list):
1501 revid = revid[0].in_history(working.branch).rev_id
1502- working.revert(None, working.branch.repository.revision_tree(revid),
1503- False)
1504+ working.revert(None, working.branch.repository.revision_tree(revid), False)
1505 self._revid = revid
1506 self._save()
1507
1508@@ -134,14 +133,18 @@
1509 with repo.lock_read():
1510 graph = repo.get_graph()
1511 rev_sequence = graph.iter_lefthand_ancestry(
1512- last_revid, (_mod_revision.NULL_REVISION,))
1513+ last_revid, (_mod_revision.NULL_REVISION,)
1514+ )
1515 high_revid = None
1516 low_revid = None
1517 between_revs = []
1518 for revision in rev_sequence:
1519 between_revs.insert(0, revision)
1520- matches = [x[1] for x in self._items
1521- if x[0] == revision and x[1] in ('yes', 'no')]
1522+ matches = [
1523+ x[1]
1524+ for x in self._items
1525+ if x[0] == revision and x[1] in ("yes", "no")
1526+ ]
1527 if not matches:
1528 continue
1529 if len(matches) > 1:
1530@@ -185,8 +188,9 @@
1531 def _set_status(self, revid, status):
1532 """Set the bisect status for the given revid."""
1533 if not self.is_done():
1534- if status != "done" and revid in [x[0] for x in self._items
1535- if x[1] in ['yes', 'no']]:
1536+ if status != "done" and revid in [
1537+ x[0] for x in self._items if x[1] in ["yes", "no"]
1538+ ]:
1539 raise RuntimeError(f"attempting to add revid {revid} twice")
1540 self._items.append((revid, status))
1541
1542@@ -201,16 +205,16 @@
1543 revlog = self._open_for_read()
1544 for line in revlog:
1545 (revid, status) = line.split()
1546- self._items.append((revid, status.decode('ascii')))
1547+ self._items.append((revid, status.decode("ascii")))
1548
1549 def save(self):
1550 """Save the bisection log."""
1551- contents = b''.join(
1552- (b"%s %s\n" % (revid, status.encode('ascii')))
1553- for (revid, status) in self._items)
1554+ contents = b"".join(
1555+ (b"%s %s\n" % (revid, status.encode("ascii")))
1556+ for (revid, status) in self._items
1557+ )
1558 if self._filename:
1559- self._controldir.control_transport.put_bytes(
1560- self._filename, contents)
1561+ self._controldir.control_transport.put_bytes(self._filename, contents)
1562 else:
1563 sys.stdout.write(contents)
1564
1565@@ -242,9 +246,10 @@
1566 self._find_range_and_middle()
1567 # If we've found the "final" revision, check for a
1568 # merge point.
1569- while ((self._middle_revid == self._high_revid or
1570- self._middle_revid == self._low_revid) and
1571- self.is_merge_point(self._middle_revid)):
1572+ while (
1573+ self._middle_revid == self._high_revid
1574+ or self._middle_revid == self._low_revid
1575+ ) and self.is_merge_point(self._middle_revid):
1576 for parent in self.get_parent_revids(self._middle_revid):
1577 if parent == self._low_revid:
1578 continue
1579@@ -252,8 +257,10 @@
1580 self._find_range_and_middle(parent)
1581 break
1582 self._switch_wc_to_revno(self._middle_revid, outf)
1583- if self._middle_revid == self._high_revid or \
1584- self._middle_revid == self._low_revid:
1585+ if (
1586+ self._middle_revid == self._high_revid
1587+ or self._middle_revid == self._low_revid
1588+ ):
1589 self.set_current("done")
1590
1591
1592@@ -307,10 +314,12 @@
1593 anything else for no
1594 """
1595
1596- takes_args = ['subcommand', 'args*']
1597- takes_options = [Option('output', short_name='o',
1598- help='Write log to this file.', type=str),
1599- 'revision', 'directory']
1600+ takes_args = ["subcommand", "args*"]
1601+ takes_options = [
1602+ Option("output", short_name="o", help="Write log to this file.", type=str),
1603+ "revision",
1604+ "directory",
1605+ ]
1606
1607 def _check(self, controldir):
1608 """Check preconditions for most operations to work."""
1609@@ -336,22 +345,19 @@
1610 bisect_log.save()
1611 return False
1612
1613- def run(self, subcommand, args_list, directory='.', revision=None,
1614- output=None):
1615+ def run(self, subcommand, args_list, directory=".", revision=None, output=None):
1616 """Handle the bisect command."""
1617 log_fn = None
1618- if subcommand in ('yes', 'no', 'move') and revision:
1619+ if subcommand in ("yes", "no", "move") and revision:
1620 pass
1621- elif subcommand in ('replay', ) and args_list and len(args_list) == 1:
1622+ elif subcommand in ("replay",) and args_list and len(args_list) == 1:
1623 log_fn = args_list[0]
1624- elif subcommand in ('move', ) and not revision:
1625- raise CommandError(
1626- "The 'bisect move' command requires a revision.")
1627- elif subcommand in ('run', ):
1628+ elif subcommand in ("move",) and not revision:
1629+ raise CommandError("The 'bisect move' command requires a revision.")
1630+ elif subcommand in ("run",):
1631 run_script = args_list[0]
1632 elif args_list or revision:
1633- raise CommandError(
1634- "Improper arguments to bisect " + subcommand)
1635+ raise CommandError("Improper arguments to bisect " + subcommand)
1636
1637 controldir, _ = ControlDir.open_containing(directory)
1638
1639@@ -373,8 +379,7 @@
1640 elif subcommand == "run":
1641 self.run_bisect(controldir, run_script)
1642 else:
1643- raise CommandError(
1644- "Unknown bisect command: " + subcommand)
1645+ raise CommandError("Unknown bisect command: " + subcommand)
1646
1647 def reset(self, controldir):
1648 """Reset the bisect state to no state."""
1649@@ -428,6 +433,7 @@
1650
1651 def run_bisect(self, controldir, script):
1652 import subprocess
1653+
1654 note("Starting bisect.")
1655 self.start(controldir)
1656 while True:
1657@@ -436,11 +442,11 @@
1658 process.wait()
1659 retcode = process.returncode
1660 if retcode == 0:
1661- done = self._set_state(controldir, None, 'yes')
1662+ done = self._set_state(controldir, None, "yes")
1663 elif retcode == 125:
1664 break
1665 else:
1666- done = self._set_state(controldir, None, 'no')
1667+ done = self._set_state(controldir, None, "no")
1668 if done:
1669 break
1670 except RuntimeError:
1671
1672=== modified file 'breezy/bisect_multi.py'
1673--- breezy/bisect_multi.py 2020-02-18 01:57:45 +0000
1674+++ breezy/bisect_multi.py 2023-11-07 18:55:36 +0000
1675@@ -17,8 +17,8 @@
1676 """Bisection lookup multiple keys."""
1677
1678 __all__ = [
1679- 'bisect_multi_bytes',
1680- ]
1681+ "bisect_multi_bytes",
1682+]
1683
1684
1685 def bisect_multi_bytes(content_lookup, size, keys):
1686
1687=== modified file 'breezy/branch.py'
1688--- breezy/branch.py 2023-11-06 11:30:11 +0000
1689+++ breezy/branch.py 2023-11-07 18:55:36 +0000
1690@@ -40,11 +40,11 @@
1691 from .tag import TagConflict, TagUpdates
1692
1693
1694-
1695 class UnstackableBranchFormat(errors.BzrError):
1696-
1697- _fmt = ("The branch '%(url)s'(%(format)s) is not a stackable format. "
1698- "You will need to upgrade the branch to permit branch stacking.")
1699+ _fmt = (
1700+ "The branch '%(url)s'(%(format)s) is not a stackable format. "
1701+ "You will need to upgrade the branch to permit branch stacking."
1702+ )
1703
1704 def __init__(self, format, url):
1705 errors.BzrError.__init__(self)
1706@@ -53,7 +53,6 @@
1707
1708
1709 class BindingUnsupported(errors.UnsupportedOperation):
1710-
1711 _fmt = "Branch at %(url)s does not support binding."
1712
1713 def __init__(self, branch):
1714@@ -99,7 +98,7 @@
1715 self._master_branch_cache = None
1716 self._merge_sorted_revisions_cache = None
1717 self._open_hook(possible_transports)
1718- hooks = Branch.hooks['open']
1719+ hooks = Branch.hooks["open"]
1720 for hook in hooks:
1721 hook(self)
1722
1723@@ -113,7 +112,7 @@
1724 # This fallback is already configured. This probably only
1725 # happens because ControlDir.sprout is a horrible mess. To
1726 # avoid confusing _unstack we don't add this a second time.
1727- mutter('duplicate activation of fallback %r on %r', url, self)
1728+ mutter("duplicate activation of fallback %r on %r", url, self)
1729 return
1730 repo = self._get_fallback_repository(url, possible_transports)
1731 if repo.has_same_location(self.repository):
1732@@ -131,8 +130,10 @@
1733 raise NotImplementedError(self.break_lock)
1734
1735 def _extend_partial_history(
1736- self, stop_index: Optional[int] = None,
1737- stop_revision: Optional[RevisionID] = None) -> None:
1738+ self,
1739+ stop_index: Optional[int] = None,
1740+ stop_revision: Optional[RevisionID] = None,
1741+ ) -> None:
1742 """Extend the partial history to include a given index.
1743
1744 If a stop_index is supplied, stop when that index has been reached.
1745@@ -149,10 +150,12 @@
1746 if len(self._partial_revision_history_cache) == 0:
1747 self._partial_revision_history_cache = [self.last_revision()]
1748 repository._iter_for_revno(
1749- self.repository, self._partial_revision_history_cache,
1750- stop_index=stop_index, stop_revision=stop_revision)
1751- if self._partial_revision_history_cache[-1] == \
1752- _mod_revision.NULL_REVISION:
1753+ self.repository,
1754+ self._partial_revision_history_cache,
1755+ stop_index=stop_index,
1756+ stop_revision=stop_revision,
1757+ )
1758+ if self._partial_revision_history_cache[-1] == _mod_revision.NULL_REVISION:
1759 self._partial_revision_history_cache.pop()
1760
1761 def _get_check_refs(self):
1762@@ -161,7 +164,7 @@
1763 See breezy.check.
1764 """
1765 revid = self.last_revision()
1766- return [('revision-existence', revid), ('lefthand-distance', revid)]
1767+ return [("revision-existence", revid), ("lefthand-distance", revid)]
1768
1769 @staticmethod
1770 def open(base, _unsupported=False, possible_transports=None):
1771@@ -171,22 +174,24 @@
1772 Branch.open(URL) -> a Branch instance.
1773 """
1774 control = ControlDir.open(
1775- base, possible_transports=possible_transports,
1776- _unsupported=_unsupported)
1777+ base, possible_transports=possible_transports, _unsupported=_unsupported
1778+ )
1779 return control.open_branch(
1780- unsupported=_unsupported,
1781- possible_transports=possible_transports)
1782+ unsupported=_unsupported, possible_transports=possible_transports
1783+ )
1784
1785 @staticmethod
1786- def open_from_transport(transport: Transport, name: Optional[str] = None,
1787- _unsupported: bool = False,
1788- possible_transports=None):
1789+ def open_from_transport(
1790+ transport: Transport,
1791+ name: Optional[str] = None,
1792+ _unsupported: bool = False,
1793+ possible_transports=None,
1794+ ):
1795 """Open the branch rooted at transport."""
1796- control = ControlDir.open_from_transport(
1797- transport, _unsupported)
1798+ control = ControlDir.open_from_transport(transport, _unsupported)
1799 return control.open_branch(
1800- name=name, unsupported=_unsupported,
1801- possible_transports=possible_transports)
1802+ name=name, unsupported=_unsupported, possible_transports=possible_transports
1803+ )
1804
1805 @staticmethod
1806 def open_containing(url, possible_transports=None):
1807@@ -201,8 +206,7 @@
1808 raised. If there is one, it is returned, along with the unused portion
1809 of url.
1810 """
1811- control, relpath = ControlDir.open_containing(
1812- url, possible_transports)
1813+ control, relpath = ControlDir.open_containing(url, possible_transports)
1814 branch = control.open_branch(possible_transports=possible_transports)
1815 return (branch, relpath)
1816
1817@@ -275,21 +279,22 @@
1818 except errors.BzrError as e:
1819 # Silently fall back to local implicit nick if the master is
1820 # unavailable
1821- mutter("Could not connect to bound branch, "
1822- "falling back to local nick.\n " + str(e))
1823+ mutter(
1824+ "Could not connect to bound branch, "
1825+ "falling back to local nick.\n " + str(e)
1826+ )
1827 return config.get_nickname()
1828
1829 def _set_nick(self, nick):
1830- self.get_config().set_user_option('nickname', nick, warn_masked=True)
1831+ self.get_config().set_user_option("nickname", nick, warn_masked=True)
1832
1833 nick = property(_get_nick, _set_nick)
1834
1835 def is_locked(self):
1836 raise NotImplementedError(self.is_locked)
1837
1838- def _lefthand_history(self, revision_id, last_rev=None,
1839- other_branch=None):
1840- if debug.debug_flag_enabled('evil'):
1841+ def _lefthand_history(self, revision_id, last_rev=None, other_branch=None):
1842+ if debug.debug_flag_enabled("evil"):
1843 mutter_callsite(4, "_lefthand_history scales with history.")
1844 # stop_revision must be a descendant of last_revision
1845 graph = self.repository.get_graph()
1846@@ -305,8 +310,7 @@
1847 new_history = []
1848 check_not_reserved_id = _mod_revision.check_not_reserved_id
1849 # Do not include ghosts or graph origin in revision_history
1850- while (current_rev_id in parents_map
1851- and len(parents_map[current_rev_id]) > 0):
1852+ while current_rev_id in parents_map and len(parents_map[current_rev_id]) > 0:
1853 check_not_reserved_id(current_rev_id)
1854 new_history.append(current_rev_id)
1855 current_rev_id = parents_map[current_rev_id][0]
1856@@ -368,15 +372,19 @@
1857 try:
1858 return self.get_rev_id(revno[0])
1859 except errors.RevisionNotPresent as exc:
1860- raise errors.GhostRevisionsHaveNoRevno(revno[0], exc.revision_id) from exc
1861+ raise errors.GhostRevisionsHaveNoRevno(
1862+ revno[0], exc.revision_id
1863+ ) from exc
1864 revision_id_to_revno = self.get_revision_id_to_revno_map()
1865- revision_ids = [revision_id for revision_id, this_revno
1866- in revision_id_to_revno.items()
1867- if revno == this_revno]
1868+ revision_ids = [
1869+ revision_id
1870+ for revision_id, this_revno in revision_id_to_revno.items()
1871+ if revno == this_revno
1872+ ]
1873 if len(revision_ids) == 1:
1874 return revision_ids[0]
1875 else:
1876- revno_str = '.'.join(map(str, revno))
1877+ revno_str = ".".join(map(str, revno))
1878 raise errors.NoSuchRevision(self, revno_str)
1879
1880 def revision_id_to_dotted_revno(self, revision_id):
1881@@ -416,9 +424,8 @@
1882 Returns: A dictionary mapping revision_id => dotted revno.
1883 This dictionary should not be modified by the caller.
1884 """
1885- if debug.debug_flag_enabled('evil'):
1886- mutter_callsite(
1887- 3, "get_revision_id_to_revno_map scales with ancestry.")
1888+ if debug.debug_flag_enabled("evil"):
1889+ mutter_callsite(3, "get_revision_id_to_revno_map scales with ancestry.")
1890 with self.lock_read():
1891 if self._revision_id_to_revno_cache is not None:
1892 mapping = self._revision_id_to_revno_cache
1893@@ -442,13 +449,18 @@
1894 Returns: A dictionary mapping revision_id => dotted revno.
1895 """
1896 revision_id_to_revno = {
1897- rev_id: revno for rev_id, depth, revno, end_of_merge
1898- in self.iter_merge_sorted_revisions()}
1899+ rev_id: revno
1900+ for rev_id, depth, revno, end_of_merge in self.iter_merge_sorted_revisions()
1901+ }
1902 return revision_id_to_revno
1903
1904- def iter_merge_sorted_revisions(self, start_revision_id=None,
1905- stop_revision_id=None,
1906- stop_rule='exclude', direction='reverse'):
1907+ def iter_merge_sorted_revisions(
1908+ self,
1909+ start_revision_id=None,
1910+ stop_revision_id=None,
1911+ stop_rule="exclude",
1912+ direction="reverse",
1913+ ):
1914 """Walk the revisions for a branch in merge sorted order.
1915
1916 Merge sorted order is the output from a merge-aware,
1917@@ -498,26 +510,29 @@
1918 # start_revision_id.
1919 if self._merge_sorted_revisions_cache is None:
1920 last_revision = self.last_revision()
1921- known_graph = self.repository.get_known_graph_ancestry(
1922- [last_revision])
1923+ known_graph = self.repository.get_known_graph_ancestry([last_revision])
1924 self._merge_sorted_revisions_cache = known_graph.merge_sort(
1925- last_revision)
1926+ last_revision
1927+ )
1928 filtered = self._filter_merge_sorted_revisions(
1929- self._merge_sorted_revisions_cache, start_revision_id,
1930- stop_revision_id, stop_rule)
1931+ self._merge_sorted_revisions_cache,
1932+ start_revision_id,
1933+ stop_revision_id,
1934+ stop_rule,
1935+ )
1936 # Make sure we don't return revisions that are not part of the
1937 # start_revision_id ancestry.
1938 filtered = self._filter_start_non_ancestors(filtered)
1939- if direction == 'reverse':
1940+ if direction == "reverse":
1941 return filtered
1942- if direction == 'forward':
1943+ if direction == "forward":
1944 return reversed(list(filtered))
1945 else:
1946- raise ValueError(f'invalid direction {direction!r}')
1947+ raise ValueError(f"invalid direction {direction!r}")
1948
1949- def _filter_merge_sorted_revisions(self, merge_sorted_revisions,
1950- start_revision_id, stop_revision_id,
1951- stop_rule):
1952+ def _filter_merge_sorted_revisions(
1953+ self, merge_sorted_revisions, start_revision_id, stop_revision_id, stop_rule
1954+ ):
1955 """Iterate over an inclusive range of sorted revisions."""
1956 rev_iter = iter(merge_sorted_revisions)
1957 if start_revision_id is not None:
1958@@ -535,35 +550,32 @@
1959 # Yield everything
1960 for node in rev_iter:
1961 rev_id = node.key
1962- yield (rev_id, node.merge_depth, node.revno,
1963- node.end_of_merge)
1964- elif stop_rule == 'exclude':
1965- for node in rev_iter:
1966- rev_id = node.key
1967- if rev_id == stop_revision_id:
1968- return
1969- yield (rev_id, node.merge_depth, node.revno,
1970- node.end_of_merge)
1971- elif stop_rule == 'include':
1972- for node in rev_iter:
1973- rev_id = node.key
1974- yield (rev_id, node.merge_depth, node.revno,
1975- node.end_of_merge)
1976- if rev_id == stop_revision_id:
1977- return
1978- elif stop_rule == 'with-merges-without-common-ancestry':
1979+ yield (rev_id, node.merge_depth, node.revno, node.end_of_merge)
1980+ elif stop_rule == "exclude":
1981+ for node in rev_iter:
1982+ rev_id = node.key
1983+ if rev_id == stop_revision_id:
1984+ return
1985+ yield (rev_id, node.merge_depth, node.revno, node.end_of_merge)
1986+ elif stop_rule == "include":
1987+ for node in rev_iter:
1988+ rev_id = node.key
1989+ yield (rev_id, node.merge_depth, node.revno, node.end_of_merge)
1990+ if rev_id == stop_revision_id:
1991+ return
1992+ elif stop_rule == "with-merges-without-common-ancestry":
1993 # We want to exclude all revisions that are already part of the
1994 # stop_revision_id ancestry.
1995 graph = self.repository.get_graph()
1996- ancestors = graph.find_unique_ancestors(start_revision_id,
1997- [stop_revision_id])
1998+ ancestors = graph.find_unique_ancestors(
1999+ start_revision_id, [stop_revision_id]
2000+ )
2001 for node in rev_iter:
2002 rev_id = node.key
2003 if rev_id not in ancestors:
2004 continue
2005- yield (rev_id, node.merge_depth, node.revno,
2006- node.end_of_merge)
2007- elif stop_rule == 'with-merges':
2008+ yield (rev_id, node.merge_depth, node.revno, node.end_of_merge)
2009+ elif stop_rule == "with-merges":
2010 stop_rev = self.repository.get_revision(stop_revision_id)
2011 if stop_rev.parent_ids:
2012 left_parent = stop_rev.parent_ids[0]
2013@@ -578,10 +590,8 @@
2014 if rev_id == left_parent:
2015 # reached the left parent after the stop_revision
2016 return
2017- if (not reached_stop_revision_id
2018- or rev_id in revision_id_whitelist):
2019- yield (rev_id, node.merge_depth, node.revno,
2020- node.end_of_merge)
2021+ if not reached_stop_revision_id or rev_id in revision_id_whitelist:
2022+ yield (rev_id, node.merge_depth, node.revno, node.end_of_merge)
2023 if reached_stop_revision_id or rev_id == stop_revision_id:
2024 # only do the merged revs of rev_id from now on
2025 rev = self.repository.get_revision(rev_id)
2026@@ -589,7 +599,7 @@
2027 reached_stop_revision_id = True
2028 revision_id_whitelist.extend(rev.parent_ids)
2029 else:
2030- raise ValueError(f'invalid stop_rule {stop_rule!r}')
2031+ raise ValueError(f"invalid stop_rule {stop_rule!r}")
2032
2033 def _filter_start_non_ancestors(self, rev_iter):
2034 # If we started from a dotted revno, we want to consider it as a tip
2035@@ -621,7 +631,7 @@
2036 # called in that case. -- vila 20100322
2037 return
2038
2039- for (rev_id, merge_depth, revno, end_of_merge) in rev_iter:
2040+ for rev_id, merge_depth, revno, end_of_merge in rev_iter:
2041 if not clean:
2042 if rev_id in whitelist:
2043 pmap = self.repository.get_parent_map([rev_id])
2044@@ -668,12 +678,12 @@
2045 """Whether it is only possible to append revisions to the history."""
2046 if not self._format.supports_set_append_revisions_only():
2047 return False
2048- return self.get_config_stack().get('append_revisions_only')
2049+ return self.get_config_stack().get("append_revisions_only")
2050
2051 def set_append_revisions_only(self, enabled: bool) -> None:
2052 if not self._format.supports_set_append_revisions_only():
2053 raise errors.UpgradeRequired(self.user_url)
2054- self.get_config_stack().set('append_revisions_only', enabled)
2055+ self.get_config_stack().set("append_revisions_only", enabled)
2056
2057 def fetch(self, from_branch, stop_revision=None, limit=None, lossy=False):
2058 """Copy revisions from from_branch into this branch.
2059@@ -688,7 +698,8 @@
2060 """
2061 with self.lock_write():
2062 return InterBranch.get(from_branch, self).fetch(
2063- stop_revision, limit=limit, lossy=lossy)
2064+ stop_revision, limit=limit, lossy=lossy
2065+ )
2066
2067 def get_bound_location(self) -> Optional[str]:
2068 """Return the URL of the branch we are bound to.
2069@@ -702,9 +713,17 @@
2070 """Return the URL of the branch we used to be bound to."""
2071 raise errors.UpgradeRequired(self.user_url)
2072
2073- def get_commit_builder(self, parents, config_stack=None, timestamp=None,
2074- timezone=None, committer=None, revprops=None,
2075- revision_id=None, lossy=False):
2076+ def get_commit_builder(
2077+ self,
2078+ parents,
2079+ config_stack=None,
2080+ timestamp=None,
2081+ timezone=None,
2082+ committer=None,
2083+ revprops=None,
2084+ revision_id=None,
2085+ lossy=False,
2086+ ):
2087 """Obtain a CommitBuilder for this branch.
2088
2089 Args:
2090@@ -723,12 +742,20 @@
2091 config_stack = self.get_config_stack()
2092
2093 return self.repository.get_commit_builder(
2094- self, parents, config_stack, timestamp, timezone, committer,
2095- revprops, revision_id, lossy)
2096+ self,
2097+ parents,
2098+ config_stack,
2099+ timestamp,
2100+ timezone,
2101+ committer,
2102+ revprops,
2103+ revision_id,
2104+ lossy,
2105+ )
2106
2107 def get_master_branch(
2108- self, possible_transports: Optional[List[Transport]] = None
2109- ) -> Optional["Branch"]:
2110+ self, possible_transports: Optional[List[Transport]] = None
2111+ ) -> Optional["Branch"]:
2112 """Return the branch we are bound to.
2113
2114 Returns: Either a Branch, or None
2115@@ -746,7 +773,8 @@
2116 raise NotImplementedError(self.get_stacked_on_url)
2117
2118 def set_last_revision_info(
2119- self, revno: Optional[int], revision_id: RevisionID) -> None:
2120+ self, revno: Optional[int], revision_id: RevisionID
2121+ ) -> None:
2122 """Set the last revision of this branch.
2123
2124 The caller is responsible for checking that the revno is correct
2125@@ -759,9 +787,12 @@
2126 """
2127 raise NotImplementedError(self.set_last_revision_info)
2128
2129- def generate_revision_history(self, revision_id: RevisionID,
2130- last_rev: Optional[RevisionID] = None,
2131- other_branch: Optional["Branch"] = None) -> None:
2132+ def generate_revision_history(
2133+ self,
2134+ revision_id: RevisionID,
2135+ last_rev: Optional[RevisionID] = None,
2136+ other_branch: Optional["Branch"] = None,
2137+ ) -> None:
2138 """See Branch.generate_revision_history."""
2139 with self.lock_write():
2140 graph = self.repository.get_graph()
2141@@ -769,13 +800,12 @@
2142 known_revision_ids = [
2143 (last_revid, last_revno),
2144 (_mod_revision.NULL_REVISION, 0),
2145- ]
2146+ ]
2147 if last_rev is not None:
2148 if not graph.is_ancestor(last_rev, revision_id):
2149 # our previous tip is not merged into stop_revision
2150 raise errors.DivergedBranches(self, other_branch)
2151- revno = graph.find_distance_to_null(
2152- revision_id, known_revision_ids)
2153+ revno = graph.find_distance_to_null(revision_id, known_revision_ids)
2154 self.set_last_revision_info(revno, revision_id)
2155
2156 def _set_parent_location(self, url: Optional[str]) -> None:
2157@@ -790,11 +820,11 @@
2158 if url is not None:
2159 if isinstance(url, str):
2160 try:
2161- url.encode('ascii')
2162+ url.encode("ascii")
2163 except UnicodeEncodeError as exc:
2164 raise urlutils.InvalidURL(
2165- url, "Urls must be 7-bit ascii, "
2166- "use breezy.urlutils.escape") from exc
2167+ url, "Urls must be 7-bit ascii, " "use breezy.urlutils.escape"
2168+ ) from exc
2169 url = urlutils.relative_url(self.base, url)
2170 with self.lock_write():
2171 self._set_parent_location(url)
2172@@ -861,7 +891,7 @@
2173 raise NotImplementedError(self._gen_revision_history)
2174
2175 def _revision_history(self) -> List[RevisionID]:
2176- if debug.debug_flag_enabled('evil'):
2177+ if debug.debug_flag_enabled("evil"):
2178 mutter_callsite(3, "revision_history scales with history.")
2179 if self._revision_history_cache is not None:
2180 history = self._revision_history_cache
2181@@ -893,15 +923,13 @@
2182 """
2183 with self.lock_read():
2184 if self._last_revision_info_cache is None:
2185- self._last_revision_info_cache = (
2186- self._read_last_revision_info())
2187+ self._last_revision_info_cache = self._read_last_revision_info()
2188 return self._last_revision_info_cache
2189
2190 def _read_last_revision_info(self):
2191 raise NotImplementedError(self._read_last_revision_info)
2192
2193- def import_last_revision_info_and_tags(self, source, revno, revid,
2194- *, lossy=False):
2195+ def import_last_revision_info_and_tags(self, source, revno, revid, *, lossy=False):
2196 """Set the last revision info, importing from another repo if necessary.
2197
2198 This is used by the bound branch code to upload a revision to
2199@@ -932,7 +960,9 @@
2200 except ValueError as exc:
2201 raise errors.NoSuchRevision(self, revision_id) from exc
2202
2203- def get_rev_id(self, revno: int, history: Optional[List[RevisionID]] = None) -> RevisionID:
2204+ def get_rev_id(
2205+ self, revno: int, history: Optional[List[RevisionID]] = None
2206+ ) -> RevisionID:
2207 """Find the revision id of the specified revno."""
2208 with self.lock_read():
2209 if revno == 0:
2210@@ -947,10 +977,15 @@
2211 self._extend_partial_history(distance_from_last)
2212 return self._partial_revision_history_cache[distance_from_last]
2213
2214- def pull(self, source: "Branch", *, overwrite: bool = False,
2215- stop_revision: Optional[RevisionID] = None,
2216- possible_transports: Optional[List[Transport]] = None,
2217- **kwargs) -> "PullResult":
2218+ def pull(
2219+ self,
2220+ source: "Branch",
2221+ *,
2222+ overwrite: bool = False,
2223+ stop_revision: Optional[RevisionID] = None,
2224+ possible_transports: Optional[List[Transport]] = None,
2225+ **kwargs,
2226+ ) -> "PullResult":
2227 """Mirror source into this branch.
2228
2229 This branch is considered to be 'local', having low latency.
2230@@ -958,18 +993,28 @@
2231 Returns: PullResult instance
2232 """
2233 return InterBranch.get(source, self).pull(
2234- overwrite=overwrite, stop_revision=stop_revision,
2235- possible_transports=possible_transports, **kwargs)
2236+ overwrite=overwrite,
2237+ stop_revision=stop_revision,
2238+ possible_transports=possible_transports,
2239+ **kwargs,
2240+ )
2241
2242- def push(self, target: "Branch", *, overwrite: bool = False,
2243- stop_revision: Optional[RevisionID] = None, lossy: bool = False,
2244- **kwargs):
2245+ def push(
2246+ self,
2247+ target: "Branch",
2248+ *,
2249+ overwrite: bool = False,
2250+ stop_revision: Optional[RevisionID] = None,
2251+ lossy: bool = False,
2252+ **kwargs,
2253+ ):
2254 """Mirror this branch into target.
2255
2256 This branch is considered to be 'local', having low latency.
2257 """
2258 return InterBranch.get(self, target).push(
2259- overwrite, stop_revision, lossy, **kwargs)
2260+ overwrite, stop_revision, lossy, **kwargs
2261+ )
2262
2263 def basis_tree(self):
2264 """Return `Tree` object for last revision."""
2265@@ -987,7 +1032,7 @@
2266 return parent
2267 # This is an old-format absolute path to a local branch
2268 # turn it into a url
2269- if parent.startswith('/'):
2270+ if parent.startswith("/"):
2271 parent = urlutils.local_path_to_url(parent)
2272 try:
2273 return urlutils.join(self.base[:-1], parent)
2274@@ -997,12 +1042,11 @@
2275 def _get_parent_location(self):
2276 raise NotImplementedError(self._get_parent_location)
2277
2278- def _set_config_location(self, name, url, *, config=None,
2279- make_relative=False):
2280+ def _set_config_location(self, name, url, *, config=None, make_relative=False):
2281 if config is None:
2282 config = self.get_config_stack()
2283 if url is None:
2284- url = ''
2285+ url = ""
2286 elif make_relative:
2287 url = urlutils.relative_url(self.base, url)
2288 config.set(name, url)
2289@@ -1011,13 +1055,13 @@
2290 if config is None:
2291 config = self.get_config_stack()
2292 location = config.get(name)
2293- if location == '':
2294+ if location == "":
2295 location = None
2296 return cast(Optional[str], location)
2297
2298 def get_child_submit_format(self) -> Optional[str]:
2299 """Return the preferred format of submissions to this branch."""
2300- return cast(Optional[str], self.get_config_stack().get('child_submit_format'))
2301+ return cast(Optional[str], self.get_config_stack().get("child_submit_format"))
2302
2303 def get_submit_branch(self) -> Optional[str]:
2304 """Return the submit location of the branch.
2305@@ -1026,7 +1070,7 @@
2306 pattern is that the user can override it by specifying a
2307 location.
2308 """
2309- return cast(Optional[str], self.get_config_stack().get('submit_branch'))
2310+ return cast(Optional[str], self.get_config_stack().get("submit_branch"))
2311
2312 def set_submit_branch(self, location: str) -> None:
2313 """Return the submit location of the branch.
2314@@ -1035,14 +1079,14 @@
2315 pattern is that the user can override it by specifying a
2316 location.
2317 """
2318- self.get_config_stack().set('submit_branch', location)
2319+ self.get_config_stack().set("submit_branch", location)
2320
2321 def get_public_branch(self) -> Optional[str]:
2322 """Return the public location of the branch.
2323
2324 This is used by merge directives.
2325 """
2326- return self._get_config_location('public_branch')
2327+ return self._get_config_location("public_branch")
2328
2329 def set_public_branch(self, location: str) -> None:
2330 """Return the submit location of the branch.
2331@@ -1051,11 +1095,11 @@
2332 pattern is that the user can override it by specifying a
2333 location.
2334 """
2335- self._set_config_location('public_branch', location)
2336+ self._set_config_location("public_branch", location)
2337
2338 def get_push_location(self) -> Optional[str]:
2339 """Return None or the location to push this branch to."""
2340- return cast(str, self.get_config_stack().get('push_location'))
2341+ return cast(str, self.get_config_stack().get("push_location"))
2342
2343 def set_push_location(self, location: str) -> None:
2344 """Set a new push location for this branch."""
2345@@ -1063,23 +1107,21 @@
2346
2347 def _run_post_change_branch_tip_hooks(self, old_revno, old_revid):
2348 """Run the post_change_branch_tip hooks."""
2349- hooks = Branch.hooks['post_change_branch_tip']
2350+ hooks = Branch.hooks["post_change_branch_tip"]
2351 if not hooks:
2352 return
2353 new_revno, new_revid = self.last_revision_info()
2354- params = ChangeBranchTipParams(
2355- self, old_revno, new_revno, old_revid, new_revid)
2356+ params = ChangeBranchTipParams(self, old_revno, new_revno, old_revid, new_revid)
2357 for hook in hooks:
2358 hook(params)
2359
2360 def _run_pre_change_branch_tip_hooks(self, new_revno, new_revid):
2361 """Run the pre_change_branch_tip hooks."""
2362- hooks = Branch.hooks['pre_change_branch_tip']
2363+ hooks = Branch.hooks["pre_change_branch_tip"]
2364 if not hooks:
2365 return
2366 old_revno, old_revid = self.last_revision_info()
2367- params = ChangeBranchTipParams(
2368- self, old_revno, new_revno, old_revid, new_revid)
2369+ params = ChangeBranchTipParams(self, old_revno, new_revno, old_revid, new_revid)
2370 for hook in hooks:
2371 hook(params)
2372
2373@@ -1106,9 +1148,15 @@
2374 if revno < 1 or revno > self.revno():
2375 raise errors.InvalidRevisionNumber(revno)
2376
2377- def clone(self, to_controldir: ControlDir, *,
2378- revision_id: Optional[RevisionID] = None, name: Optional[str] = None,
2379- repository_policy=None, tag_selector=None) -> "Branch":
2380+ def clone(
2381+ self,
2382+ to_controldir: ControlDir,
2383+ *,
2384+ revision_id: Optional[RevisionID] = None,
2385+ name: Optional[str] = None,
2386+ repository_policy=None,
2387+ tag_selector=None,
2388+ ) -> "Branch":
2389 """Clone this branch into to_controldir preserving all semantic values.
2390
2391 Most API users will want 'create_clone_on_transport', which creates a
2392@@ -1122,12 +1170,21 @@
2393 if repository_policy is not None:
2394 repository_policy.configure_branch(result)
2395 self.copy_content_into(
2396- result, revision_id=revision_id, tag_selector=tag_selector)
2397+ result, revision_id=revision_id, tag_selector=tag_selector
2398+ )
2399 return result
2400
2401- def sprout(self, to_controldir, *, revision_id=None, repository_policy=None,
2402- repository=None, lossy=False, tag_selector=None,
2403- name=None):
2404+ def sprout(
2405+ self,
2406+ to_controldir,
2407+ *,
2408+ revision_id=None,
2409+ repository_policy=None,
2410+ repository=None,
2411+ lossy=False,
2412+ tag_selector=None,
2413+ name=None,
2414+ ):
2415 """Create a new line of development from the branch, into to_controldir.
2416
2417 to_controldir controls the branch format.
2418@@ -1135,8 +1192,7 @@
2419 revision_id: if not None, the revision history in the new branch will
2420 be truncated to end with revision_id.
2421 """
2422- if (repository_policy is not None
2423- and repository_policy.requires_stacking()):
2424+ if repository_policy is not None and repository_policy.requires_stacking():
2425 to_controldir._format.require_stacking(_skip_repo=True)
2426 result = to_controldir.create_branch(repository=repository, name=name)
2427 if lossy:
2428@@ -1145,7 +1201,8 @@
2429 if repository_policy is not None:
2430 repository_policy.configure_branch(result)
2431 self.copy_content_into(
2432- result, revision_id=revision_id, tag_selector=tag_selector)
2433+ result, revision_id=revision_id, tag_selector=tag_selector
2434+ )
2435 master_url = self.get_bound_location()
2436 if master_url is None:
2437 result.set_parent(self.user_url)
2438@@ -1173,7 +1230,8 @@
2439 graph = self.repository.get_graph()
2440 try:
2441 revno = graph.find_distance_to_null(
2442- revision_id, [(source_revision_id, source_revno)])
2443+ revision_id, [(source_revision_id, source_revno)]
2444+ )
2445 except errors.GhostRevisionsHaveNoRevno:
2446 # Default to 1, if we can't find anything else
2447 revno = 1
2448@@ -1188,7 +1246,8 @@
2449 and should return a boolean to indicate whether a tag should be copied
2450 """
2451 return InterBranch.get(self, destination).copy_content_into(
2452- revision_id=revision_id, tag_selector=tag_selector)
2453+ revision_id=revision_id, tag_selector=tag_selector
2454+ )
2455
2456 def update_references(self, target):
2457 if not self._format.supports_reference_locations:
2458@@ -1212,10 +1271,13 @@
2459 with self.lock_read():
2460 result = BranchCheckResult(self)
2461 last_revno, last_revision_id = self.last_revision_info()
2462- actual_revno = refs[('lefthand-distance', last_revision_id)]
2463+ actual_revno = refs[("lefthand-distance", last_revision_id)]
2464 if actual_revno != last_revno:
2465- result.errors.append(errors.BzrCheckError(
2466- f'revno does not match len(mainline) {last_revno} != {actual_revno}'))
2467+ result.errors.append(
2468+ errors.BzrCheckError(
2469+ f"revno does not match len(mainline) {last_revno} != {actual_revno}"
2470+ )
2471+ )
2472 # TODO: We should probably also check that self.revision_history
2473 # matches the repository for older branch formats.
2474 # If looking for the code that cross-checks repository parents
2475@@ -1231,10 +1293,17 @@
2476 format.set_branch_format(self._format)
2477 return format
2478
2479- def create_clone_on_transport(self, to_transport, *, revision_id=None,
2480- stacked_on=None, create_prefix=False,
2481- use_existing_dir=False, no_tree=None,
2482- tag_selector=None):
2483+ def create_clone_on_transport(
2484+ self,
2485+ to_transport,
2486+ *,
2487+ revision_id=None,
2488+ stacked_on=None,
2489+ create_prefix=False,
2490+ use_existing_dir=False,
2491+ no_tree=None,
2492+ tag_selector=None,
2493+ ):
2494 """Create a clone of this branch and its bzrdir.
2495
2496 Args:
2497@@ -1255,14 +1324,26 @@
2498 if revision_id is None:
2499 revision_id = self.last_revision()
2500 dir_to = self.controldir.clone_on_transport(
2501- to_transport, revision_id=revision_id, stacked_on=stacked_on,
2502- create_prefix=create_prefix, use_existing_dir=use_existing_dir,
2503- no_tree=no_tree, tag_selector=tag_selector)
2504+ to_transport,
2505+ revision_id=revision_id,
2506+ stacked_on=stacked_on,
2507+ create_prefix=create_prefix,
2508+ use_existing_dir=use_existing_dir,
2509+ no_tree=no_tree,
2510+ tag_selector=tag_selector,
2511+ )
2512 return dir_to.open_branch()
2513
2514- def create_checkout(self, to_location, *, revision_id=None,
2515- lightweight=False, accelerator_tree=None,
2516- hardlink=False, recurse_nested=True):
2517+ def create_checkout(
2518+ self,
2519+ to_location,
2520+ *,
2521+ revision_id=None,
2522+ lightweight=False,
2523+ accelerator_tree=None,
2524+ hardlink=False,
2525+ recurse_nested=True,
2526+ ):
2527 """Create a checkout of a branch.
2528
2529 Args:
2530@@ -1294,8 +1375,10 @@
2531 pass
2532 else:
2533 raise errors.AlreadyControlDirError(t.base) from exc
2534- if (checkout.control_transport.base
2535- == self.controldir.control_transport.base):
2536+ if (
2537+ checkout.control_transport.base
2538+ == self.controldir.control_transport.base
2539+ ):
2540 # When checking out to the same control directory,
2541 # always create a lightweight checkout
2542 lightweight = True
2543@@ -1311,21 +1394,24 @@
2544 # branch tip correctly, and seed it with history.
2545 checkout_branch.pull(self, stop_revision=revision_id)
2546 from_branch = None
2547- tree = checkout.create_workingtree(revision_id,
2548- from_branch=from_branch,
2549- accelerator_tree=accelerator_tree,
2550- hardlink=hardlink)
2551+ tree = checkout.create_workingtree(
2552+ revision_id,
2553+ from_branch=from_branch,
2554+ accelerator_tree=accelerator_tree,
2555+ hardlink=hardlink,
2556+ )
2557 basis_tree = tree.basis_tree()
2558 with basis_tree.lock_read():
2559 for path in basis_tree.iter_references():
2560 reference_parent = tree.reference_parent(path)
2561 if reference_parent is None:
2562- warning('Branch location for %s unknown.', path)
2563+ warning("Branch location for %s unknown.", path)
2564 continue
2565 reference_parent.create_checkout(
2566 tree.abspath(path),
2567 revision_id=basis_tree.get_reference_revision(path),
2568- lightweight=lightweight)
2569+ lightweight=lightweight,
2570+ )
2571 return tree
2572
2573 def reconcile(self, thorough=True):
2574@@ -1345,14 +1431,15 @@
2575 revision_id: Revision id of the revision.
2576 Returns: A tag name or None if no tag name could be determined.
2577 """
2578- for hook in Branch.hooks['automatic_tag_name']:
2579+ for hook in Branch.hooks["automatic_tag_name"]:
2580 ret = hook(self, revision_id)
2581 if ret is not None:
2582 return ret
2583 return None
2584
2585- def _check_if_descendant_or_diverged(self, revision_a, revision_b, graph,
2586- other_branch):
2587+ def _check_if_descendant_or_diverged(
2588+ self, revision_a, revision_b, graph, other_branch
2589+ ):
2590 """Ensure that revision_b is a descendant of revision_a.
2591
2592 This is a helper function for update_revisions.
2593@@ -1361,11 +1448,11 @@
2594 Returns: True if revision_b is a descendant of revision_a.
2595 """
2596 relation = self._revision_relations(revision_a, revision_b, graph)
2597- if relation == 'b_descends_from_a':
2598+ if relation == "b_descends_from_a":
2599 return True
2600- elif relation == 'diverged':
2601+ elif relation == "diverged":
2602 raise errors.DivergedBranches(self, other_branch)
2603- elif relation == 'a_descends_from_b':
2604+ elif relation == "a_descends_from_b":
2605 return False
2606 else:
2607 raise AssertionError(f"invalid relation: {relation!r}")
2608@@ -1377,12 +1464,12 @@
2609 """
2610 heads = graph.heads([revision_a, revision_b])
2611 if heads == {revision_b}:
2612- return 'b_descends_from_a'
2613+ return "b_descends_from_a"
2614 elif heads == {revision_a, revision_b}:
2615 # These branches have diverged
2616- return 'diverged'
2617+ return "diverged"
2618 elif heads == {revision_a}:
2619- return 'a_descends_from_b'
2620+ return "a_descends_from_b"
2621 else:
2622 raise AssertionError(f"invalid heads: {heads!r}")
2623
2624@@ -1399,7 +1486,7 @@
2625 # if_present_fetch are the tags.
2626 must_fetch = {self.last_revision()}
2627 if_present_fetch = set()
2628- if self.get_config_stack().get('branch.fetch_tags'):
2629+ if self.get_config_stack().get("branch.fetch_tags"):
2630 try:
2631 if_present_fetch = set(self.tags.get_reverse_tag_dict())
2632 except errors.TagsNotSupported:
2633@@ -1414,6 +1501,7 @@
2634 Returns: An in-memory MutableTree instance
2635 """
2636 from . import memorytree
2637+
2638 return memorytree.MemoryTree.create_on_branch(self)
2639
2640
2641@@ -1475,15 +1563,16 @@
2642 raise NotImplementedError(self.get_format_description)
2643
2644 def _run_post_branch_init_hooks(self, controldir, name, branch):
2645- hooks = Branch.hooks['post_branch_init']
2646+ hooks = Branch.hooks["post_branch_init"]
2647 if not hooks:
2648 return
2649 params = BranchInitHookParams(self, controldir, name, branch)
2650 for hook in hooks:
2651 hook(params)
2652
2653- def initialize(self, controldir, name=None, repository=None,
2654- append_revisions_only=None):
2655+ def initialize(
2656+ self, controldir, name=None, repository=None, append_revisions_only=None
2657+ ):
2658 """Create a branch of this format in controldir.
2659
2660 Args:
2661@@ -1516,6 +1605,7 @@
2662 on a RemoteBranch.
2663 """
2664 from .tag import DisabledTags
2665+
2666 return DisabledTags(branch)
2667
2668 def network_name(self):
2669@@ -1528,8 +1618,15 @@
2670 """
2671 raise NotImplementedError(self.network_name)
2672
2673- def open(self, controldir, name=None, _found=False, ignore_fallbacks=False,
2674- found_repository=None, possible_transports=None):
2675+ def open(
2676+ self,
2677+ controldir,
2678+ name=None,
2679+ _found=False,
2680+ ignore_fallbacks=False,
2681+ found_repository=None,
2682+ possible_transports=None,
2683+ ):
2684 """Return the branch object for controldir.
2685
2686 Args:
2687@@ -1595,21 +1692,27 @@
2688 """
2689 Hooks.__init__(self, "breezy.branch", "Branch.hooks")
2690 self.add_hook(
2691- 'open',
2692+ "open",
2693 "Called with the Branch object that has been opened after a "
2694- "branch is opened.", (1, 8))
2695+ "branch is opened.",
2696+ (1, 8),
2697+ )
2698 self.add_hook(
2699- 'post_push',
2700+ "post_push",
2701 "Called after a push operation completes. post_push is called "
2702 "with a breezy.branch.BranchPushResult object and only runs in "
2703- "the bzr client.", (0, 15))
2704+ "the bzr client.",
2705+ (0, 15),
2706+ )
2707 self.add_hook(
2708- 'post_pull',
2709+ "post_pull",
2710 "Called after a pull operation completes. post_pull is called "
2711 "with a breezy.branch.PullResult object and only runs in the "
2712- "bzr client.", (0, 15))
2713+ "bzr client.",
2714+ (0, 15),
2715+ )
2716 self.add_hook(
2717- 'pre_commit',
2718+ "pre_commit",
2719 "Called after a commit is calculated but before it is "
2720 "completed. pre_commit is called with (local, master, old_revno, "
2721 "old_revid, future_revno, future_revid, tree_delta, future_tree"
2722@@ -1618,34 +1721,44 @@
2723 "basis revision. hooks MUST NOT modify this delta. "
2724 " future_tree is an in-memory tree obtained from "
2725 "CommitBuilder.revision_tree() and hooks MUST NOT modify this "
2726- "tree.", (0, 91))
2727+ "tree.",
2728+ (0, 91),
2729+ )
2730 self.add_hook(
2731- 'post_commit',
2732+ "post_commit",
2733 "Called in the bzr client after a commit has completed. "
2734 "post_commit is called with (local, master, old_revno, old_revid, "
2735 "new_revno, new_revid). old_revid is NULL_REVISION for the first "
2736- "commit to a branch.", (0, 15))
2737+ "commit to a branch.",
2738+ (0, 15),
2739+ )
2740 self.add_hook(
2741- 'post_uncommit',
2742+ "post_uncommit",
2743 "Called in the bzr client after an uncommit completes. "
2744 "post_uncommit is called with (local, master, old_revno, "
2745 "old_revid, new_revno, new_revid) where local is the local branch "
2746 "or None, master is the target branch, and an empty branch "
2747- "receives new_revno of 0, new_revid of None.", (0, 15))
2748+ "receives new_revno of 0, new_revid of None.",
2749+ (0, 15),
2750+ )
2751 self.add_hook(
2752- 'pre_change_branch_tip',
2753+ "pre_change_branch_tip",
2754 "Called in bzr client and server before a change to the tip of a "
2755 "branch is made. pre_change_branch_tip is called with a "
2756 "breezy.branch.ChangeBranchTipParams. Note that push, pull, "
2757- "commit, uncommit will all trigger this hook.", (1, 6))
2758+ "commit, uncommit will all trigger this hook.",
2759+ (1, 6),
2760+ )
2761 self.add_hook(
2762- 'post_change_branch_tip',
2763+ "post_change_branch_tip",
2764 "Called in bzr client and server after a change to the tip of a "
2765 "branch is made. post_change_branch_tip is called with a "
2766 "breezy.branch.ChangeBranchTipParams. Note that push, pull, "
2767- "commit, uncommit will all trigger this hook.", (1, 4))
2768+ "commit, uncommit will all trigger this hook.",
2769+ (1, 4),
2770+ )
2771 self.add_hook(
2772- 'transform_fallback_location',
2773+ "transform_fallback_location",
2774 "Called when a stacked branch is activating its fallback "
2775 "locations. transform_fallback_location is called with (branch, "
2776 "url), and should return a new url. Returning the same url "
2777@@ -1656,26 +1769,33 @@
2778 "fallback locations have not been activated. When there are "
2779 "multiple hooks installed for transform_fallback_location, "
2780 "all are called with the url returned from the previous hook."
2781- "The order is however undefined.", (1, 9))
2782+ "The order is however undefined.",
2783+ (1, 9),
2784+ )
2785 self.add_hook(
2786- 'automatic_tag_name',
2787+ "automatic_tag_name",
2788 "Called to determine an automatic tag name for a revision. "
2789 "automatic_tag_name is called with (branch, revision_id) and "
2790 "should return a tag name or None if no tag name could be "
2791 "determined. The first non-None tag name returned will be used.",
2792- (2, 2))
2793+ (2, 2),
2794+ )
2795 self.add_hook(
2796- 'post_branch_init',
2797+ "post_branch_init",
2798 "Called after new branch initialization completes. "
2799 "post_branch_init is called with a "
2800 "breezy.branch.BranchInitHookParams. "
2801 "Note that init, branch and checkout (both heavyweight and "
2802- "lightweight) will all trigger this hook.", (2, 2))
2803+ "lightweight) will all trigger this hook.",
2804+ (2, 2),
2805+ )
2806 self.add_hook(
2807- 'post_switch',
2808+ "post_switch",
2809 "Called after a checkout switches branch. "
2810 "post_switch is called with a "
2811- "breezy.branch.SwitchHookParams.", (2, 2))
2812+ "breezy.branch.SwitchHookParams.",
2813+ (2, 2),
2814+ )
2815
2816
2817 # install the default hooks into the Branch class.
2818@@ -1718,8 +1838,13 @@
2819
2820 def __repr__(self):
2821 return "<{} of {} from ({}, {}) to ({}, {})>".format(
2822- self.__class__.__name__, self.branch,
2823- self.old_revno, self.old_revid, self.new_revno, self.new_revid)
2824+ self.__class__.__name__,
2825+ self.branch,
2826+ self.old_revno,
2827+ self.old_revid,
2828+ self.new_revno,
2829+ self.new_revid,
2830+ )
2831
2832
2833 class BranchInitHookParams:
2834@@ -1795,8 +1920,8 @@
2835
2836 def __repr__(self):
2837 return "<{} for {} to ({}, {})>".format(
2838- self.__class__.__name__, self.control_dir, self.to_branch,
2839- self.revision_id)
2840+ self.__class__.__name__, self.control_dir, self.to_branch, self.revision_id
2841+ )
2842
2843
2844 class BranchFormatRegistry(ControlComponentFormatRegistry):
2845@@ -1809,8 +1934,7 @@
2846
2847 def get_default(self):
2848 """Return the current default format."""
2849- if (self._default_format_key is not None
2850- and self._default_format is None):
2851+ if self._default_format_key is not None and self._default_format is None:
2852 self._default_format = self.get(self._default_format_key)
2853 return self._default_format
2854
2855@@ -1854,13 +1978,12 @@
2856
2857
2858 class _Result:
2859-
2860 def _show_tag_conficts(self, to_file):
2861- if not getattr(self, 'tag_conflicts', None):
2862+ if not getattr(self, "tag_conflicts", None):
2863 return
2864- to_file.write('Conflicting tags:\n')
2865+ to_file.write("Conflicting tags:\n")
2866 for name, _value1, _value2 in self.tag_conflicts:
2867- to_file.write(f' {name}\n')
2868+ to_file.write(f" {name}\n")
2869
2870
2871 class PullResult(_Result):
2872@@ -1896,14 +2019,14 @@
2873 tag_updates = getattr(self, "tag_updates", None)
2874 if not is_quiet():
2875 if self.old_revid != self.new_revid:
2876- to_file.write('Now on revision %d.\n' % self.new_revno)
2877+ to_file.write("Now on revision %d.\n" % self.new_revno)
2878 if tag_updates:
2879- to_file.write(f'{len(tag_updates)} tag(s) updated.\n')
2880+ to_file.write(f"{len(tag_updates)} tag(s) updated.\n")
2881 if self.old_revid == self.new_revid and not tag_updates:
2882 if not tag_conflicts:
2883- to_file.write('No revisions or tags to pull.\n')
2884+ to_file.write("No revisions or tags to pull.\n")
2885 else:
2886- to_file.write('No revisions to pull.\n')
2887+ to_file.write("No revisions to pull.\n")
2888 self._show_tag_conficts(to_file)
2889
2890
2891@@ -1948,19 +2071,22 @@
2892 if not is_quiet():
2893 if self.old_revid != self.new_revid:
2894 if self.new_revno is not None:
2895- note(gettext('Pushed up to revision %d.'),
2896- self.new_revno)
2897+ note(gettext("Pushed up to revision %d."), self.new_revno)
2898 else:
2899- note(gettext('Pushed up to revision id %s.'),
2900- self.new_revid.decode('utf-8'))
2901+ note(
2902+ gettext("Pushed up to revision id %s."),
2903+ self.new_revid.decode("utf-8"),
2904+ )
2905 if tag_updates:
2906- note(ngettext('%d tag updated.', '%d tags updated.',
2907- len(tag_updates)) % len(tag_updates))
2908+ note(
2909+ ngettext("%d tag updated.", "%d tags updated.", len(tag_updates))
2910+ % len(tag_updates)
2911+ )
2912 if self.old_revid == self.new_revid and not tag_updates:
2913 if not tag_conflicts:
2914- note(gettext('No new revisions or tags to push.'))
2915+ note(gettext("No new revisions or tags to push."))
2916 else:
2917- note(gettext('No new revisions to push.'))
2918+ note(gettext("No new revisions to push."))
2919 self._show_tag_conficts(to_file)
2920
2921
2922@@ -1982,10 +2108,14 @@
2923 if any.
2924 """
2925 from .i18n import gettext
2926- note(gettext('checked branch {0} format {1}').format(
2927- self.branch.user_url, self.branch._format))
2928+
2929+ note(
2930+ gettext("checked branch {0} format {1}").format(
2931+ self.branch.user_url, self.branch._format
2932+ )
2933+ )
2934 for error in self.errors:
2935- note(gettext('found error:%s'), error)
2936+ note(gettext("found error:%s"), error)
2937
2938
2939 class InterBranch(InterObject[Branch]):
2940@@ -2009,10 +2139,14 @@
2941 """
2942 raise NotImplementedError(klass._get_branch_formats_to_test)
2943
2944- def pull(self, overwrite: bool = False,
2945- stop_revision: Optional[RevisionID] = None,
2946- possible_transports: Optional[List[Transport]] = None,
2947- local: bool = False, tag_selector=None) -> PullResult:
2948+ def pull(
2949+ self,
2950+ overwrite: bool = False,
2951+ stop_revision: Optional[RevisionID] = None,
2952+ possible_transports: Optional[List[Transport]] = None,
2953+ local: bool = False,
2954+ tag_selector=None,
2955+ ) -> PullResult:
2956 """Mirror source into target branch.
2957
2958 The target branch is considered to be 'local', having low latency.
2959@@ -2021,9 +2155,14 @@
2960 """
2961 raise NotImplementedError(self.pull)
2962
2963- def push(self, overwrite: bool = False, stop_revision: Optional[RevisionID] = None,
2964- lossy: bool = False, _override_hook_source_branch: Optional[Branch] = None,
2965- tag_selector=None):
2966+ def push(
2967+ self,
2968+ overwrite: bool = False,
2969+ stop_revision: Optional[RevisionID] = None,
2970+ lossy: bool = False,
2971+ _override_hook_source_branch: Optional[Branch] = None,
2972+ tag_selector=None,
2973+ ):
2974 """Mirror the source branch into the target branch.
2975
2976 The source branch is considered to be 'local', having low latency.
2977@@ -2042,9 +2181,12 @@
2978 """
2979 raise NotImplementedError(self.copy_content_into)
2980
2981- def fetch(self, stop_revision: Optional[RevisionID] = None,
2982- limit: Optional[int] = None,
2983- lossy: bool = False) -> repository.FetchResult:
2984+ def fetch(
2985+ self,
2986+ stop_revision: Optional[RevisionID] = None,
2987+ limit: Optional[int] = None,
2988+ lossy: bool = False,
2989+ ) -> repository.FetchResult:
2990 """Fetch revisions.
2991
2992 Args:
2993@@ -2088,6 +2230,7 @@
2994 @classmethod
2995 def unwrap_format(klass, format):
2996 from .bzr.remote import RemoteBranchFormat
2997+
2998 if isinstance(format, RemoteBranchFormat):
2999 format._ensure_real()
3000 return format._custom_format
3001@@ -2105,7 +2248,7 @@
3002 try:
3003 parent = self.source.get_parent()
3004 except errors.InaccessibleParent as e:
3005- mutter('parent was not accessible to copy: %s', str(e))
3006+ mutter("parent was not accessible to copy: %s", str(e))
3007 else:
3008 if parent:
3009 self.target.set_parent(parent)
3010@@ -2116,23 +2259,21 @@
3011 if self.target.base == self.source.base:
3012 return (0, [])
3013 from .bzr.fetch import FetchSpecFactory, TargetRepoKinds
3014+
3015 with self.source.lock_read(), self.target.lock_write():
3016 fetch_spec_factory = FetchSpecFactory()
3017 fetch_spec_factory.source_branch = self.source
3018 fetch_spec_factory.source_branch_stop_revision_id = stop_revision
3019 fetch_spec_factory.source_repo = self.source.repository
3020 fetch_spec_factory.target_repo = self.target.repository
3021- fetch_spec_factory.target_repo_kind = (
3022- TargetRepoKinds.PREEXISTING)
3023+ fetch_spec_factory.target_repo_kind = TargetRepoKinds.PREEXISTING
3024 fetch_spec_factory.limit = limit
3025 fetch_spec = fetch_spec_factory.make_fetch_spec()
3026 return self.target.repository.fetch(
3027- self.source.repository,
3028- lossy=lossy,
3029- fetch_spec=fetch_spec)
3030+ self.source.repository, lossy=lossy, fetch_spec=fetch_spec
3031+ )
3032
3033- def _update_revisions(self, stop_revision=None, overwrite=False,
3034- graph=None):
3035+ def _update_revisions(self, stop_revision=None, overwrite=False, graph=None):
3036 with self.source.lock_read(), self.target.lock_write():
3037 other_revno, other_last_revision = self.source.last_revision_info()
3038 stop_revno = None # unknown
3039@@ -2156,24 +2297,34 @@
3040 if graph is None:
3041 graph = self.target.repository.get_graph()
3042 if self.target._check_if_descendant_or_diverged(
3043- stop_revision, last_rev, graph, self.source):
3044+ stop_revision, last_rev, graph, self.source
3045+ ):
3046 # stop_revision is a descendant of last_rev, but we aren't
3047 # overwriting, so we're done.
3048 return
3049 if stop_revno is None:
3050 if graph is None:
3051 graph = self.target.repository.get_graph()
3052- this_revno, this_last_revision = \
3053- self.target.last_revision_info()
3054+ this_revno, this_last_revision = self.target.last_revision_info()
3055 stop_revno = graph.find_distance_to_null(
3056- stop_revision, [(other_last_revision, other_revno),
3057- (this_last_revision, this_revno)])
3058+ stop_revision,
3059+ [
3060+ (other_last_revision, other_revno),
3061+ (this_last_revision, this_revno),
3062+ ],
3063+ )
3064 self.target.set_last_revision_info(stop_revno, stop_revision)
3065
3066- def pull(self, overwrite=False, stop_revision=None,
3067- possible_transports=None, run_hooks=True,
3068- _override_hook_target=None, local=False,
3069- tag_selector=None):
3070+ def pull(
3071+ self,
3072+ overwrite=False,
3073+ stop_revision=None,
3074+ possible_transports=None,
3075+ run_hooks=True,
3076+ _override_hook_target=None,
3077+ local=False,
3078+ tag_selector=None,
3079+ ):
3080 """Pull from source into self, updating my master if any.
3081
3082 Args:
3083@@ -2194,29 +2345,40 @@
3084 normalized = urlutils.normalize_url(bound_location)
3085 try:
3086 relpath = self.source.user_transport.relpath(normalized)
3087- source_is_master = (relpath == '')
3088+ source_is_master = relpath == ""
3089 except (errors.PathNotChild, urlutils.InvalidURL):
3090 source_is_master = False
3091 if not local and bound_location and not source_is_master:
3092 # not pulling from master, so we need to update master.
3093- master_branch = self.target.get_master_branch(
3094- possible_transports)
3095+ master_branch = self.target.get_master_branch(possible_transports)
3096 exit_stack.enter_context(master_branch.lock_write())
3097 if master_branch:
3098 # pull from source into master.
3099 master_branch.pull(
3100- self.source, overwrite=overwrite, stop_revision=stop_revision,
3101+ self.source,
3102+ overwrite=overwrite,
3103+ stop_revision=stop_revision,
3104 run_hooks=False,
3105- tag_selector=tag_selector)
3106+ tag_selector=tag_selector,
3107+ )
3108 return self._pull(
3109- overwrite, stop_revision, _hook_master=master_branch,
3110+ overwrite,
3111+ stop_revision,
3112+ _hook_master=master_branch,
3113 run_hooks=run_hooks,
3114 _override_hook_target=_override_hook_target,
3115 merge_tags_to_master=not source_is_master,
3116- tag_selector=tag_selector)
3117+ tag_selector=tag_selector,
3118+ )
3119
3120- def push(self, overwrite=False, stop_revision=None, lossy=False,
3121- _override_hook_source_branch=None, tag_selector=None):
3122+ def push(
3123+ self,
3124+ overwrite=False,
3125+ stop_revision=None,
3126+ lossy=False,
3127+ _override_hook_source_branch=None,
3128+ tag_selector=None,
3129+ ):
3130 """See InterBranch.push.
3131
3132 This is the basic concrete implementation of push()
3133@@ -2235,7 +2397,7 @@
3134 def _run_hooks():
3135 if _override_hook_source_branch:
3136 result.source_branch = _override_hook_source_branch
3137- for hook in Branch.hooks['post_push']:
3138+ for hook in Branch.hooks["post_push"]:
3139 hook(result)
3140
3141 with self.source.lock_read(), self.target.lock_write():
3142@@ -2250,12 +2412,14 @@
3143 # push into the master from the source branch.
3144 master_inter = InterBranch.get(self.source, master_branch)
3145 master_inter._basic_push(
3146- overwrite, stop_revision, tag_selector=tag_selector)
3147+ overwrite, stop_revision, tag_selector=tag_selector
3148+ )
3149 # and push into the target branch from the source. Note
3150 # that we push from the source branch again, because it's
3151 # considered the highest bandwidth repository.
3152 result = self._basic_push(
3153- overwrite, stop_revision, tag_selector=tag_selector)
3154+ overwrite, stop_revision, tag_selector=tag_selector
3155+ )
3156 result.master_branch = master_branch
3157 result.local_branch = self.target
3158 _run_hooks()
3159@@ -2263,7 +2427,8 @@
3160 master_branch = None
3161 # no master branch
3162 result = self._basic_push(
3163- overwrite, stop_revision, tag_selector=tag_selector)
3164+ overwrite, stop_revision, tag_selector=tag_selector
3165+ )
3166 # TODO: Why set master_branch and local_branch if there's no
3167 # binding? Maybe cleaner to just leave them unset? -- mbp
3168 # 20070504
3169@@ -2287,19 +2452,28 @@
3170 # the target.
3171 graph = self.source.repository.get_graph(self.target.repository)
3172 self._update_revisions(
3173- stop_revision, overwrite=("history" in overwrite), graph=graph)
3174+ stop_revision, overwrite=("history" in overwrite), graph=graph
3175+ )
3176 if self.source._push_should_merge_tags():
3177- result.tag_updates, result.tag_conflicts = (
3178- self.source.tags.merge_to(
3179- self.target.tags, "tags" in overwrite, selector=tag_selector))
3180+ result.tag_updates, result.tag_conflicts = self.source.tags.merge_to(
3181+ self.target.tags, "tags" in overwrite, selector=tag_selector
3182+ )
3183 self.update_references()
3184 result.new_revno, result.new_revid = self.target.last_revision_info()
3185 return result
3186
3187- def _pull(self, overwrite=False, stop_revision=None,
3188- possible_transports=None, _hook_master=None, run_hooks=True,
3189- _override_hook_target=None, local=False,
3190- merge_tags_to_master=True, tag_selector=None):
3191+ def _pull(
3192+ self,
3193+ overwrite=False,
3194+ stop_revision=None,
3195+ possible_transports=None,
3196+ _hook_master=None,
3197+ run_hooks=True,
3198+ _override_hook_target=None,
3199+ local=False,
3200+ merge_tags_to_master=True,
3201+ tag_selector=None,
3202+ ):
3203 """See Branch.pull.
3204
3205 This function is the core worker, used by GenericInterBranch.pull to
3206@@ -2333,22 +2507,22 @@
3207 # TODO: Branch formats should have a flag that indicates
3208 # that revno's are expensive, and pull() should honor that flag.
3209 # -- JRV20090506
3210- result.old_revno, result.old_revid = \
3211- self.target.last_revision_info()
3212+ result.old_revno, result.old_revid = self.target.last_revision_info()
3213 overwrite = _fix_overwrite_type(overwrite)
3214 self._update_revisions(
3215- stop_revision, overwrite=("history" in overwrite), graph=graph)
3216+ stop_revision, overwrite=("history" in overwrite), graph=graph
3217+ )
3218 # TODO: The old revid should be specified when merging tags,
3219 # so a tags implementation that versions tags can only
3220 # pull in the most recent changes. -- JRV20090506
3221- result.tag_updates, result.tag_conflicts = (
3222- self.source.tags.merge_to(
3223- self.target.tags, "tags" in overwrite,
3224- ignore_master=not merge_tags_to_master,
3225- selector=tag_selector))
3226+ result.tag_updates, result.tag_conflicts = self.source.tags.merge_to(
3227+ self.target.tags,
3228+ "tags" in overwrite,
3229+ ignore_master=not merge_tags_to_master,
3230+ selector=tag_selector,
3231+ )
3232 self.update_references()
3233- result.new_revno, result.new_revid = (
3234- self.target.last_revision_info())
3235+ result.new_revno, result.new_revid = self.target.last_revision_info()
3236 if _hook_master:
3237 result.master_branch = _hook_master
3238 result.local_branch = result.target_branch
3239@@ -2356,12 +2530,12 @@
3240 result.master_branch = result.target_branch
3241 result.local_branch = None
3242 if run_hooks:
3243- for hook in Branch.hooks['post_pull']:
3244+ for hook in Branch.hooks["post_pull"]:
3245 hook(result)
3246 return result
3247
3248 def update_references(self):
3249- if not getattr(self.source._format, 'supports_reference_locations', False):
3250+ if not getattr(self.source._format, "supports_reference_locations", False):
3251 return
3252 reference_dict = self.source._get_all_reference_info()
3253 if len(reference_dict) == 0:
3254@@ -2371,13 +2545,13 @@
3255 target_reference_dict = self.target._get_all_reference_info()
3256 for tree_path, (branch_location, file_id) in reference_dict.items():
3257 try:
3258- branch_location = urlutils.rebase_url(branch_location,
3259- old_base, new_base)
3260+ branch_location = urlutils.rebase_url(
3261+ branch_location, old_base, new_base
3262+ )
3263 except urlutils.InvalidRebaseURLs:
3264 # Fall back to absolute URL
3265 branch_location = urlutils.join(old_base, branch_location)
3266- target_reference_dict.setdefault(
3267- tree_path, (branch_location, file_id))
3268+ target_reference_dict.setdefault(tree_path, (branch_location, file_id))
3269 self.target._set_all_reference_info(target_reference_dict)
3270
3271
3272
3273=== modified file 'breezy/branchbuilder.py'
3274--- breezy/branchbuilder.py 2023-05-03 17:01:16 +0000
3275+++ breezy/branchbuilder.py 2023-11-07 18:55:36 +0000
3276@@ -66,25 +66,27 @@
3277 """
3278 if branch is not None:
3279 if format is not None:
3280- raise AssertionError(
3281- "branch and format kwargs are mutually exclusive")
3282+ raise AssertionError("branch and format kwargs are mutually exclusive")
3283 if transport is not None:
3284 raise AssertionError(
3285- "branch and transport kwargs are mutually exclusive")
3286+ "branch and transport kwargs are mutually exclusive"
3287+ )
3288 self._branch = branch
3289 else:
3290- if not transport.has('.'):
3291- transport.mkdir('.')
3292+ if not transport.has("."):
3293+ transport.mkdir(".")
3294 if format is None:
3295- format = 'default'
3296+ format = "default"
3297 if isinstance(format, str):
3298 format = controldir.format_registry.make_controldir(format)
3299 self._branch = controldir.ControlDir.create_branch_convenience(
3300- transport.base, format=format, force_new_tree=False)
3301+ transport.base, format=format, force_new_tree=False
3302+ )
3303 self._tree = None
3304
3305- def build_commit(self, parent_ids=None, allow_leftmost_as_ghost=False,
3306- **commit_kwargs):
3307+ def build_commit(
3308+ self, parent_ids=None, allow_leftmost_as_ghost=False, **commit_kwargs
3309+ ):
3310 """Build a commit on the branch.
3311
3312 This makes a commit with no real file content for when you only want
3313@@ -100,25 +102,26 @@
3314 base_id = parent_ids[0]
3315 if base_id != self._branch.last_revision():
3316 self._move_branch_pointer(
3317- base_id, allow_leftmost_as_ghost=allow_leftmost_as_ghost)
3318+ base_id, allow_leftmost_as_ghost=allow_leftmost_as_ghost
3319+ )
3320 tree = self._branch.create_memorytree()
3321 with tree.lock_write():
3322 if parent_ids is not None:
3323 tree.set_parent_ids(
3324- parent_ids,
3325- allow_leftmost_as_ghost=allow_leftmost_as_ghost)
3326- tree.add('')
3327+ parent_ids, allow_leftmost_as_ghost=allow_leftmost_as_ghost
3328+ )
3329+ tree.add("")
3330 return self._do_commit(tree, **commit_kwargs)
3331
3332 def _do_commit(self, tree, message=None, message_callback=None, **kwargs):
3333 reporter = commit.NullCommitReporter()
3334 if message is None and message_callback is None:
3335- message = 'commit %d' % (self._branch.revno() + 1,)
3336- return tree.commit(message, message_callback=message_callback,
3337- reporter=reporter, **kwargs)
3338+ message = "commit %d" % (self._branch.revno() + 1,)
3339+ return tree.commit(
3340+ message, message_callback=message_callback, reporter=reporter, **kwargs
3341+ )
3342
3343- def _move_branch_pointer(self, new_revision_id,
3344- allow_leftmost_as_ghost=False):
3345+ def _move_branch_pointer(self, new_revision_id, allow_leftmost_as_ghost=False):
3346 """Point self._branch to a different revision id."""
3347 with self._branch.lock_write():
3348 # We don't seem to have a simple set_last_revision(), so we
3349@@ -127,7 +130,8 @@
3350 try:
3351 g = self._branch.repository.get_graph()
3352 new_revno = g.find_distance_to_null(
3353- new_revision_id, [(cur_revision_id, cur_revno)])
3354+ new_revision_id, [(cur_revision_id, cur_revno)]
3355+ )
3356 self._branch.set_last_revision_info(new_revno, new_revision_id)
3357 except errors.GhostRevisionsHaveNoRevno:
3358 if not allow_leftmost_as_ghost:
3359@@ -153,8 +157,9 @@
3360 Make sure to call 'finish_series' when you are done.
3361 """
3362 if self._tree is not None:
3363- raise AssertionError('You cannot start a new series while a'
3364- ' series is already going.')
3365+ raise AssertionError(
3366+ "You cannot start a new series while a" " series is already going."
3367+ )
3368 self._tree = self._branch.create_memorytree()
3369 self._tree.lock_write()
3370
3371@@ -163,9 +168,18 @@
3372 self._tree.unlock()
3373 self._tree = None
3374
3375- def build_snapshot(self, parent_ids, actions, message=None, timestamp=None,
3376- allow_leftmost_as_ghost=False, committer=None,
3377- timezone=None, message_callback=None, revision_id=None):
3378+ def build_snapshot(
3379+ self,
3380+ parent_ids,
3381+ actions,
3382+ message=None,
3383+ timestamp=None,
3384+ allow_leftmost_as_ghost=False,
3385+ committer=None,
3386+ timezone=None,
3387+ message_callback=None,
3388+ revision_id=None,
3389+ ):
3390 """Build a commit, shaped in a specific way.
3391
3392 Most of the actions are self-explanatory. 'flush' is special action to
3393@@ -201,7 +215,8 @@
3394 base_id = parent_ids[0]
3395 if base_id != self._branch.last_revision():
3396 self._move_branch_pointer(
3397- base_id, allow_leftmost_as_ghost=allow_leftmost_as_ghost)
3398+ base_id, allow_leftmost_as_ghost=allow_leftmost_as_ghost
3399+ )
3400
3401 if self._tree is not None:
3402 tree = self._tree
3403@@ -210,17 +225,17 @@
3404 with tree.lock_write():
3405 if parent_ids is not None:
3406 tree.set_parent_ids(
3407- parent_ids,
3408- allow_leftmost_as_ghost=allow_leftmost_as_ghost)
3409+ parent_ids, allow_leftmost_as_ghost=allow_leftmost_as_ghost
3410+ )
3411 # Unfortunately, MemoryTree.add(directory) just creates an
3412 # inventory entry. And the only public function to create a
3413 # directory is MemoryTree.mkdir() which creates the directory, but
3414 # also always adds it. So we have to use a multi-pass setup.
3415 pending = _PendingActions()
3416 for action, info in actions:
3417- if action == 'add':
3418+ if action == "add":
3419 path, file_id, kind, content = info
3420- if kind == 'directory':
3421+ if kind == "directory":
3422 pending.to_add_directories.append((path, file_id))
3423 else:
3424 pending.to_add_files.append(path)
3425@@ -228,38 +243,42 @@
3426 pending.to_add_kinds.append(kind)
3427 if content is not None:
3428 pending.new_contents[path] = content
3429- elif action == 'modify':
3430+ elif action == "modify":
3431 path, content = info
3432 pending.new_contents[path] = content
3433- elif action == 'unversion':
3434+ elif action == "unversion":
3435 pending.to_unversion_paths.add(info)
3436- elif action == 'rename':
3437+ elif action == "rename":
3438 from_relpath, to_relpath = info
3439 pending.to_rename.append((from_relpath, to_relpath))
3440- elif action == 'flush':
3441+ elif action == "flush":
3442 self._flush_pending(tree, pending)
3443 pending = _PendingActions()
3444 else:
3445 raise ValueError(f'Unknown build action: "{action}"')
3446 self._flush_pending(tree, pending)
3447 return self._do_commit(
3448- tree, message=message, rev_id=revision_id,
3449- timestamp=timestamp, timezone=timezone, committer=committer,
3450- message_callback=message_callback)
3451+ tree,
3452+ message=message,
3453+ rev_id=revision_id,
3454+ timestamp=timestamp,
3455+ timezone=timezone,
3456+ committer=committer,
3457+ message_callback=message_callback,
3458+ )
3459
3460 def _flush_pending(self, tree, pending):
3461 """Flush the pending actions in 'pending', i.e. apply them to tree."""
3462 for path, file_id in pending.to_add_directories:
3463- if path == '':
3464- if tree.has_filename(path) \
3465- and path in pending.to_unversion_paths:
3466+ if path == "":
3467+ if tree.has_filename(path) and path in pending.to_unversion_paths:
3468 # We're overwriting this path, no need to unversion
3469 pending.to_unversion_paths.discard(path)
3470 # Special case, because the path already exists
3471 if file_id is not None:
3472- tree.add([path], ['directory'], ids=[file_id])
3473+ tree.add([path], ["directory"], ids=[file_id])
3474 else:
3475- tree.add([path], ['directory'])
3476+ tree.add([path], ["directory"])
3477 else:
3478 if file_id is not None:
3479 tree.mkdir(path, file_id)
3480@@ -270,8 +289,9 @@
3481 if pending.to_unversion_paths:
3482 tree.unversion(pending.to_unversion_paths)
3483 if tree.supports_file_ids:
3484- tree.add(pending.to_add_files,
3485- pending.to_add_kinds, pending.to_add_file_ids)
3486+ tree.add(
3487+ pending.to_add_files, pending.to_add_kinds, pending.to_add_file_ids
3488+ )
3489 else:
3490 tree.add(pending.to_add_files, pending.to_add_kinds)
3491 for path, content in pending.new_contents.items():
3492
3493=== modified file 'breezy/breakin.py'
3494--- breezy/breakin.py 2023-11-01 20:32:05 +0000
3495+++ breezy/breakin.py 2023-11-07 18:55:36 +0000
3496@@ -25,9 +25,12 @@
3497 def _debug(signal_number, interrupted_frame):
3498 import pdb
3499 import sys
3500- sys.stderr.write(f"** {_breakin_signal_name} received, entering debugger\n"
3501- "** Type 'c' to continue or 'q' to stop the process\n"
3502- f"** Or {_breakin_signal_name} again to quit (and possibly dump core)\n")
3503+
3504+ sys.stderr.write(
3505+ f"** {_breakin_signal_name} received, entering debugger\n"
3506+ "** Type 'c' to continue or 'q' to stop the process\n"
3507+ f"** Or {_breakin_signal_name} again to quit (and possibly dump core)\n"
3508+ )
3509 # It seems that on Windows, when sys.stderr is to a PIPE, then we need to
3510 # flush. Not sure why it is buffered, but that seems to be the case.
3511 sys.stderr.flush()
3512@@ -51,14 +54,14 @@
3513 # and other platforms defined SIGQUIT. There doesn't seem to be a
3514 # platform that defines both.
3515 # -- jam 2009-07-30
3516- sigquit = getattr(signal, 'SIGQUIT', None)
3517- sigbreak = getattr(signal, 'SIGBREAK', None)
3518+ sigquit = getattr(signal, "SIGQUIT", None)
3519+ sigbreak = getattr(signal, "SIGBREAK", None)
3520 if sigquit is not None:
3521 _breakin_signal_number = sigquit
3522- _breakin_signal_name = 'SIGQUIT'
3523+ _breakin_signal_name = "SIGQUIT"
3524 elif sigbreak is not None:
3525 _breakin_signal_number = sigbreak
3526- _breakin_signal_name = 'SIGBREAK'
3527+ _breakin_signal_name = "SIGBREAK"
3528
3529 return _breakin_signal_number
3530
3531@@ -70,7 +73,7 @@
3532 hooked into SIGBREAK (C-Pause).
3533 """
3534 # when sigquit (C-\) or sigbreak (C-Pause) is received go into pdb
3535- if os.environ.get('BRZ_SIGQUIT_PDB', '1') == '0':
3536+ if os.environ.get("BRZ_SIGQUIT_PDB", "1") == "0":
3537 # User explicitly requested we don't support this
3538 return
3539 sig = determine_signal()
3540
3541=== modified file 'breezy/bugtracker.py'
3542--- breezy/bugtracker.py 2023-06-07 20:37:36 +0000
3543+++ breezy/bugtracker.py 2023-11-07 18:55:36 +0000
3544@@ -32,11 +32,11 @@
3545 """
3546
3547
3548-
3549 class MalformedBugIdentifier(errors.BzrError):
3550-
3551- _fmt = ('Did not understand bug identifier %(bug_id)s: %(reason)s. '
3552- 'See "brz help bugs" for more information on this feature.')
3553+ _fmt = (
3554+ "Did not understand bug identifier %(bug_id)s: %(reason)s. "
3555+ 'See "brz help bugs" for more information on this feature.'
3556+ )
3557
3558 def __init__(self, bug_id, reason):
3559 self.bug_id = bug_id
3560@@ -44,9 +44,9 @@
3561
3562
3563 class InvalidBugTrackerURL(errors.BzrError):
3564-
3565- _fmt = ("The URL for bug tracker \"%(abbreviation)s\" doesn't "
3566- "contain {id}: %(url)s")
3567+ _fmt = (
3568+ 'The URL for bug tracker "%(abbreviation)s" doesn\'t ' "contain {id}: %(url)s"
3569+ )
3570
3571 def __init__(self, abbreviation, url):
3572 self.abbreviation = abbreviation
3573@@ -54,9 +54,7 @@
3574
3575
3576 class UnknownBugTrackerAbbreviation(errors.BzrError):
3577-
3578- _fmt = ("Cannot find registered bug tracker called %(abbreviation)s "
3579- "on %(branch)s")
3580+ _fmt = "Cannot find registered bug tracker called %(abbreviation)s " "on %(branch)s"
3581
3582 def __init__(self, abbreviation, branch):
3583 self.abbreviation = abbreviation
3584@@ -64,15 +62,13 @@
3585
3586
3587 class InvalidLineInBugsProperty(errors.BzrError):
3588-
3589- _fmt = ("Invalid line in bugs property: '%(line)s'")
3590+ _fmt = "Invalid line in bugs property: '%(line)s'"
3591
3592 def __init__(self, line):
3593 self.line = line
3594
3595
3596 class InvalidBugUrl(errors.BzrError):
3597-
3598 _fmt = "Invalid bug URL: %(url)s"
3599
3600 def __init__(self, url):
3601@@ -80,8 +76,7 @@
3602
3603
3604 class InvalidBugStatus(errors.BzrError):
3605-
3606- _fmt = ("Invalid bug status: '%(status)s'")
3607+ _fmt = "Invalid bug status: '%(status)s'"
3608
3609 def __init__(self, status):
3610 self.status = status
3611@@ -109,8 +104,7 @@
3612 tracker = tracker_type.get(abbreviated_bugtracker_name, branch)
3613 if tracker is not None:
3614 return tracker
3615- raise UnknownBugTrackerAbbreviation(
3616- abbreviated_bugtracker_name, branch)
3617+ raise UnknownBugTrackerAbbreviation(abbreviated_bugtracker_name, branch)
3618
3619 def help_topic(self, topic):
3620 return _bugs_help
3621@@ -191,7 +185,7 @@
3622
3623 def check_bug_id(self, bug_id):
3624 try:
3625- (project, bug_id) = bug_id.rsplit('/', 1)
3626+ (project, bug_id) = bug_id.rsplit("/", 1)
3627 except ValueError as exc:
3628 raise MalformedBugIdentifier(bug_id, "Expected format: project/id") from exc
3629 try:
3630@@ -200,32 +194,35 @@
3631 raise MalformedBugIdentifier(bug_id, "Bug id must be an integer") from exc
3632
3633 def _get_bug_url(self, bug_id):
3634- (project, bug_id) = bug_id.rsplit('/', 1)
3635+ (project, bug_id) = bug_id.rsplit("/", 1)
3636 """Return the URL for bug_id."""
3637- if '{id}' not in self._base_url:
3638- raise InvalidBugTrackerURL(self.abbreviation, self._base_url)
3639- if '{project}' not in self._base_url:
3640- raise InvalidBugTrackerURL(self.abbreviation, self._base_url)
3641- return self._base_url.replace(
3642- '{project}', project).replace('{id}', str(bug_id))
3643-
3644-
3645-tracker_registry.register(
3646- 'launchpad', UniqueIntegerBugTracker('lp', 'https://launchpad.net/bugs/'))
3647-
3648-
3649-tracker_registry.register(
3650- 'debian', UniqueIntegerBugTracker('deb', 'http://bugs.debian.org/'))
3651-
3652-
3653-tracker_registry.register(
3654- 'gnome', UniqueIntegerBugTracker(
3655- 'gnome', 'http://bugzilla.gnome.org/show_bug.cgi?id='))
3656-
3657-
3658-tracker_registry.register(
3659- 'github', ProjectIntegerBugTracker(
3660- 'github', 'https://github.com/{project}/issues/{id}'))
3661+ if "{id}" not in self._base_url:
3662+ raise InvalidBugTrackerURL(self.abbreviation, self._base_url)
3663+ if "{project}" not in self._base_url:
3664+ raise InvalidBugTrackerURL(self.abbreviation, self._base_url)
3665+ return self._base_url.replace("{project}", project).replace("{id}", str(bug_id))
3666+
3667+
3668+tracker_registry.register(
3669+ "launchpad", UniqueIntegerBugTracker("lp", "https://launchpad.net/bugs/")
3670+)
3671+
3672+
3673+tracker_registry.register(
3674+ "debian", UniqueIntegerBugTracker("deb", "http://bugs.debian.org/")
3675+)
3676+
3677+
3678+tracker_registry.register(
3679+ "gnome",
3680+ UniqueIntegerBugTracker("gnome", "http://bugzilla.gnome.org/show_bug.cgi?id="),
3681+)
3682+
3683+
3684+tracker_registry.register(
3685+ "github",
3686+ ProjectIntegerBugTracker("github", "https://github.com/{project}/issues/{id}"),
3687+)
3688
3689
3690 class URLParametrizedBugTracker(BugTracker):
3691@@ -240,7 +237,8 @@
3692 def get(self, abbreviation, branch):
3693 config = branch.get_config()
3694 url = config.get_user_option(
3695- f"{self.type_name}_{abbreviation}_url", expand=False)
3696+ f"{self.type_name}_{abbreviation}_url", expand=False
3697+ )
3698 if url is None:
3699 return None
3700 self._base_url = url
3701@@ -255,8 +253,7 @@
3702 return urlutils.join(self._base_url, self._bug_area) + str(bug_id)
3703
3704
3705-class URLParametrizedIntegerBugTracker(IntegerBugTracker,
3706- URLParametrizedBugTracker):
3707+class URLParametrizedIntegerBugTracker(IntegerBugTracker, URLParametrizedBugTracker):
3708 """A type of bug tracker that only allows integer bug IDs.
3709
3710 This can be found on a variety of different sites, and thus needs to have
3711@@ -269,19 +266,18 @@
3712 """
3713
3714
3715-tracker_registry.register(
3716- 'trac', URLParametrizedIntegerBugTracker('trac', 'ticket/'))
3717+tracker_registry.register("trac", URLParametrizedIntegerBugTracker("trac", "ticket/"))
3718
3719 tracker_registry.register(
3720- 'bugzilla',
3721- URLParametrizedIntegerBugTracker('bugzilla', 'show_bug.cgi?id='))
3722+ "bugzilla", URLParametrizedIntegerBugTracker("bugzilla", "show_bug.cgi?id=")
3723+)
3724
3725
3726 class GenericBugTracker(URLParametrizedBugTracker):
3727 """Generic bug tracker specified by an URL template."""
3728
3729 def __init__(self):
3730- super().__init__('bugtracker', None)
3731+ super().__init__("bugtracker", None)
3732
3733 def get(self, abbreviation, branch):
3734 self._abbreviation = abbreviation
3735@@ -289,16 +285,16 @@
3736
3737 def _get_bug_url(self, bug_id):
3738 """Given a validated bug_id, return the bug's web page's URL."""
3739- if '{id}' not in self._base_url:
3740+ if "{id}" not in self._base_url:
3741 raise InvalidBugTrackerURL(self._abbreviation, self._base_url)
3742- return self._base_url.replace('{id}', str(bug_id))
3743-
3744-
3745-tracker_registry.register('generic', GenericBugTracker())
3746-
3747-
3748-FIXED = 'fixed'
3749-RELATED = 'related'
3750+ return self._base_url.replace("{id}", str(bug_id))
3751+
3752+
3753+tracker_registry.register("generic", GenericBugTracker())
3754+
3755+
3756+FIXED = "fixed"
3757+RELATED = "related"
3758
3759 ALLOWED_BUG_STATUSES = {FIXED, RELATED}
3760
3761@@ -312,11 +308,11 @@
3762 as part of a commit.
3763 """
3764 lines = []
3765- for (url, tag) in bug_urls:
3766- if ' ' in url:
3767+ for url, tag in bug_urls:
3768+ if " " in url:
3769 raise InvalidBugUrl(url)
3770- lines.append(f'{url} {tag}')
3771- return '\n'.join(lines)
3772+ lines.append(f"{url} {tag}")
3773+ return "\n".join(lines)
3774
3775
3776 def decode_bug_urls(bug_lines):
3777
3778=== modified file 'breezy/builtins.py'
3779--- breezy/builtins.py 2023-11-06 11:30:11 +0000
3780+++ breezy/builtins.py 2023-11-07 18:55:36 +0000
3781@@ -24,7 +24,9 @@
3782
3783 from . import controldir, errors, lazy_import, osutils, transport
3784
3785-lazy_import.lazy_import(globals(), """
3786+lazy_import.lazy_import(
3787+ globals(),
3788+ """
3789 import time
3790
3791 import breezy
3792@@ -46,7 +48,8 @@
3793 )
3794 from breezy.branch import Branch
3795 from breezy.i18n import gettext, ngettext
3796-""")
3797+""",
3798+)
3799
3800 from .commands import Command, builtin_command_registry, display_command
3801 from .option import ListOption, Option, RegistryOption, _parse_revision_str, custom_help
3802@@ -62,8 +65,7 @@
3803 return control_dir.root_transport.base
3804 if target is not None:
3805 return target
3806- this_branch = control_dir.open_branch(
3807- possible_transports=possible_transports)
3808+ this_branch = control_dir.open_branch(possible_transports=possible_transports)
3809 # This may be a heavy checkout, where we want the master branch
3810 master_location = this_branch.get_bound_location()
3811 if master_location is not None:
3812@@ -81,11 +83,13 @@
3813 """
3814 # This path is meant to be relative to the existing branch
3815 this_url = _get_branch_location(
3816- control_dir, possible_transports=possible_transports)
3817+ control_dir, possible_transports=possible_transports
3818+ )
3819 # Perhaps the target control dir supports colocated branches?
3820 try:
3821 root = controldir.ControlDir.open(
3822- this_url, possible_transports=possible_transports)
3823+ this_url, possible_transports=possible_transports
3824+ )
3825 except errors.NotBranchError:
3826 return (False, this_url)
3827 else:
3828@@ -95,9 +99,10 @@
3829 return (False, this_url)
3830 else:
3831 return (
3832- root._format.colocated_branches and
3833- control_dir.control_url == root.control_url,
3834- this_url)
3835+ root._format.colocated_branches
3836+ and control_dir.control_url == root.control_url,
3837+ this_url,
3838+ )
3839
3840
3841 def lookup_new_sibling_branch(control_dir, location, possible_transports=None):
3842@@ -108,15 +113,17 @@
3843 :return: Full location to the new branch
3844 """
3845 from .directory_service import directories
3846+
3847 location = directories.dereference(location)
3848- if '/' not in location and '\\' not in location:
3849+ if "/" not in location and "\\" not in location:
3850 (colocated, this_url) = _is_colocated(control_dir, possible_transports)
3851
3852 if colocated:
3853 return urlutils.join_segment_parameters(
3854- this_url, {"branch": urlutils.escape(location)})
3855+ this_url, {"branch": urlutils.escape(location)}
3856+ )
3857 else:
3858- return urlutils.join(this_url, '..', urlutils.escape(location))
3859+ return urlutils.join(this_url, "..", urlutils.escape(location))
3860 return location
3861
3862
3863@@ -131,12 +138,11 @@
3864 try:
3865 # Perhaps it's a colocated branch?
3866 return control_dir.open_branch(
3867- location, possible_transports=possible_transports)
3868+ location, possible_transports=possible_transports
3869+ )
3870 except (errors.NotBranchError, controldir.NoColocatedBranchSupport):
3871 this_url = _get_branch_location(control_dir)
3872- return Branch.open(
3873- urlutils.join(
3874- this_url, '..', urlutils.escape(location)))
3875+ return Branch.open(urlutils.join(this_url, "..", urlutils.escape(location)))
3876
3877
3878 def open_nearby_branch(near=None, location=None, possible_transports=None):
3879@@ -150,14 +156,11 @@
3880 if location is None:
3881 location = "."
3882 try:
3883- return Branch.open(
3884- location, possible_transports=possible_transports)
3885+ return Branch.open(location, possible_transports=possible_transports)
3886 except errors.NotBranchError:
3887 near = "."
3888- cdir = controldir.ControlDir.open(
3889- near, possible_transports=possible_transports)
3890- return open_sibling_branch(
3891- cdir, location, possible_transports=possible_transports)
3892+ cdir = controldir.ControlDir.open(near, possible_transports=possible_transports)
3893+ return open_sibling_branch(cdir, location, possible_transports=possible_transports)
3894
3895
3896 def iter_sibling_branches(control_dir, possible_transports=None):
3897@@ -172,8 +175,7 @@
3898 reference = None
3899 if reference is not None:
3900 try:
3901- ref_branch = Branch.open(
3902- reference, possible_transports=possible_transports)
3903+ ref_branch = Branch.open(reference, possible_transports=possible_transports)
3904 except errors.NotBranchError:
3905 ref_branch = None
3906 else:
3907@@ -186,8 +188,7 @@
3908 else:
3909 repo = ref_branch.controldir.find_repository()
3910 for branch in repo.find_branches(using=True):
3911- name = urlutils.relative_url(
3912- repo.user_url, branch.user_url).rstrip("/")
3913+ name = urlutils.relative_url(repo.user_url, branch.user_url).rstrip("/")
3914 yield name, branch
3915
3916
3917@@ -215,14 +216,13 @@
3918 file_list = file_list[:]
3919 file_list[0] = tree.abspath(relpath)
3920 else:
3921- tree = WorkingTree.open_containing('.')[0]
3922+ tree = WorkingTree.open_containing(".")[0]
3923 if tree.supports_views():
3924 view_files = tree.views.lookup_view()
3925 if view_files:
3926 file_list = view_files
3927 view_str = views.view_display_str(view_files)
3928- note(gettext("Ignoring files outside view. View is %s"),
3929- view_str)
3930+ note(gettext("Ignoring files outside view. View is %s"), view_str)
3931 return tree, file_list
3932
3933
3934@@ -230,9 +230,10 @@
3935 if revisions is None:
3936 return None
3937 if len(revisions) != 1:
3938- raise errors.CommandError(gettext(
3939- 'brz %s --revision takes exactly one revision identifier') % (
3940- command_name,))
3941+ raise errors.CommandError(
3942+ gettext("brz %s --revision takes exactly one revision identifier")
3943+ % (command_name,)
3944+ )
3945 return revisions[0]
3946
3947
3948@@ -262,6 +263,7 @@
3949 def _get_view_info_for_change_reporter(tree):
3950 """Get the view information from a tree for change reporting."""
3951 from . import views
3952+
3953 view_info = None
3954 try:
3955 current_view = tree.views.get_view_info()[0]
3956@@ -287,6 +289,7 @@
3957 # Argument class, representing a file in a branch, where the first occurrence
3958 # opens the branch?)
3959
3960+
3961 class cmd_status(Command):
3962 __doc__ = """Display status summary.
3963
3964@@ -346,48 +349,67 @@
3965
3966 # TODO: --no-recurse/-N, --recurse options
3967
3968- takes_args = ['file*']
3969- takes_options = ['show-ids', 'revision', 'change', 'verbose',
3970- Option('short', help='Use short status indicators.',
3971- short_name='S'),
3972- Option('versioned', help='Only show versioned files.',
3973- short_name='V'),
3974- Option('no-pending', help='Don\'t show pending merges.'),
3975- Option('no-classify',
3976- help='Do not mark object type using indicator.'),
3977- ]
3978- aliases = ['st', 'stat']
3979+ takes_args = ["file*"]
3980+ takes_options = [
3981+ "show-ids",
3982+ "revision",
3983+ "change",
3984+ "verbose",
3985+ Option("short", help="Use short status indicators.", short_name="S"),
3986+ Option("versioned", help="Only show versioned files.", short_name="V"),
3987+ Option("no-pending", help="Don't show pending merges."),
3988+ Option("no-classify", help="Do not mark object type using indicator."),
3989+ ]
3990+ aliases = ["st", "stat"]
3991
3992- encoding_type = 'replace'
3993- _see_also = ['diff', 'revert', 'status-flags']
3994+ encoding_type = "replace"
3995+ _see_also = ["diff", "revert", "status-flags"]
3996
3997 @display_command
3998- def run(self, show_ids=False, file_list=None, revision=None, short=False,
3999- versioned=False, no_pending=False, verbose=False,
4000- no_classify=False):
4001+ def run(
4002+ self,
4003+ show_ids=False,
4004+ file_list=None,
4005+ revision=None,
4006+ short=False,
4007+ versioned=False,
4008+ no_pending=False,
4009+ verbose=False,
4010+ no_classify=False,
4011+ ):
4012 from .status import show_tree_status
4013 from .workingtree import WorkingTree
4014
4015 if revision and len(revision) > 2:
4016 raise errors.CommandError(
4017- gettext('brz status --revision takes exactly'
4018- ' one or two revision specifiers'))
4019+ gettext(
4020+ "brz status --revision takes exactly"
4021+ " one or two revision specifiers"
4022+ )
4023+ )
4024
4025 tree, relfile_list = WorkingTree.open_containing_paths(file_list)
4026 # Avoid asking for specific files when that is not needed.
4027- if relfile_list == ['']:
4028+ if relfile_list == [""]:
4029 relfile_list = None
4030 # Don't disable pending merges for full trees other than '.'.
4031- if file_list == ['.']:
4032+ if file_list == ["."]:
4033 no_pending = True
4034 # A specific path within a tree was given.
4035 elif relfile_list is not None:
4036 no_pending = True
4037- show_tree_status(tree, show_ids=show_ids,
4038- specific_files=relfile_list, revision=revision,
4039- to_file=self.outf, short=short, versioned=versioned,
4040- show_pending=(not no_pending), verbose=verbose,
4041- classify=not no_classify)
4042+ show_tree_status(
4043+ tree,
4044+ show_ids=show_ids,
4045+ specific_files=relfile_list,
4046+ revision=revision,
4047+ to_file=self.outf,
4048+ short=short,
4049+ versioned=versioned,
4050+ show_pending=(not no_pending),
4051+ verbose=verbose,
4052+ classify=not no_classify,
4053+ )
4054
4055
4056 class cmd_cat_revision(Command):
4057@@ -398,52 +420,58 @@
4058 """
4059
4060 hidden = True
4061- takes_args = ['revision_id?']
4062- takes_options = ['directory', 'revision']
4063+ takes_args = ["revision_id?"]
4064+ takes_options = ["directory", "revision"]
4065 # cat-revision is more for frontends so should be exact
4066- encoding = 'strict'
4067+ encoding = "strict"
4068
4069 def print_revision(self, revisions, revid):
4070- stream = revisions.get_record_stream([(revid,)], 'unordered', True)
4071+ stream = revisions.get_record_stream([(revid,)], "unordered", True)
4072 record = next(stream)
4073- if record.storage_kind == 'absent':
4074+ if record.storage_kind == "absent":
4075 raise errors.NoSuchRevision(revisions, revid)
4076- revtext = record.get_bytes_as('fulltext')
4077- self.outf.write(revtext.decode('utf-8'))
4078+ revtext = record.get_bytes_as("fulltext")
4079+ self.outf.write(revtext.decode("utf-8"))
4080
4081 @display_command
4082- def run(self, revision_id=None, revision=None, directory='.'):
4083+ def run(self, revision_id=None, revision=None, directory="."):
4084 if revision_id is not None and revision is not None:
4085- raise errors.CommandError(gettext('You can only supply one of'
4086- ' revision_id or --revision'))
4087+ raise errors.CommandError(
4088+ gettext("You can only supply one of" " revision_id or --revision")
4089+ )
4090 if revision_id is None and revision is None:
4091 raise errors.CommandError(
4092- gettext('You must supply either --revision or a revision_id'))
4093+ gettext("You must supply either --revision or a revision_id")
4094+ )
4095
4096 b = controldir.ControlDir.open_containing_tree_or_branch(directory)[1]
4097
4098 revisions = getattr(b.repository, "revisions", None)
4099 if revisions is None:
4100 raise errors.CommandError(
4101- gettext('Repository %r does not support '
4102- 'access to raw revision texts') % b.repository)
4103+ gettext(
4104+ "Repository %r does not support " "access to raw revision texts"
4105+ )
4106+ % b.repository
4107+ )
4108
4109 with b.repository.lock_read():
4110 # TODO: jam 20060112 should cat-revision always output utf-8?
4111 if revision_id is not None:
4112- revision_id = revision_id.encode('utf-8')
4113+ revision_id = revision_id.encode("utf-8")
4114 try:
4115 self.print_revision(revisions, revision_id)
4116 except errors.NoSuchRevision as exc:
4117 msg = gettext(
4118- "The repository {0} contains no revision {1}.").format(
4119- b.repository.base, revision_id.decode('utf-8'))
4120+ "The repository {0} contains no revision {1}."
4121+ ).format(b.repository.base, revision_id.decode("utf-8"))
4122 raise errors.CommandError(msg) from exc
4123 elif revision is not None:
4124 for rev in revision:
4125 if rev is None:
4126 raise errors.CommandError(
4127- gettext('You cannot specify a NULL revision.'))
4128+ gettext("You cannot specify a NULL revision.")
4129+ )
4130 rev_id = rev.as_revision_id(b)
4131 self.print_revision(revisions, rev_id)
4132
4133@@ -456,17 +484,19 @@
4134
4135 To re-create the working tree, use "brz checkout".
4136 """
4137- _see_also = ['checkout', 'working-trees']
4138- takes_args = ['location*']
4139+ _see_also = ["checkout", "working-trees"]
4140+ takes_args = ["location*"]
4141 takes_options = [
4142- Option('force',
4143- help='Remove the working tree even if it has '
4144- 'uncommitted or shelved changes.'),
4145- ]
4146+ Option(
4147+ "force",
4148+ help="Remove the working tree even if it has "
4149+ "uncommitted or shelved changes.",
4150+ ),
4151+ ]
4152
4153 def run(self, location_list, force=False):
4154 if not location_list:
4155- location_list = ['.']
4156+ location_list = ["."]
4157
4158 for location in location_list:
4159 d = controldir.ControlDir.open(location)
4160@@ -474,22 +504,24 @@
4161 try:
4162 working = d.open_workingtree()
4163 except errors.NoWorkingTree as exc:
4164- raise errors.CommandError(
4165- gettext("No working tree to remove")) from exc
4166+ raise errors.CommandError(gettext("No working tree to remove")) from exc
4167 except errors.NotLocalUrl as exc:
4168 raise errors.CommandError(
4169- gettext("You cannot remove the working tree"
4170- " of a remote path")) from exc
4171+ gettext("You cannot remove the working tree" " of a remote path")
4172+ ) from exc
4173 if not force:
4174- if (working.has_changes()):
4175+ if working.has_changes():
4176 raise errors.UncommittedChanges(working)
4177 if working.get_shelf_manager().last_shelf() is not None:
4178 raise errors.ShelvedChanges(working)
4179
4180 if working.user_url != working.branch.user_url:
4181 raise errors.CommandError(
4182- gettext("You cannot remove the working tree"
4183- " from a lightweight checkout"))
4184+ gettext(
4185+ "You cannot remove the working tree"
4186+ " from a lightweight checkout"
4187+ )
4188+ )
4189
4190 d.destroy_workingtree()
4191
4192@@ -511,15 +543,17 @@
4193 """
4194
4195 takes_options = [
4196- 'revision', 'directory',
4197- Option('force',
4198- help='Reset the tree even if it doesn\'t appear to be'
4199- ' corrupted.'),
4200+ "revision",
4201+ "directory",
4202+ Option(
4203+ "force", help="Reset the tree even if it doesn't appear to be" " corrupted."
4204+ ),
4205 ]
4206 hidden = True
4207
4208- def run(self, revision=None, directory='.', force=False):
4209+ def run(self, revision=None, directory=".", force=False):
4210 from .workingtree import WorkingTree
4211+
4212 tree, _ = WorkingTree.open_containing(directory)
4213 self.enter_context(tree.lock_tree_write())
4214 if not force:
4215@@ -529,10 +563,13 @@
4216 pass # There seems to be a real error here, so we'll reset
4217 else:
4218 # Refuse
4219- raise errors.CommandError(gettext(
4220- 'The tree does not appear to be corrupt. You probably'
4221- ' want "brz revert" instead. Use "--force" if you are'
4222- ' sure you want to reset the working tree.'))
4223+ raise errors.CommandError(
4224+ gettext(
4225+ "The tree does not appear to be corrupt. You probably"
4226+ ' want "brz revert" instead. Use "--force" if you are'
4227+ " sure you want to reset the working tree."
4228+ )
4229+ )
4230 if revision is None:
4231 revision_ids = None
4232 else:
4233@@ -541,12 +578,15 @@
4234 tree.reset_state(revision_ids)
4235 except errors.BzrError as exc:
4236 if revision_ids is None:
4237- extra = gettext(', the header appears corrupt, try passing '
4238- '-r -1 to set the state to the last commit')
4239+ extra = gettext(
4240+ ", the header appears corrupt, try passing "
4241+ "-r -1 to set the state to the last commit"
4242+ )
4243 else:
4244- extra = ''
4245+ extra = ""
4246 raise errors.CommandError(
4247- gettext('failed to reset the tree state{0}').format(extra)) from exc
4248+ gettext("failed to reset the tree state{0}").format(extra)
4249+ ) from exc
4250
4251
4252 class cmd_revno(Command):
4253@@ -555,19 +595,21 @@
4254 This is equal to the number of revisions on this branch.
4255 """
4256
4257- _see_also = ['info']
4258- takes_args = ['location?']
4259+ _see_also = ["info"]
4260+ takes_args = ["location?"]
4261 takes_options = [
4262- Option('tree', help='Show revno of working tree.'),
4263- 'revision',
4264- ]
4265+ Option("tree", help="Show revno of working tree."),
4266+ "revision",
4267+ ]
4268
4269 @display_command
4270- def run(self, tree=False, location='.', revision=None):
4271+ def run(self, tree=False, location=".", revision=None):
4272 from .workingtree import WorkingTree
4273+
4274 if revision is not None and tree:
4275 raise errors.CommandError(
4276- gettext("--tree and --revision can not be used together"))
4277+ gettext("--tree and --revision can not be used together")
4278+ )
4279
4280 if tree:
4281 try:
4282@@ -582,36 +624,41 @@
4283 self.enter_context(b.lock_read())
4284 if revision:
4285 if len(revision) != 1:
4286- raise errors.CommandError(gettext(
4287- "Revision numbers only make sense for single "
4288- "revisions, not ranges"))
4289+ raise errors.CommandError(
4290+ gettext(
4291+ "Revision numbers only make sense for single "
4292+ "revisions, not ranges"
4293+ )
4294+ )
4295 revid = revision[0].as_revision_id(b)
4296 else:
4297 revid = b.last_revision()
4298 try:
4299 revno_t = b.revision_id_to_dotted_revno(revid)
4300 except (errors.NoSuchRevision, errors.GhostRevisionsHaveNoRevno):
4301- revno_t = ('???',)
4302+ revno_t = ("???",)
4303 revno = ".".join(str(n) for n in revno_t)
4304 self.cleanup_now()
4305- self.outf.write(revno + '\n')
4306+ self.outf.write(revno + "\n")
4307
4308
4309 class cmd_revision_info(Command):
4310 __doc__ = """Show revision number and revision id for a given revision identifier.
4311 """
4312 hidden = True
4313- takes_args = ['revision_info*']
4314+ takes_args = ["revision_info*"]
4315 takes_options = [
4316- 'revision',
4317- custom_help('directory', help='Branch to examine, '
4318- 'rather than the one containing the working directory.'),
4319- Option('tree', help='Show revno of working tree.'),
4320- ]
4321+ "revision",
4322+ custom_help(
4323+ "directory",
4324+ help="Branch to examine, "
4325+ "rather than the one containing the working directory.",
4326+ ),
4327+ Option("tree", help="Show revno of working tree."),
4328+ ]
4329
4330 @display_command
4331- def run(self, revision=None, directory='.', tree=False,
4332- revision_info_list=None):
4333+ def run(self, revision=None, directory=".", tree=False, revision_info_list=None):
4334 from .workingtree import WorkingTree
4335
4336 try:
4337@@ -643,16 +690,15 @@
4338 for revision_id in revision_ids:
4339 try:
4340 dotted_revno = b.revision_id_to_dotted_revno(revision_id)
4341- revno = '.'.join(str(i) for i in dotted_revno)
4342+ revno = ".".join(str(i) for i in dotted_revno)
4343 except errors.NoSuchRevision:
4344- revno = '???'
4345+ revno = "???"
4346 maxlen = max(maxlen, len(revno))
4347 revinfos.append((revno, revision_id))
4348
4349 self.cleanup_now()
4350 for revno, revid in revinfos:
4351- self.outf.write(
4352- '%*s %s\n' % (maxlen, revno, revid.decode('utf-8')))
4353+ self.outf.write("%*s %s\n" % (maxlen, revno, revid.decode("utf-8")))
4354
4355
4356 class cmd_add(Command):
4357@@ -699,64 +745,75 @@
4358 add.maximum_file_size will be skipped. Named items are never skipped due
4359 to file size.
4360 """
4361- takes_args = ['file*']
4362+ takes_args = ["file*"]
4363 takes_options = [
4364- Option('no-recurse',
4365- help="Don't recursively add the contents of directories.",
4366- short_name='N'),
4367- Option('dry-run',
4368- help="Show what would be done, but don't actually do "
4369- "anything."),
4370- 'verbose',
4371- Option('file-ids-from',
4372- type=str,
4373- help='Lookup file ids from this tree.'),
4374- ]
4375- encoding_type = 'replace'
4376- _see_also = ['remove', 'ignore']
4377+ Option(
4378+ "no-recurse",
4379+ help="Don't recursively add the contents of directories.",
4380+ short_name="N",
4381+ ),
4382+ Option(
4383+ "dry-run",
4384+ help="Show what would be done, but don't actually do " "anything.",
4385+ ),
4386+ "verbose",
4387+ Option("file-ids-from", type=str, help="Lookup file ids from this tree."),
4388+ ]
4389+ encoding_type = "replace"
4390+ _see_also = ["remove", "ignore"]
4391
4392- def run(self, file_list, no_recurse=False, dry_run=False, verbose=False,
4393- file_ids_from=None):
4394+ def run(
4395+ self,
4396+ file_list,
4397+ no_recurse=False,
4398+ dry_run=False,
4399+ verbose=False,
4400+ file_ids_from=None,
4401+ ):
4402 import breezy.add
4403
4404 from .workingtree import WorkingTree
4405+
4406 tree, file_list = tree_files_for_add(file_list)
4407
4408 if file_ids_from is not None and not tree.supports_setting_file_ids():
4409 warning(
4410- gettext('Ignoring --file-ids-from, since the tree does not '
4411- 'support setting file ids.'))
4412+ gettext(
4413+ "Ignoring --file-ids-from, since the tree does not "
4414+ "support setting file ids."
4415+ )
4416+ )
4417 file_ids_from = None
4418
4419 base_tree = None
4420 if file_ids_from is not None:
4421 try:
4422- base_tree, base_path = WorkingTree.open_containing(
4423- file_ids_from)
4424+ base_tree, base_path = WorkingTree.open_containing(file_ids_from)
4425 except errors.NoWorkingTree:
4426- base_branch, base_path = Branch.open_containing(
4427- file_ids_from)
4428+ base_branch, base_path = Branch.open_containing(file_ids_from)
4429 base_tree = base_branch.basis_tree()
4430
4431 action = breezy.add.AddFromBaseAction(
4432- base_tree, base_path, to_file=self.outf,
4433- should_print=(not is_quiet()))
4434+ base_tree, base_path, to_file=self.outf, should_print=(not is_quiet())
4435+ )
4436 else:
4437 action = breezy.add.AddWithSkipLargeAction(
4438- to_file=self.outf, should_print=(not is_quiet()))
4439+ to_file=self.outf, should_print=(not is_quiet())
4440+ )
4441
4442 if base_tree:
4443 self.enter_context(base_tree.lock_read())
4444 added, ignored = tree.smart_add(
4445- file_list, not no_recurse, action=action, save=not dry_run)
4446+ file_list, not no_recurse, action=action, save=not dry_run
4447+ )
4448 self.cleanup_now()
4449 if len(ignored) > 0:
4450 if verbose:
4451 for glob in sorted(ignored):
4452 for path in ignored[glob]:
4453 self.outf.write(
4454- gettext("ignored {0} matching \"{1}\"\n").format(
4455- path, glob))
4456+ gettext('ignored {0} matching "{1}"\n').format(path, glob)
4457+ )
4458
4459
4460 class cmd_mkdir(Command):
4461@@ -765,15 +822,15 @@
4462 This is equivalent to creating the directory and then adding it.
4463 """
4464
4465- takes_args = ['dir+']
4466+ takes_args = ["dir+"]
4467 takes_options = [
4468 Option(
4469- 'parents',
4470- help='No error if existing, make parent directories as needed.',
4471- short_name='p'
4472- )
4473- ]
4474- encoding_type = 'replace'
4475+ "parents",
4476+ help="No error if existing, make parent directories as needed.",
4477+ short_name="p",
4478+ )
4479+ ]
4480+ encoding_type = "replace"
4481
4482 @classmethod
4483 def add_file_with_parents(cls, wt, relpath):
4484@@ -788,6 +845,7 @@
4485
4486 def run(self, dir_list, parents=False):
4487 from .workingtree import WorkingTree
4488+
4489 if parents:
4490 add_file = self.add_file_with_parents
4491 else:
4492@@ -803,13 +861,13 @@
4493 os.mkdir(dir)
4494 add_file(wt, relpath)
4495 if not is_quiet():
4496- self.outf.write(gettext('added %s\n') % dir)
4497+ self.outf.write(gettext("added %s\n") % dir)
4498
4499
4500 class cmd_relpath(Command):
4501 __doc__ = """Show path of a file relative to root"""
4502
4503- takes_args = ['filename']
4504+ takes_args = ["filename"]
4505 hidden = True
4506
4507 @display_command
4508@@ -820,7 +878,7 @@
4509 # sys.stdout encoding cannot represent it?
4510 tree, relpath = WorkingTree.open_containing(filename)
4511 self.outf.write(relpath)
4512- self.outf.write('\n')
4513+ self.outf.write("\n")
4514
4515
4516 class cmd_inventory(Command):
4517@@ -834,28 +892,36 @@
4518 """
4519
4520 hidden = True
4521- _see_also = ['ls']
4522+ _see_also = ["ls"]
4523 takes_options = [
4524- 'revision',
4525- 'show-ids',
4526- Option('include-root',
4527- help='Include the entry for the root of the tree, if any.'),
4528- Option('kind',
4529- help='List entries of a particular kind: file, directory, '
4530- 'symlink.',
4531- type=str),
4532- ]
4533- takes_args = ['file*']
4534+ "revision",
4535+ "show-ids",
4536+ Option(
4537+ "include-root", help="Include the entry for the root of the tree, if any."
4538+ ),
4539+ Option(
4540+ "kind",
4541+ help="List entries of a particular kind: file, directory, " "symlink.",
4542+ type=str,
4543+ ),
4544+ ]
4545+ takes_args = ["file*"]
4546
4547 @display_command
4548- def run(self, revision=None, show_ids=False, kind=None, include_root=False,
4549- file_list=None):
4550+ def run(
4551+ self,
4552+ revision=None,
4553+ show_ids=False,
4554+ kind=None,
4555+ include_root=False,
4556+ file_list=None,
4557+ ):
4558 from .workingtree import WorkingTree
4559- if kind and kind not in ['file', 'directory', 'symlink']:
4560- raise errors.CommandError(
4561- gettext('invalid kind %r specified') % (kind,))
4562-
4563- revision = _get_one_revision('inventory', revision)
4564+
4565+ if kind and kind not in ["file", "directory", "symlink"]:
4566+ raise errors.CommandError(gettext("invalid kind %r specified") % (kind,))
4567+
4568+ revision = _get_one_revision("inventory", revision)
4569 work_tree, file_list = WorkingTree.open_containing_paths(file_list)
4570 self.enter_context(work_tree.lock_read())
4571 if revision is not None:
4572@@ -870,7 +936,8 @@
4573 self.enter_context(tree.lock_read())
4574 if file_list is not None:
4575 paths = tree.find_related_paths_across_trees(
4576- file_list, extra_trees, require_versioned=True)
4577+ file_list, extra_trees, require_versioned=True
4578+ )
4579 # find_ids_across_trees may include some paths that don't
4580 # exist in 'tree'.
4581 entries = tree.iter_entries_by_dir(specific_files=paths)
4582@@ -883,11 +950,10 @@
4583 if path == "" and not include_root:
4584 continue
4585 if show_ids:
4586- self.outf.write('%-50s %s\n' % (
4587- path, entry.file_id.decode('utf-8')))
4588+ self.outf.write("%-50s %s\n" % (path, entry.file_id.decode("utf-8")))
4589 else:
4590 self.outf.write(path)
4591- self.outf.write('\n')
4592+ self.outf.write("\n")
4593
4594
4595 class cmd_cp(Command):
4596@@ -906,22 +972,23 @@
4597 at the moment.
4598 """
4599
4600- takes_args = ['names*']
4601- aliases = ['copy']
4602- encoding_type = 'replace'
4603+ takes_args = ["names*"]
4604+ aliases = ["copy"]
4605+ encoding_type = "replace"
4606
4607 def run(self, names_list):
4608 from .workingtree import WorkingTree
4609+
4610 if names_list is None:
4611 names_list = []
4612 if len(names_list) < 2:
4613 raise errors.CommandError(gettext("missing file argument"))
4614 tree, rel_names = WorkingTree.open_containing_paths(
4615- names_list, canonicalize=False)
4616+ names_list, canonicalize=False
4617+ )
4618 for file_name in rel_names[0:-1]:
4619- if file_name == '':
4620- raise errors.CommandError(
4621- gettext("can not copy root of branch"))
4622+ if file_name == "":
4623+ raise errors.CommandError(gettext("can not copy root of branch"))
4624 self.enter_context(tree.lock_tree_write())
4625 into_existing = osutils.isdir(names_list[-1])
4626 if not into_existing:
4627@@ -929,41 +996,51 @@
4628 (src, dst) = rel_names
4629 except IndexError as exc:
4630 raise errors.CommandError(
4631- gettext('to copy multiple files the'
4632- ' destination must be a versioned'
4633- ' directory')) from exc
4634+ gettext(
4635+ "to copy multiple files the"
4636+ " destination must be a versioned"
4637+ " directory"
4638+ )
4639+ ) from exc
4640 pairs = [(src, dst)]
4641 else:
4642 pairs = [
4643 (n, osutils.joinpath([rel_names[-1], osutils.basename(n)]))
4644- for n in rel_names[:-1]]
4645+ for n in rel_names[:-1]
4646+ ]
4647
4648 for src, dst in pairs:
4649 try:
4650 src_kind = tree.stored_kind(src)
4651 except transport.NoSuchFile as exc:
4652 raise errors.CommandError(
4653- gettext('Could not copy %s => %s: %s is not versioned.')
4654- % (src, dst, src)) from exc
4655+ gettext("Could not copy %s => %s: %s is not versioned.")
4656+ % (src, dst, src)
4657+ ) from exc
4658 if src_kind is None:
4659 raise errors.CommandError(
4660- gettext('Could not copy %s => %s . %s is not versioned\\.') % (src, dst, src))
4661- if src_kind == 'directory':
4662+ gettext("Could not copy %s => %s . %s is not versioned\\.")
4663+ % (src, dst, src)
4664+ )
4665+ if src_kind == "directory":
4666 raise errors.CommandError(
4667- gettext('Could not copy %s => %s . %s is a directory.') % (
4668- src, dst, src))
4669+ gettext("Could not copy %s => %s . %s is a directory.")
4670+ % (src, dst, src)
4671+ )
4672 dst_parent = osutils.split(dst)[0]
4673- if dst_parent != '':
4674+ if dst_parent != "":
4675 try:
4676 dst_parent_kind = tree.stored_kind(dst_parent)
4677 except transport.NoSuchFile as exc:
4678 raise errors.CommandError(
4679- gettext('Could not copy %s => %s: %s is not versioned.')
4680- % (src, dst, dst_parent)) from exc
4681- if dst_parent_kind != 'directory':
4682+ gettext("Could not copy %s => %s: %s is not versioned.")
4683+ % (src, dst, dst_parent)
4684+ ) from exc
4685+ if dst_parent_kind != "directory":
4686 raise errors.CommandError(
4687- gettext('Could not copy to %s: %s is not a directory.')
4688- % (dst_parent, dst_parent))
4689+ gettext("Could not copy to %s: %s is not a directory.")
4690+ % (dst_parent, dst_parent)
4691+ )
4692
4693 tree.copy_one(src, dst)
4694
4695@@ -989,49 +1066,56 @@
4696 Files cannot be moved between branches.
4697 """
4698
4699- takes_args = ['names*']
4700- takes_options = [Option("after", help="Move only the brz identifier"
4701- " of the file, because the file has already been moved."),
4702- Option('auto', help='Automatically guess renames.'),
4703- Option(
4704- 'dry-run', help='Avoid making changes when guessing renames.'),
4705- ]
4706- aliases = ['move', 'rename']
4707- encoding_type = 'replace'
4708+ takes_args = ["names*"]
4709+ takes_options = [
4710+ Option(
4711+ "after",
4712+ help="Move only the brz identifier"
4713+ " of the file, because the file has already been moved.",
4714+ ),
4715+ Option("auto", help="Automatically guess renames."),
4716+ Option("dry-run", help="Avoid making changes when guessing renames."),
4717+ ]
4718+ aliases = ["move", "rename"]
4719+ encoding_type = "replace"
4720
4721 def run(self, names_list, after=False, auto=False, dry_run=False):
4722 from .workingtree import WorkingTree
4723+
4724 if auto:
4725 return self.run_auto(names_list, after, dry_run)
4726 elif dry_run:
4727- raise errors.CommandError(gettext('--dry-run requires --auto.'))
4728+ raise errors.CommandError(gettext("--dry-run requires --auto."))
4729 if names_list is None:
4730 names_list = []
4731 if len(names_list) < 2:
4732 raise errors.CommandError(gettext("missing file argument"))
4733 tree, rel_names = WorkingTree.open_containing_paths(
4734- names_list, canonicalize=False)
4735+ names_list, canonicalize=False
4736+ )
4737 for file_name in rel_names[0:-1]:
4738- if file_name == '':
4739- raise errors.CommandError(
4740- gettext("can not move root of branch"))
4741+ if file_name == "":
4742+ raise errors.CommandError(gettext("can not move root of branch"))
4743 self.enter_context(tree.lock_tree_write())
4744 self._run(tree, names_list, rel_names, after)
4745
4746 def run_auto(self, names_list, after, dry_run):
4747 from .rename_map import RenameMap
4748 from .workingtree import WorkingTree
4749+
4750 if names_list is not None and len(names_list) > 1:
4751 raise errors.CommandError(
4752- gettext('Only one path may be specified to --auto.'))
4753+ gettext("Only one path may be specified to --auto.")
4754+ )
4755 if after:
4756 raise errors.CommandError(
4757- gettext('--after cannot be specified with --auto.'))
4758+ gettext("--after cannot be specified with --auto.")
4759+ )
4760 work_tree, file_list = WorkingTree.open_containing_paths(
4761- names_list, default_directory='.')
4762+ names_list, default_directory="."
4763+ )
4764 self.enter_context(work_tree.lock_tree_write())
4765- RenameMap.guess_renames(
4766- work_tree.basis_tree(), work_tree, dry_run)
4767+ RenameMap.guess_renames(work_tree.basis_tree(), work_tree, dry_run)
4768
4769 def _run(self, tree, names_list, rel_names, after):
4770 into_existing = osutils.isdir(names_list[-1])
4771@@ -1041,15 +1125,16 @@
4772 # b. move directory after the fact (if the source used to be
4773 # a directory, but now doesn't exist in the working tree
4774 # and the target is an existing directory, just rename it)
4775- if (not tree.case_sensitive
4776- and rel_names[0].lower() == rel_names[1].lower()):
4777+ if not tree.case_sensitive and rel_names[0].lower() == rel_names[1].lower():
4778 into_existing = False
4779 else:
4780 # 'fix' the case of a potential 'from'
4781 from_path = tree.get_canonical_path(rel_names[0])
4782- if (not osutils.lexists(names_list[0]) and
4783- tree.is_versioned(from_path) and
4784- tree.stored_kind(from_path) == "directory"):
4785+ if (
4786+ not osutils.lexists(names_list[0])
4787+ and tree.is_versioned(from_path)
4788+ and tree.stored_kind(from_path) == "directory"
4789+ ):
4790 into_existing = False
4791 # move/rename
4792 if into_existing:
4793@@ -1062,9 +1147,13 @@
4794 self.outf.write(f"{src} => {dest}\n")
4795 else:
4796 if len(names_list) != 2:
4797- raise errors.CommandError(gettext('to mv multiple files the'
4798- ' destination must be a versioned'
4799- ' directory'))
4800+ raise errors.CommandError(
4801+ gettext(
4802+ "to mv multiple files the"
4803+ " destination must be a versioned"
4804+ " directory"
4805+ )
4806+ )
4807
4808 # for cicp file-systems: the src references an existing inventory
4809 # item:
4810@@ -1091,16 +1180,15 @@
4811 if after:
4812 # If 'after' is specified, the tail must refer to a file on disk.
4813 if dest_parent:
4814- dest_parent_fq = osutils.pathjoin(
4815- tree.basedir, dest_parent)
4816+ dest_parent_fq = osutils.pathjoin(tree.basedir, dest_parent)
4817 else:
4818 # pathjoin with an empty tail adds a slash, which breaks
4819 # relpath :(
4820 dest_parent_fq = tree.basedir
4821
4822 dest_tail = osutils.canonical_relpath(
4823- dest_parent_fq,
4824- osutils.pathjoin(dest_parent_fq, spec_tail))
4825+ dest_parent_fq, osutils.pathjoin(dest_parent_fq, spec_tail)
4826+ )
4827 else:
4828 # not 'after', so case as specified is used
4829 dest_tail = spec_tail
4830@@ -1144,30 +1232,41 @@
4831 with brz send.
4832 """
4833
4834- _see_also = ['push', 'update', 'status-flags', 'send']
4835- takes_options = ['remember', 'overwrite', 'revision',
4836- custom_help('verbose',
4837- help='Show logs of pulled revisions.'),
4838- custom_help('directory',
4839- help='Branch to pull into, '
4840- 'rather than the one containing the working directory.'),
4841- Option('local',
4842- help="Perform a local pull in a bound "
4843- "branch. Local pulls are not applied to "
4844- "the master branch."
4845- ),
4846- Option('show-base',
4847- help="Show base revision text in conflicts."),
4848- Option('overwrite-tags',
4849- help="Overwrite tags only."),
4850- ]
4851- takes_args = ['location?']
4852- encoding_type = 'replace'
4853+ _see_also = ["push", "update", "status-flags", "send"]
4854+ takes_options = [
4855+ "remember",
4856+ "overwrite",
4857+ "revision",
4858+ custom_help("verbose", help="Show logs of pulled revisions."),
4859+ custom_help(
4860+ "directory",
4861+ help="Branch to pull into, "
4862+ "rather than the one containing the working directory.",
4863+ ),
4864+ Option(
4865+ "local",
4866+ help="Perform a local pull in a bound "
4867+ "branch. Local pulls are not applied to "
4868+ "the master branch.",
4869+ ),
4870+ Option("show-base", help="Show base revision text in conflicts."),
4871+ Option("overwrite-tags", help="Overwrite tags only."),
4872+ ]
4873+ takes_args = ["location?"]
4874+ encoding_type = "replace"
4875
4876- def run(self, location=None, remember=None, overwrite=False,
4877- revision=None, verbose=False,
4878- directory=None, local=False,
4879- show_base=False, overwrite_tags=False):
4880+ def run(
4881+ self,
4882+ location=None,
4883+ remember=None,
4884+ overwrite=False,
4885+ revision=None,
4886+ verbose=False,
4887+ directory=None,
4888+ local=False,
4889+ show_base=False,
4890+ overwrite_tags=False,
4891+ ):
4892 from . import mergeable as _mod_mergeable
4893 from .workingtree import WorkingTree
4894
4895@@ -1181,7 +1280,7 @@
4896 revision_id = None
4897 mergeable = None
4898 if directory is None:
4899- directory = '.'
4900+ directory = "."
4901 try:
4902 tree_to = WorkingTree.open_containing(directory)[0]
4903 branch_to = tree_to.branch
4904@@ -1200,39 +1299,43 @@
4905 if location is not None:
4906 try:
4907 mergeable = _mod_mergeable.read_mergeable_from_url(
4908- location, possible_transports=possible_transports)
4909+ location, possible_transports=possible_transports
4910+ )
4911 except errors.NotABundle:
4912 mergeable = None
4913
4914 stored_loc = branch_to.get_parent()
4915 if location is None:
4916 if stored_loc is None:
4917- raise errors.CommandError(gettext("No pull location known or"
4918- " specified."))
4919+ raise errors.CommandError(
4920+ gettext("No pull location known or" " specified.")
4921+ )
4922 else:
4923- display_url = urlutils.unescape_for_display(stored_loc,
4924- self.outf.encoding)
4925+ display_url = urlutils.unescape_for_display(
4926+ stored_loc, self.outf.encoding
4927+ )
4928 if not is_quiet():
4929 self.outf.write(
4930- gettext("Using saved parent location: %s\n") % display_url)
4931+ gettext("Using saved parent location: %s\n") % display_url
4932+ )
4933 location = stored_loc
4934
4935- revision = _get_one_revision('pull', revision)
4936+ revision = _get_one_revision("pull", revision)
4937 if mergeable is not None:
4938 if revision is not None:
4939- raise errors.CommandError(gettext(
4940- 'Cannot use -r with merge directives or bundles'))
4941+ raise errors.CommandError(
4942+ gettext("Cannot use -r with merge directives or bundles")
4943+ )
4944 mergeable.install_revisions(branch_to.repository)
4945- base_revision_id, revision_id, verified = \
4946- mergeable.get_merge_request(branch_to.repository)
4947+ base_revision_id, revision_id, verified = mergeable.get_merge_request(
4948+ branch_to.repository
4949+ )
4950 branch_from = branch_to
4951 else:
4952- branch_from = Branch.open(location,
4953- possible_transports=possible_transports)
4954+ branch_from = Branch.open(location, possible_transports=possible_transports)
4955 self.enter_context(branch_from.lock_read())
4956 # Remembers if asked explicitly or no previous location is set
4957- if (remember
4958- or (remember is None and branch_to.get_parent() is None)):
4959+ if remember or (remember is None and branch_to.get_parent() is None):
4960 # FIXME: This shouldn't be done before the pull
4961 # succeeds... -- vila 2012-01-02
4962 branch_to.set_parent(branch_from.base)
4963@@ -1243,23 +1346,27 @@
4964 if tree_to is not None:
4965 view_info = _get_view_info_for_change_reporter(tree_to)
4966 change_reporter = delta._ChangeReporter(
4967- unversioned_filter=tree_to.is_ignored,
4968- view_info=view_info)
4969+ unversioned_filter=tree_to.is_ignored, view_info=view_info
4970+ )
4971 result = tree_to.pull(
4972- branch_from, overwrite=overwrite, stop_revision=revision_id,
4973+ branch_from,
4974+ overwrite=overwrite,
4975+ stop_revision=revision_id,
4976 change_reporter=change_reporter,
4977- local=local, show_base=show_base)
4978+ local=local,
4979+ show_base=show_base,
4980+ )
4981 else:
4982 result = branch_to.pull(
4983- branch_from, overwrite=overwrite, stop_revision=revision_id,
4984- local=local)
4985+ branch_from, overwrite=overwrite, stop_revision=revision_id, local=local
4986+ )
4987
4988 result.report(self.outf)
4989 if verbose and result.old_revid != result.new_revid:
4990 log.show_branch_change(
4991- branch_to, self.outf, result.old_revno,
4992- result.old_revid)
4993- if getattr(result, 'tag_conflicts', None):
4994+ branch_to, self.outf, result.old_revno, result.old_revid
4995+ )
4996+ if getattr(result, "tag_conflicts", None):
4997 return 1
4998 else:
4999 return 0
5000@@ -1295,46 +1402,78 @@
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches