Workspace.Status (Workspace v0.2.1)
View SourceUtilities related to the workspace status.
The workspace status is defined by the changed files and the dependencies between the projects. A workspace project can have one of the following states:
:modified
- if any of the project's files has been modified:affected
- if any of the project's dependencies is modified:unaffected
- if the project and any of it's dependencies have not been modified.
Git repository
Notice that it is assumed that git
is used for the version
control of the repository. In any other case the workspace
status related functionality will not work.
Summary
Functions
Returns the affected projects
Returns the changed files grouped by the project they belong to.
Returns the modified projects
Annotates the workspace projects with their statuses.
Types
@type file_info() :: {Path.t(), Workspace.Git.change_type()}
Functions
@spec affected(workspace :: Workspace.State.t(), opts :: keyword()) :: [atom()]
Returns the affected projects
A project is considered affected if it has changed or any of it's children has changed.
Options
:base
(String.t()
) - The base git reference for detecting changed files, if not set only working tree changes will be included.:head
(String.t()
) - The head git reference for detecting changed files. It is used only if:base
is set.
@spec changed(workspace :: Workspace.State.t(), opts :: keyword()) :: %{ required(atom()) => file_info() }
Returns the changed files grouped by the project they belong to.
Options
:base
(String.t()
) - The base git reference for detecting changed files, if not set only working tree changes will be included.:head
(String.t()
) - The head git reference for detecting changed files. It is used only if:base
is set.
@spec modified(workspace :: Workspace.State.t(), opts :: keyword()) :: [atom()]
Returns the modified projects
A workspace project is considered modified if any of it's files has
changed with respect to the base
branch.
Options
:base
(String.t()
) - The base git reference for detecting changed files, if not set only working tree changes will be included.:head
(String.t()
) - The head git reference for detecting changed files. It is used only if:base
is set.
@spec update(workspace :: Workspace.State.t(), opts :: keyword()) :: Workspace.State.t()
Annotates the workspace projects with their statuses.
This will mark the workspace projects with either :affected
or
:modified
based on the changes between the :base
and :head
references.
Options
:base
(String.t()
) - The base git reference for detecting changed files, if not set only working tree changes will be included.:head
(String.t()
) - The head git reference for detecting changed files. It is used only if:base
is set.:force
(boolean()
) - If set the workspace status will be force updated.