Repository navigation
refactor: remove dead code and pass-through overrides in archive tree dialogs - #2632
Merged
Merged
Conversation
… dialogs Closes #2609. Behaviour-preserving cleanup of the diff and extract tree models: - FileTreeModel.data, flags and headerData, which only called super() - the _make_filesystemitem/_merge_data pass-throughs in DiffTree, ExtractTree and the test TreeModelImp, plus the now-unused logger in both dialogs - the never-emitted FileTreeSortProxyModel.sorted signal, both connects and both slot_sorted methods - ChangeType.__ge__ (infinitely recursive), __gt__ and __le__; only __lt__ is used - the unused FileSystemItem.addChildren - ExtractTree._flat_filter now returns False: the extract dialog has no flat mode, so nothing needs to go into _flattened - the duplicated first-column name logic moves to FileTreeModel.display_name Adds a test for the DiffTree first-column name in each display mode.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Removes dead code and pass-through overrides from the diff and extract tree models. Behaviour is meant to be unchanged.
FileTreeModel.data,flagsandheaderDataonly calledsuper(). Removed.DiffTreeandExtractTreeoverrode_make_filesystemitemand_merge_dataonly to callsuper()and log a misleading "Overriding" message. Removed, together with the then-unusedloggerin both dialog modules and the same two pass-throughs in the test'sTreeModelImp.FileTreeSortProxyModel.sortedwas never emitted. Removed the signal, bothsorted.connect(...)lines and bothslot_sortedmethods.ChangeType.__ge__,__gt__and__le__were unused, and__ge__recursed infinitely. Removed; sorting only uses__lt__.FileSystemItem.addChildrenhad no callers. Removed.ExtractTree._flat_filternow returnsFalse. The extract dialog has no flat mode, but every item was still bisected into the flat list while the archive listing was loaded.DiffTree.dataandExtractTree.data. It moves toFileTreeModel.display_name().FileTreeSortProxyModel.extract_pathis left alone: it sorts by the first path segment in simplified mode on purpose.The only behaviour difference: an
ExtractTreeput into flat mode by code would now show no rows. Nothing does that, andExtractDialog.change_display_moderaises for anything but the two tree modes.Related Issue
Closes #2609
The issue suggests holding the
extract.pypart back until #2598 is resolved. This PR does all of it in one go, because thesortedsignal cannot be removed without also removing the connect inExtractDialog.__init__. #2598 and #2593 touch nearby lines inextract.pyand will need a small rebase after this.Motivation and Context
See the issue. Left out, as the issue asks:
addItem/removeItem/indexPath(used by tests), a shared dialog base class, and sharing_process_childorParseThread.How Has This Been Tested?
On macOS with Borg 1.4.3 (nox default).
tests/unit/test_diff.py::test_diff_tree_display_namechecks the first-column names of aDiffTreein tree, simplified and flat mode. Breaking any of the four branches ofdisplay_namemakes it fail.tests/unit/test_treemodel.py,test_diff.py,test_extract.py,test_borg_argv.pyandtest_archives.pypass.test_keyring_darwin.py::test_keyring_non_ascii_repo, which writes to the real login keychain).data(12 roles),flagsandheaderDatafor every cell of the diff and extract models and their sort proxies, in every display mode, column, sort order and folders-on-top setting: identical apart from the flat-modeExtractTreecase above.Not tested: real mouse and keyboard use of the dialogs, Linux, and other Borg versions. Integration tests were not run locally.
Types of changes
Refactoring only.
Checklist:
I provide my contribution under the terms of the license of this repository and I affirm the Developer Certificate of Origin.