Commit Graph

32 Commits

Author SHA1 Message Date
TW 675010e401
Random cleanups by @ThomasWaldmann (#1879)
* fix PEP8 E721

do not compare types, for exact checks use `is` / `is not`, for instance checks use `isinstance()`

* remove redundant parentheses

* fix SiteWorker.run for empty job queue

local variable job is not assigned if queue was empty
when calling .run(), but it is used in exception handler.

* remove unreachable code in parse_diff_lines

* bug fix for unreachable code in is_worker_running

the code intended to check if *any* worker is running for
any site was *unreachable*.

this caused false negative results for site=None.

* check_failed_response: remove outdated part of docstring

* pull request template: fix relative path to LICENSE.txt

* fix typos

* use logger.warning, .warn is deprecated
2024-01-09 08:06:48 +00:00
real-yfprojects 24e1dd5c56
Run pre-commit (with newly added ruff) on code base.
Includes all changes by `pre-commit --all-files` including the changes introduced by ruff.
2023-05-01 10:28:11 +02:00
i1sm3ky 7535f92ac8
PyQt6 Upgrade (#1685)
This puts Vorta on PyQt6 and starts a new main branch 0.9.

---------

Co-authored-by: real-yfprojects <real-yfprojects@users.noreply.github.com>
Co-authored-by: Manu <3916435+m3nu@users.noreply.github.com>
Co-authored-by: yfprojects <62463991+real-yfprojects@users.noreply.github.com>
2023-04-17 11:17:01 +01:00
Divyansh Singh b51b1ef85e
Save list view as setting. By @diivi (#1621)
* feat: add a setting for files list views

* separate logic from data class

* make mode optional

* rename display mode methods

* refactor

* move code above connect signals comment

* reorder code

---------

Co-authored-by: yfprojects <62463991+real-yfprojects@users.noreply.github.com>
Co-authored-by: Manu <3916435+m3nu@users.noreply.github.com>
2023-04-05 12:20:42 +01:00
Henry Spanka e3451ed49e
Handle ctime and mtime diff changes (#1675)
Borg v1.2.4 added new change types called `mtime` and `ctime` for the modification and the creation time of a file.
Our diff json parser doesn't support these changes yet.
The plain text parser doesn't need to be updated since it is only used for earlier versions of borg.
This also extends the tooltip in the diff view to show changes in `ctime` or `mtime` in a localised manner.

* src/vorta/views/diff_result.py (ChangeType): Add `CTIME` and `MTIME` linking to `MODIFIED`.

* src/vorta/views/diff_result.py (DiffData): Add fields `ctime_change` and `mtime_change`.

* src/vorta/views/diff_result.py (parse_diff_json): Parse the new change types.

* src/vorta/views/diff_result.py (DiffTree.data): Add time changes to tooltip in a human readable format.

* tests/test_diff.py : Update test data to include new change types. Add additional test cases for unittesting the new change types.
2023-04-03 10:16:09 +02:00
real-yfprojects b95da02b97 Fix sorting of diff results.
* src/vorta/views/diff_result.py (DiffSortProxyModel.choose_data): Return correct data for column `2`.
2022-11-03 21:12:40 +01:00
Manu b6a24debb7 Apply automatic formatting 2022-08-15 15:23:55 +02:00
real-yfprojects 56de55ed8b
Add icons to display mode combobox.
* src/vorta/assets/icons/view-list-details.svg : Add icon for flat list

* src/vorta/assets/icons/view-list-tree.svg : Add icon for tree

* src/vorta/views/diff_result.py (DiffDialog.set_icons)

* src/vorta/views/extract_dialog.py (ExtractDialog.set_icons)
2022-07-25 16:15:47 +02:00
real-yfprojects cbc0780caa
Add icon for `folder on top` button.
* src/vorta/assets/icons/folder-on-top.svg : Add icon to repo.

* src/vorta/views/diff_result.py (DiffDialog.set_icons): Set icon.
* src/vorta/views/extract_dialog.py (ExtractDialog.set_icons): Set icon.
2022-07-25 16:15:46 +02:00
real-yfprojects 71af54f59b
Use new treemodel for extract dialog.
* src/vorta/views/extract_dialog.py: Add `ParseThread`, `ExtractTree` and `parse_json_lines`.

* src/vorta/views/extract_dialog.py (ExtractTree.__init__): Adjust signature.

* src/vorta/borg/list_archive.py (BorgListArchiveJob.prepare): Adjust format to
	include additional attributes.

* src/vorta/views/archive_tab.py (ArchiveTab): Parse extract data using `ParseThread` and
	open `ExtractDialog` afterwards.

* tests/test_archives.py (test_archive_extract): Update tests.

* src/vorta/borg/extract.py (BorgExtractJob.prepare): Adjust signature.
	Handling of the data isn't implemented yet.

* tests/test_extract.py
2022-07-25 16:15:45 +02:00
real-yfprojects 71aed9ba0e
Keep GUI responsive while processing diff results.
* src/vorta/views/archive_tab.py (ArchiveTab.list_diff_result): Start `ParseThread` that does the processing and creates the dialog.

* src/vorta/views/archive_tab.py (ArchiveTab.show_diff_result): Implement method showing `DiffResultDialog`.

* src/vorta/views/diff_result.py (ParseThread): Move processing of diff results to this thread.
2022-07-25 16:13:28 +02:00
real-yfprojects 7003d69577
Update `diffresult.ui` with new features and prettyfy it.
* src/vorta/assets/UI/diffresult.ui : Replace `okButton` with `QDialogButtonBox`
	that has a `close` button.

* src/vorta/views/diff_result.py : Connect `buttonBox` instead of `okButton` to Dialog.

* src/vorta/assets/UI/diffresult.ui : Add title to `DiffResult` dialog and simplify file name display.

* src/vorta/assets/UI/diffresult.ui : Add comboBox to change display mode of tree view.

* src/vorta/views/diff_result.py : Connect comboBox to `DiffTree`.

* src/vorta/application.py : Remove `eventFilter` setup for palette changes.

* src/vorta/tray_menu.py : Connect directly to `app.paletteChanged`.
* src/vorta/views/archive_tab.py
* src/vorta/views/repo_tab.py
* src/vorta/views/schedule_tab.py
* src/vorta/views/source_tab.py

* src/vorta/assets/UI/diffresult.ui : Add buttons to keep folders on top when sorting and
	to expand and collapse all items.

* src/vorta/views/diff_result.py : Connect the added buttons.

* src/vorta/assets/icons/angle-up-solid.svg : Add icon for `bCollapseAll`.

* src/vorta/views/diff_result.py : Add context menu to `treeView` that allows expanding
	and copying of an item.

* src/vorta/views/diff_result.py : Add copy shortcut to `treeView`.
2022-07-25 16:13:28 +02:00
real-yfprojects c8ba273079
Use new treemodel for diff view.
Subclass `treemodel.FileTreeModel` for the purposes of the diff dialog.
Rewrite diff output parsing.
Add sorting through `QSortFilterProxyModel`.

* src/vorta/views/diff_result.py (DiffResult.__init__): Remove doubled if statement.

* src/vorta/views/diff_result.py : Rename `DiffResult` to `DiffResultDialog`.

* src/vorta/views/diff_result.py (DiffTree.__init__): Remove the use of `QVariant`.
	Since python has no type enforcement `QVariant` is not needed.

* src/vorta/views/diff_result.py (DiffTree): Subclass `treemodel.FileTreeModel` and add additional info tooltip.

* src/vorta/views/diff_result.py (parse_diff_json): Some changes for use with new model.

* src/vorta/views/diff_result.py (parse_diff_lines): Full regex based line parsing and
	other modifications to go with the new model.

* src/vorta/views/diff_result.py (FileType): Enum of possible file types.

* src/vorta/views/diff_result.py (ChangeType): Enum of possible change types.
	Currently all are mapped to `ADDED`, `MODIFIED` and `REMOVED`.

* src/vorta/views/diff_result.py (calc_size): Rename to `size_to_byte`.

* src/vorta/assets/UI/diffresult.ui : Move `alternatingRowColours` to the .ui file.

* src/vorta/views/diff_result.py (DiffResultDialog): Move `alternatingRowColours` to the .ui file.

* tests/test_diff.py : Fix tests for diff parser.

* src/vorta/views/diff_result.py : Connect to `sorted` of `DiffSortProxyModel`
	to reveal selected items in view.

* src/vorta/views/partials/treemodel.py : Add `FileTreeSortProxyModel` with abstract code.

* src/vorta/views/diff_result.py (DiffSortProxyModel): Implement `FileTreeSortProxyModel`.

* src/vorta/views/diff_result.py (DiffItem): This variable holds the type `FileSystemItem[DiffData]`.
2022-07-25 16:13:27 +02:00
yfprojects 305db92d4a
Log json diff line parsing errors. By @real-yfprojects (#1369) 2022-07-03 09:59:33 +04:00
yfprojects 091c0dcacd
Raise `ValueError` in case of unknown change type in diff json. By @real-yfprojects (#1350)
Currently an assert statement checks whether a change type was recognized.
This assert statement won't give any information on the actual change type that
is not implemented. Now a ValueError that mentiones the unknown change type in
its message will be raised instead.

* src/vorta/views/diff_result.py (parse_diff_json_lines): Replace assert statement by
	if and raise statements.

Co-authored-by: real-yfprojects <real-yfprojects@users.noreply.github.com>
2022-06-07 10:32:58 +04:00
yfprojects de1ca052b5
Add support for special file types in `borg diff` output. By @real-yfprojects (#1265)
New item types were introduced to borg with borgbackup/borg#6624.
2022-05-06 11:33:13 +04:00
bastiencyr 5700f096bb
Fix for diff command (#1019)
Fixes #1016
2021-06-20 14:15:19 +04:00
bastiencyr 292066f8b7
Put folders first in diff/extract. Fixes #915. By @bastiencyr (#999) 2021-05-30 19:21:27 +04:00
Robert Blenis 0f5335ed7f
Add support for 'diff --json-lines'. By @rblenis (#909)
* add support for 'diff --json-lines' available in borg 1.1.16.
* fixes issue #901 (diff not handling CR/LF in filenames)
* improve `pretty_bytes()` formatting function
2021-03-30 07:47:27 +08:00
Samuel 19b4946b45
Diff: better color of added and removed text. By @samuel-w (#649) 2020-12-04 15:13:51 +08:00
Manu 02625ba4f0
Improved progress updates. By @SergioRAgostinho 2020-09-05 22:08:36 +08:00
Tomasz Kontusz 85eb725059
Parse owner changes in borg diff results (#553)
* Parse owner changes in borg diff results

* Report owner-only changes as "modified" in diff
2020-07-24 19:26:52 +02:00
Tomasz Kontusz c16a7509bd
Fix parsing "changed link" lines (#510)
* Fix parsing "changed link" lines

* Move borg diff parser test to test_archives.py
2020-06-16 18:21:24 +02:00
Manu a765c32681 Resolve new E741 linting error 2020-05-22 16:22:36 +08:00
Julian 3b6c5f2d3c
Rewrite of borg diff core (#373)
- It now heavily relies on regex. This was done in order to make the code more stable and easier to maintain.
- Share common code for file tree view between extract and diff.
2020-03-23 14:20:09 +08:00
Philip Roche af7cc3dd2b Improve checks for +/- in diff line (#359)
There could exist a scenario when a +/- would be not at the start of the string.
Current code would fail in this case.

Instead we should check that the first character of the string is +/-.

This following on from PR # 356 https://github.com/borgbase/vorta/pull/356
2019-10-07 12:07:06 +08:00
Julian Hofer bf7185c5f2 Fix spelling mistake in variable (#360) 2019-10-07 10:32:42 +08:00
Philip Roche 6c69f3689e Bugfix for handling 0 byte modification in diff view (#356)
An exception was thrown when diff of two archives were requested.

The exception was
'''
vorta/views/diff_result.py", line 52, in parse_line
    size = int(size)
ValueError: invalid literal for int() with base 10: ''
'''

which was caused by diff line:

'''
0 B   -2.6 kB home/philroche/.config/google-chrome/Profile 1/QuotaManager-journal
'''

This commit fixes the issue by only stripping +/- from string if they exist.

* Remove trailing whitespace causing flake8 failures
2019-09-04 10:03:42 +02:00
Hofer-Julian f103d78af1
Support permission change reports of borg diff 2019-08-26 21:39:47 +02:00
Julian Hofer d770763c96 Fix diff-bug with removed/added links
Fixes #350
2019-08-25 15:00:41 +02:00
Julian Hofer 2e895ac2f3 Fix borg diff 2019-07-12 23:10:22 +02:00
Hofer-Julian f3c8efdc89
Implement borg diff (#313) 2019-07-04 21:17:09 +02:00