diff --git a/dfetch/project/git.py b/dfetch/project/git.py index 45edd6e6..ac878957 100644 --- a/dfetch/project/git.py +++ b/dfetch/project/git.py @@ -48,7 +48,7 @@ def metadata_revision(self) -> str: return str(self._local_repo.get_last_file_hash(self.metadata_path)) def current_revision(self) -> str: - """Get the revision of the metadata file.""" + """Get the last revision of the repository.""" return str(self._local_repo.get_current_hash()) def _diff_impl( diff --git a/dfetch/project/subproject.py b/dfetch/project/subproject.py index d31f7243..837b84bb 100644 --- a/dfetch/project/subproject.py +++ b/dfetch/project/subproject.py @@ -378,7 +378,7 @@ def metadata_revision(self) -> str: @abstractmethod def current_revision(self) -> str: - """Get the revision of the metadata file.""" + """Get the last revision of the repository.""" @abstractmethod def _diff_impl( @@ -401,13 +401,13 @@ def is_license_file(filename: str) -> bool: for pattern in SubProject.LICENSE_GLOBS ) - def diff(self, old_rev: str, new_rev: str) -> str: + def diff(self, old_revision: str, new_revision: str) -> str: """Generate a relative diff for a subproject.""" - if not old_rev: + if not old_revision: raise RuntimeError( "When not providing any revisions, dfetch starts from" f" the last revision to {Metadata.FILENAME} in {self.local_path}." " Please either commit this, or specify a revision to start from with --revs" ) - return self._diff_impl(old_rev, new_rev, ignore=(Metadata.FILENAME,)) + return self._diff_impl(old_revision, new_revision, ignore=(Metadata.FILENAME,)) diff --git a/dfetch/project/svn.py b/dfetch/project/svn.py index 6b180cb2..9281a161 100644 --- a/dfetch/project/svn.py +++ b/dfetch/project/svn.py @@ -186,7 +186,7 @@ def metadata_revision(self) -> str: return SvnRepo.get_last_changed_revision(self.metadata_path) def current_revision(self) -> str: - """Get the current revision of the repo.""" + """Get the last revision of the repository.""" return SvnRepo.get_last_changed_revision(self.local_path) def _diff_impl( diff --git a/doc/manual.rst b/doc/manual.rst index d3332349..610c68d4 100644 --- a/doc/manual.rst +++ b/doc/manual.rst @@ -8,6 +8,7 @@ Introduction *Dfetch* can perform various actions based on the projects listed in the `manifest `_. Each of these actions are a separate command. Below an overview of all available commands and their usage. For detailed information on each command, please refer to the respective sections below. +For a step-by-step guide see the `Getting Started `_. .. program-output:: dfetch --help :shell: @@ -24,6 +25,18 @@ Init .. automodule:: dfetch.commands.init +Import +------ +.. argparse:: + :module: dfetch.__main__ + :func: create_parser + :prog: dfetch + :path: import + +.. asciinema:: asciicasts/import.cast + +.. automodule:: dfetch.commands.import_ + Check ----- .. argparse:: @@ -54,6 +67,18 @@ Code-climate reporter ''''''''''''''''''''' .. automodule:: dfetch.reporting.check.code_climate_reporter +Update +------ +.. argparse:: + :module: dfetch.__main__ + :func: create_parser + :prog: dfetch + :path: update + +.. asciinema:: asciicasts/update.cast + +.. automodule:: dfetch.commands.update + Report ------ .. argparse:: @@ -76,32 +101,8 @@ Software Bill-of-Materials .. asciinema:: asciicasts/sbom.cast -Update ------- -.. argparse:: - :module: dfetch.__main__ - :func: create_parser - :prog: dfetch - :path: update - -.. asciinema:: asciicasts/update.cast - -.. automodule:: dfetch.commands.update - -Validate --------- -.. argparse:: - :module: dfetch.__main__ - :func: create_parser - :prog: dfetch - :path: validate - -.. asciinema:: asciicasts/validate.cast - -.. automodule:: dfetch.commands.validate - Diff ------ +---- .. argparse:: :module: dfetch.__main__ :func: create_parser @@ -136,18 +137,18 @@ Environment .. automodule:: dfetch.commands.environment - -Import ------- +Validate +-------- .. argparse:: :module: dfetch.__main__ :func: create_parser :prog: dfetch - :path: import + :path: validate -.. asciinema:: asciicasts/import.cast +.. asciinema:: asciicasts/validate.cast + +.. automodule:: dfetch.commands.validate -.. automodule:: dfetch.commands.import_ CLI Cheatsheet -------------- diff --git a/features/diff-in-svn.feature b/features/diff-in-svn.feature index 44e72225..eceba4e0 100644 --- a/features/diff-in-svn.feature +++ b/features/diff-in-svn.feature @@ -29,7 +29,7 @@ Feature: Diff in svn --- README.md +++ README.md @@ -1,1 +1,2 @@ - some content + Generated file for SomeProject +An important sentence for the README! """ @@ -79,7 +79,7 @@ Feature: Diff in svn --- README.md +++ README.md @@ -1,1 +1,2 @@ - some content + Generated file for SomeProject +An important sentence for the README! """ diff --git a/features/steps/git_steps.py b/features/steps/git_steps.py index 4282a3d6..caf98b43 100644 --- a/features/steps/git_steps.py +++ b/features/steps/git_steps.py @@ -15,28 +15,28 @@ def create_repo(): - subprocess.call( + subprocess.check_call( ["git", "init", "--initial-branch=master", "--quiet"] ) # Be quiet about using master as the default branch - subprocess.call(["git", "config", "user.email", "you@example.com"]) - subprocess.call(["git", "config", "user.name", "John Doe"]) + subprocess.check_call(["git", "config", "user.email", "you@example.com"]) + subprocess.check_call(["git", "config", "user.name", "John Doe"]) if os.name == "nt": # Creates zombie fsmonitor-daemon process that holds files # (see https://github.com/git-for-windows/git/issues/3326) - subprocess.call( + subprocess.check_call( ["git", "config", "--global", "core.usebuiltinfsmonitor", "false"] ) def commit_all(msg): - subprocess.call(["git", "add", "-A"]) - subprocess.call(["git", "commit", "-m", f'"{msg}"']) + subprocess.check_call(["git", "add", "-A"]) + subprocess.check_call(["git", "commit", "-m", f'"{msg}"']) def tag(name: str): - subprocess.call(["git", "tag", "-a", name, "-m", "'Some tag'"]) + subprocess.check_call(["git", "tag", "-a", name, "-m", "'Some tag'"]) @given("a git repo with the following submodules") @@ -44,12 +44,12 @@ def step_impl(context): create_repo() for submodule in context.table: - subprocess.call( + subprocess.check_call( ["git", "submodule", "add", submodule["url"], submodule["path"]] ) with in_directory(submodule["path"]): - subprocess.call(["git", "checkout", submodule["revision"]]) + subprocess.check_call(["git", "checkout", submodule["revision"]]) commit_all("Added submodules") diff --git a/features/steps/svn_steps.py b/features/steps/svn_steps.py index 5a240d9f..b0d81bd1 100644 --- a/features/steps/svn_steps.py +++ b/features/steps/svn_steps.py @@ -84,7 +84,7 @@ def step_impl(context, name, tag_name=None): create_stdlayout() with in_directory("trunk"): for file in files: - generate_file(file["path"], "some content") + generate_file(file["path"], f"Generated file for {name}") add_and_commit("Added files") if tag_name: create_tag(tag_name) diff --git a/tests/test_fuzzing.py b/tests/test_fuzzing.py index ce3a1e9c..95472a78 100644 --- a/tests/test_fuzzing.py +++ b/tests/test_fuzzing.py @@ -1,5 +1,9 @@ """Fuzz test the manifest.""" +# pyright: reportCallIssue=false +# mypy: ignore-errors +# pylint: disable=no-value-for-parameter + from __future__ import annotations import os @@ -190,7 +194,7 @@ def test_update(data): parsed = load(as_document(example, schema).as_yaml(), schema) print("\nRound-trip parsed .data:\n", parsed.data) - test_data_conforms_to_schema() # pylint: disable=no-value-for-parameter - test_manifest_can_be_created() # pylint: disable=no-value-for-parameter - test_check() # pylint: disable=no-value-for-parameter - test_update() # pylint: disable=no-value-for-parameter + test_data_conforms_to_schema() + test_manifest_can_be_created() + test_check() + test_update()