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
This commit is contained in:
Joey Hess 2023-05-10 12:32:00 -04:00
parent daaf7e10be
commit c98fb0b637
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 17 additions and 8 deletions

View file

@ -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.

View file

@ -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]

View file

@ -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

View file

@ -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: