make repo description optional
This commit is contained in:
parent
2d9682f3c6
commit
08e1efb278
3 changed files with 7 additions and 8 deletions
|
@ -93,6 +93,7 @@ makeRemote basename location a = do
|
|||
g <- gitRepo
|
||||
if not (any samelocation $ Git.remotes g)
|
||||
then do
|
||||
|
||||
let name = uniqueRemoteName basename 0 g
|
||||
a name
|
||||
return name
|
||||
|
|
|
@ -34,7 +34,7 @@ data RepoGroup = RepoGroupCustom String | RepoGroupStandard StandardGroup
|
|||
deriving (Show, Eq)
|
||||
|
||||
data RepoConfig = RepoConfig
|
||||
{ repoDescription :: Text
|
||||
{ repoDescription :: Maybe Text
|
||||
, repoGroup :: RepoGroup
|
||||
, repoSyncable :: Bool
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ data RepoConfig = RepoConfig
|
|||
|
||||
getRepoConfig :: UUID -> Git.Repo -> Annex RepoConfig
|
||||
getRepoConfig uuid r = RepoConfig
|
||||
<$> (T.pack . fromMaybe "" . M.lookup uuid <$> uuidMap)
|
||||
<$> (maybe Nothing (Just . T.pack) . M.lookup uuid <$> uuidMap)
|
||||
<*> getrepogroup
|
||||
<*> Config.repoSyncable r
|
||||
where
|
||||
|
@ -56,7 +56,7 @@ getRepoConfig uuid r = RepoConfig
|
|||
- Nothing when it is not changed. -}
|
||||
setRepoConfig :: UUID -> Git.Repo -> RepoConfig -> Annex (Maybe Bool)
|
||||
setRepoConfig uuid r c = do
|
||||
describeUUID uuid $ T.unpack $ repoDescription c
|
||||
maybe noop (describeUUID uuid . T.unpack) (repoDescription c)
|
||||
case repoGroup c of
|
||||
RepoGroupStandard g -> setStandardGroup uuid g
|
||||
RepoGroupCustom s -> groupSet uuid $ S.fromList $ words s
|
||||
|
@ -71,7 +71,7 @@ setRepoConfig uuid r c = do
|
|||
|
||||
editRepositoryAForm :: RepoConfig -> AForm WebApp WebApp RepoConfig
|
||||
editRepositoryAForm def = RepoConfig
|
||||
<$> areq textField "Description" (Just $ repoDescription def)
|
||||
<$> aopt textField "Description" (Just $ repoDescription def)
|
||||
<*> areq (selectFieldList $ customgroups++standardgroups) "Repository group" (Just $ repoGroup def)
|
||||
<*> areq checkBoxField "Syncing enabled" (Just $ repoSyncable def)
|
||||
where
|
||||
|
|
|
@ -31,7 +31,6 @@ import Remote (prettyListUUIDs)
|
|||
import Annex.UUID
|
||||
import Types.StandardGroups
|
||||
import Logs.PreferredContent
|
||||
import Logs.UUID
|
||||
|
||||
import Yesod
|
||||
import Data.Text (Text)
|
||||
|
@ -195,7 +194,7 @@ getAddDriveR = bootstrap (Just Config) $ do
|
|||
make mountpoint = do
|
||||
liftIO $ makerepo dir
|
||||
u <- liftIO $ initRepo dir $ Just remotename
|
||||
r <- addremote u dir remotename
|
||||
r <- addremote dir remotename
|
||||
runAnnex () $ setStandardGroup u TransferGroup
|
||||
syncRemote r
|
||||
return u
|
||||
|
@ -212,8 +211,7 @@ getAddDriveR = bootstrap (Just Config) $ do
|
|||
createDirectoryIfMissing True dir
|
||||
makeRepo dir True
|
||||
{- Each repository is made a remote of the other. -}
|
||||
addremote u dir name = runAnnex undefined $ do
|
||||
describeUUID u name
|
||||
addremote dir name = runAnnex undefined $ do
|
||||
hostname <- maybe "host" id <$> liftIO getHostname
|
||||
hostlocation <- fromRepo Git.repoLocation
|
||||
liftIO $ inDir dir $
|
||||
|
|
Loading…
Reference in a new issue