Class: Rosette::Core::Commands::StatusCommand
- Inherits:
-
GitCommand
- Object
- Command
- GitCommand
- Rosette::Core::Commands::StatusCommand
- Includes:
- WithRef, WithRepoName
- Defined in:
- lib/rosette/core/commands/git/status_command.rb
Overview
Computes the status of a git ref. Statuses contain the number of translations per locale as well as the state of the commit (pending, untranslated, or translated).
Instance Attribute Summary
Attributes included from WithRef
Attributes included from WithRepoName
Attributes inherited from Command
Instance Method Summary collapse
-
#execute ⇒ Hash
Computes the status for the configured repository and git ref.
Methods included from WithRef
#commit_id, #set_commit_id, #set_ref
Methods included from WithRepoName
Methods inherited from GitCommand
Methods inherited from Command
#initialize, #messages, #valid?, validate, validators
Constructor Details
This class inherits a constructor from Rosette::Core::Commands::Command
Instance Method Details
#execute ⇒ Hash
Computes the status for the configured repository and git ref. The status is computed by identifying the branch the ref belongs to, then examining and merging the statuses of all commits that belong to that branch.
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/rosette/core/commands/git/status_command.rb', line 53 def execute repo_config = get_repo(repo_name) rev_walk = RevWalk.new(repo_config.repo.jgit_repo) all_refs = repo_config.repo.all_refs.values refs = repo_config.repo.refs_containing( commit_id, rev_walk, all_refs ) commit_logs = commit_logs_for( refs.map(&:getName), repo_config, rev_walk, all_refs ) status, phrase_count, locale_statuses = derive( refs, commit_logs, repo_config ) rev_walk.dispose { status: status, commit_id: commit_id, phrase_count: phrase_count, locales: locale_statuses } end |