Skip to content

Commit

Permalink
Merge pull request #247 from psyinfra/release-0-3-0
Browse files Browse the repository at this point in the history
prepare for 0.3.0 release
  • Loading branch information
aqw authored Nov 2, 2022
2 parents 17bd5fb + e64f362 commit b6c5fbe
Show file tree
Hide file tree
Showing 2 changed files with 109 additions and 3 deletions.
110 changes: 109 additions & 1 deletion docs/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,115 @@ Changelog
Next
****

Changes listed have been merged into Onyo and will be part of the next release.
Changes listed here have been merged into Onyo and will be part of the next release.

The highlights are:

Command Changes
---------------
- ``onyo mv --rename`` is retired. ``onyo set`` is the only command that can
change keys/pseudo-keys.
- add ``onyo mv --quiet``
- rename ``onyo mv --force`` to ``onyo mv --yes`` to match other commands
- ``onyo new`` faux serials default length is decreased from 8 to 6
- asset read/write always preserves key order and comments (aka: roundtrip mode)

API
---
- a new ``Repo`` class to represent a repository as an object
- ``Repo(init=True)`` initializes a new repository
- the following properties are added to ``Repo``:

- ``assets``: assets in the repo
- ``dirs``: directories in the repo
- ``files``: files in the repo
- ``files_changes``: files in the "changed" state in git
- ``files_staged``: files in the "staged" state in git
- ``files_untracked``: files "untracked" by git
- ``root``: repository root
- ``opdir``: operating directory

- the following public methods are added to ``Repo``:

- ``Repo.add()``: stage a file's changed contents
- ``Repo.commit()``: commit all staged changes
- ``Repo.generate_faux_serials()``: generate unique, fake serials
- ``Repo.get_config()``: get a config value
- ``Repo.set_config()``: set a config name and value, in either ``.onyo/config``
or any other valid git-config location
- ``Repo.fsck()``: fsck the repository, individual tests can be selected
- ``Repo.mkdir()``: create a directory (and any parents), add ``.anchor`` files,
and stage them
- ``Repo.mv()``: move/rename a directory/file and stage it
- ``Repo.rm()``: delete a directory/file and stage it

- remove ``onyo/utils.py``
- most tests are rewritten/updated to be self-contained

Bugs
----
- ``onyo history`` honors ``onyo -C``
- ``onyo history`` errors bubble up the correct exit code
- "protected paths" (such as ``.anchor``, ``.git``, ``.onyo``) are checked
for anywhere in the path name.
- calling ``onyo`` with an insufficient number of arguments no longer exits 0
- arguments named 'config' no longer result in ignoring subsequent arguments
- simultaneous use of ``onyo -C`` and ``onyo --debug`` no longer crashes Onyo
- faux serials are generated in a more random way
- ``onyo mkdir`` no longer errors with overlapping target directories
- ``onyo mv file-1 subdir/file-1`` (aka: explicit move) no longer errors

Validation
----------
Validation is entirely removed. It will be reintroduced, in an improved form, in
a later release.

Docs
----
Linting is documented.

Tests
-----
- add tests for the ``onyo edit`` command
- add tests for the ``onyo history`` command
- add tests for the ``onyo mv`` command
- add tests for the ``onyo new`` command
- add tests for the ``onyo`` command
- add tests for the ``Repo`` class:

- initialization
- instantiation
- ``assets``
- ``dirs``
- ``files``
- ``files_changes``
- ``files_staged``
- ``files_untracked``
- ``root``
- ``opdir``
- ``add()``
- ``commit()``
- ``generate_faux_serials()``
- ``get_config()``
- ``set_config()``
- ``fsck()``
- ``mkdir()``
- ``mv()``
- ``rm()``

- `Pyre <https://pyre-check.org/>`_ is used for type checking
- ``repo`` fixture to assist with test setup and isolation

Installation
------------
The Python version required by Onyo is bumped from 3.7 to 3.9.

Both GitPython and PyYAML are dropped as dependencies.

Authors
-------
- Tobias Kadelka (`@TobiasKadelka <https://github.com/TobiasKadelka>`__)
- Alex Waite (`@aqw <https://github.com/aqw>`__)

--------------------------------------------------------------------------------

Expand Down
2 changes: 0 additions & 2 deletions onyo/lib/onyo.py
Original file line number Diff line number Diff line change
Expand Up @@ -820,8 +820,6 @@ def generate_faux_serials(self, length: int = 6, num: int = 1) -> set[str]:
raise ValueError('The length of faux serial numbers must be >= 4.')

if num < 1:
# 62^4 is ~14.7 million combinations. Which is the lowest acceptable
# risk of collisions between independent checkouts of a repo.
raise ValueError('The length of faux serial numbers must be >= 1.')

alphanum = string.ascii_letters + string.digits
Expand Down

0 comments on commit b6c5fbe

Please sign in to comment.