add SetupStage parameter to RemoteType.setup

Most remotes have an idempotent setup that can be reused for
enableremote, but in a few cases, it needs to tell which, and whether
a UUID was provided to setup was used.

This is groundwork for making initremote be able to provide a UUID.
It should not change any behavior.

Note that it would be nice to make the UUID always be provided to setup,
and make setup not need to generate and return a UUID. What prevented
this simplification is Remote.Git.gitSetup, which needs to reuse the
UUID of the git remote when setting it up, and so has to return that
UUID.

This commit was sponsored by Thom May on Patreon.
This commit is contained in:
Joey Hess 2017-02-07 14:35:58 -04:00
parent 7487b4da47
commit 5c804cf42e
No known key found for this signature in database
GPG key ID: C910D9222512E3C7
17 changed files with 56 additions and 48 deletions

View file

@ -46,7 +46,7 @@ start (name:ws) = ifM (isJust <$> findExisting name)
perform :: RemoteType -> String -> R.RemoteConfig -> CommandPerform
perform t name c = do
(c', u) <- R.setup t Nothing Nothing c def
(c', u) <- R.setup t R.Init Nothing Nothing c def
next $ cleanup u name c'
cleanup :: UUID -> String -> R.RemoteConfig -> CommandCleanup