From c98fb0b637dcb26155fcc6ddbcf3322c5bac0b8c Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 10 May 2023 12:32:00 -0400 Subject: [PATCH] merge: Support --json and --json-error-messages and --json-progress Seems unlikely to be very useful, but trivial. And, this completes the story that git-annex sync does not need json, since every sub-operation is available in a command that does support json. (Well, except for committing, but that's not a git-annex command.) Sponsored-By: the NIH-funded NICEMAN (ReproNim TR&D3) project --- CHANGELOG | 4 ++-- Command/Merge.hs | 7 ++++--- doc/git-annex-merge.mdwn | 10 ++++++++++ ...on_for_unannex__and_ideally_any_other_command_.mdwn | 4 +--- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index fb19b60898..72ef2198b4 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -39,8 +39,8 @@ git-annex (10.20230408) UNRELEASED; urgency=medium broken. * Support --json and --json-error-messages in more commands (addunused, dead, describe, dropunused, expire, fix, importfeed, init, - log, migrate, reinit, reinject, rekey, renameremote, rmurl, semitrust, - setpresentkey, trust, unannex, undo, untrust, unused) + log, merge, migrate, reinit, reinject, rekey, renameremote, rmurl, + semitrust, setpresentkey, trust, unannex, undo, untrust, unused) * log: When --raw-date is used, display only seconds from the epoch, as documented, omitting a trailing "s" that was included in the output before. diff --git a/Command/Merge.hs b/Command/Merge.hs index 275a9a1ce9..b10e91f424 100644 --- a/Command/Merge.hs +++ b/Command/Merge.hs @@ -16,9 +16,10 @@ import Command.Sync (prepMerge, mergeLocal, mergeConfig, merge, notOnlyAnnexOpti import Git.Types cmd :: Command -cmd = command "merge" SectionMaintenance - "merge changes from remotes" - (paramOptional paramRef) (seek <$$> optParser) +cmd = withAnnexOptions [jsonOptions] $ + command "merge" SectionMaintenance + "merge changes from remotes" + (paramOptional paramRef) (seek <$$> optParser) data MergeOptions = MergeOptions { mergeBranches :: [String] diff --git a/doc/git-annex-merge.mdwn b/doc/git-annex-merge.mdwn index 153e2b93d4..b8331826b2 100644 --- a/doc/git-annex-merge.mdwn +++ b/doc/git-annex-merge.mdwn @@ -27,6 +27,16 @@ will not be done. Passed on to `git merge`, to control whether or not to merge histories that do not share a common ancestor. +* `--json` + + Enable JSON output. This is intended to be parsed by programs that use + git-annex. Each line of output is a JSON object. + +* `--json-error-messages` + + Messages that would normally be output to standard error are included in + the JSON instead. + * Also, the [[git-annex-common-options]](1) can be used. # SEE ALSO diff --git a/doc/todo/--json_for_unannex__and_ideally_any_other_command_.mdwn b/doc/todo/--json_for_unannex__and_ideally_any_other_command_.mdwn index b165cb6ef7..94f7552e2e 100644 --- a/doc/todo/--json_for_unannex__and_ideally_any_other_command_.mdwn +++ b/doc/todo/--json_for_unannex__and_ideally_any_other_command_.mdwn @@ -37,15 +37,13 @@ These commands have been updated to support --json: * git-annex-reinject * git-annex-renameremote * git-annex-importfeed +* git-annex-merge Provisional list of commands that don't support --json and maybe should: -(Feel free to reorder things to the top) - * git-annex-configremote * git-annex-enableremote * git-annex-initremote -* git-annex-merge * git-annex-upgrade These commands could support json, but I punted: -- 2.30.2