Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dfetch/project/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
8 changes: 4 additions & 4 deletions dfetch/project/subproject.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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,))
2 changes: 1 addition & 1 deletion dfetch/project/svn.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
63 changes: 32 additions & 31 deletions doc/manual.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Introduction
*Dfetch* can perform various actions based on the projects listed in the `manifest <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 <getting_started>`_.

.. program-output:: dfetch --help
:shell:
Expand All @@ -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::
Expand Down Expand Up @@ -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::
Expand All @@ -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
Expand Down Expand Up @@ -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
--------------
Expand Down
4 changes: 2 additions & 2 deletions features/diff-in-svn.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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!
"""

Expand Down Expand Up @@ -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!
"""

Expand Down
18 changes: 9 additions & 9 deletions features/steps/git_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,41 +15,41 @@


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", "[email protected]"])
subprocess.call(["git", "config", "user.name", "John Doe"])
subprocess.check_call(["git", "config", "user.email", "[email protected]"])
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")
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")


Expand Down
2 changes: 1 addition & 1 deletion features/steps/svn_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 8 additions & 4 deletions tests/test_fuzzing.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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()
Loading