diff --git a/Annex/Branch.hs b/Annex/Branch.hs index a03d6ddf39..c567db5540 100644 --- a/Annex/Branch.hs +++ b/Annex/Branch.hs @@ -454,7 +454,7 @@ handleTransitions jl localts refs = do ignoreRefs untransitionedrefs return True where - getreftransition ref = do + getreftransition ref = do ts <- parseTransitionsStrictly "remote" . decodeBS <$> catFile ref transitionsLog return (ref, ts) @@ -470,7 +470,7 @@ ignoreRefs rs = do getIgnoredRefs :: Annex (S.Set Git.Ref) getIgnoredRefs = S.fromList . mapMaybe Git.Sha.extractSha . lines <$> content where - content = do + content = do f <- fromRepo gitAnnexIgnoredRefs liftIO $ catchDefaultIO "" $ readFile f @@ -498,7 +498,7 @@ performTransitionsLocked jl ts neednewlocalbranch transitionedrefs = do ref <- getBranch commitIndex jl ref message (nub $ fullname:transitionedrefs) where - message + message | neednewlocalbranch && null transitionedrefs = "new branch for transition " ++ tdesc | otherwise = "continuing transition " ++ tdesc tdesc = show $ map describeTransition $ transitionList ts diff --git a/Annex/Branch/Transitions.hs b/Annex/Branch/Transitions.hs index f5833c0bca..9d306fe802 100644 --- a/Annex/Branch/Transitions.hs +++ b/Annex/Branch/Transitions.hs @@ -19,6 +19,7 @@ import Types.TrustLevel import Types.UUID import qualified Data.Map as M +import Data.Default data FileTransition = ChangeFile String @@ -60,4 +61,4 @@ dropDeadFromPresenceLog :: TrustMap -> [Presence.LogLine] -> [Presence.LogLine] dropDeadFromPresenceLog trustmap = filter $ notDead trustmap (toUUID . Presence.info) notDead :: TrustMap -> (v -> UUID) -> v -> Bool -notDead trustmap a v = M.findWithDefault SemiTrusted (a v) trustmap /= DeadTrusted +notDead trustmap a v = M.findWithDefault def (a v) trustmap /= DeadTrusted diff --git a/Annex/CatFile.hs b/Annex/CatFile.hs index 8b4d746e15..8a6f10def1 100644 --- a/Annex/CatFile.hs +++ b/Annex/CatFile.hs @@ -100,10 +100,10 @@ catKey' modeguaranteed sha mode catLink :: Bool -> Sha -> Annex String catLink modeguaranteed sha = fromInternalGitPath . decodeBS <$> get where - -- If the mode is not guaranteed to be correct, avoid + -- If the mode is not guaranteed to be correct, avoid -- buffering the whole file content, which might be large. -- 8192 is enough if it really is a symlink. - get + get | modeguaranteed = catObject sha | otherwise = L.take 8192 <$> catObject sha @@ -120,7 +120,7 @@ catKeyChecked :: Bool -> Ref -> Annex (Maybe Key) catKeyChecked needhead ref@(Ref r) = catKey' False ref =<< findmode <$> catTree treeref where - pathparts = split "/" r + pathparts = split "/" r dir = intercalate "/" $ take (length pathparts - 1) pathparts file = fromMaybe "" $ lastMaybe pathparts treeref = Ref $ if needhead then "HEAD" ++ dir ++ "/" else dir ++ "/" diff --git a/Annex/CheckIgnore.hs b/Annex/CheckIgnore.hs index d45e652bcb..f2ed93543e 100644 --- a/Annex/CheckIgnore.hs +++ b/Annex/CheckIgnore.hs @@ -18,7 +18,7 @@ import qualified Annex checkIgnored :: FilePath -> Annex Bool checkIgnored file = go =<< checkIgnoreHandle where - go Nothing = return False + go Nothing = return False go (Just h) = liftIO $ Git.checkIgnored h file checkIgnoreHandle :: Annex (Maybe Git.CheckIgnoreHandle) diff --git a/Annex/Content.hs b/Annex/Content.hs index c0c79ae565..37090d3bb3 100644 --- a/Annex/Content.hs +++ b/Annex/Content.hs @@ -456,7 +456,7 @@ removeAnnex (ContentLock key) = withObjectLoc key remove removedirect secureErase :: FilePath -> Annex () secureErase file = maybe noop go =<< annexSecureEraseCommand <$> Annex.getGitConfig where - go basecmd = void $ liftIO $ + go basecmd = void $ liftIO $ boolSystem "sh" [Param "-c", Param $ gencmd basecmd] gencmd = massReplace [ ("%file", shellEscape file) ] @@ -555,7 +555,7 @@ saveState nocommit = doSideAction $ do downloadUrl :: [Url.URLString] -> FilePath -> Annex Bool downloadUrl urls file = go =<< annexWebDownloadCommand <$> Annex.getGitConfig where - go Nothing = Url.withUrlOptions $ \uo -> + go Nothing = Url.withUrlOptions $ \uo -> anyM (\u -> Url.download u file uo) urls go (Just basecmd) = liftIO $ anyM (downloadcmd basecmd) urls downloadcmd basecmd url = diff --git a/Annex/Direct.hs b/Annex/Direct.hs index 76a6f27dca..9489b74f27 100644 --- a/Annex/Direct.hs +++ b/Annex/Direct.hs @@ -347,7 +347,7 @@ toDirectGen k f = do (dloc:_) -> return $ Just $ fromdirect dloc ) where - fromindirect loc = do + fromindirect loc = do {- Move content from annex to direct file. -} updateInodeCache k loc void $ addAssociatedFile k f diff --git a/Annex/Environment.hs b/Annex/Environment.hs index bc97c17b70..1ddd2b2384 100644 --- a/Annex/Environment.hs +++ b/Annex/Environment.hs @@ -13,10 +13,7 @@ import Common.Annex import Utility.UserInfo import qualified Git.Config import Config - -#ifndef mingw32_HOST_OS import Utility.Env -#endif {- Checks that the system's environment allows git to function. - Git requires a GECOS username, or suitable git configuration, or @@ -35,31 +32,26 @@ checkEnvironment = do liftIO checkEnvironmentIO checkEnvironmentIO :: IO () -checkEnvironmentIO = -#ifdef mingw32_HOST_OS - noop -#else - whenM (null <$> myUserGecos) $ do - username <- myUserName - ensureEnv "GIT_AUTHOR_NAME" username - ensureEnv "GIT_COMMITTER_NAME" username +checkEnvironmentIO = whenM (null <$> myUserGecos) $ do + username <- myUserName + ensureEnv "GIT_AUTHOR_NAME" username + ensureEnv "GIT_COMMITTER_NAME" username where #ifndef __ANDROID__ - -- existing environment is not overwritten - ensureEnv var val = void $ setEnv var val False + -- existing environment is not overwritten + ensureEnv var val = setEnv var val False #else -- Environment setting is broken on Android, so this is dealt with -- in runshell instead. ensureEnv _ _ = noop #endif -#endif {- Runs an action that commits to the repository, and if it fails, - sets user.email and user.name to a dummy value and tries the action again. -} ensureCommit :: Annex a -> Annex a ensureCommit a = either retry return =<< tryNonAsync a where - retry _ = do + retry _ = do name <- liftIO myUserName setConfig (ConfigKey "user.name") name setConfig (ConfigKey "user.email") name diff --git a/Annex/FileMatcher.hs b/Annex/FileMatcher.hs index da6a5e0e93..856c681220 100644 --- a/Annex/FileMatcher.hs +++ b/Annex/FileMatcher.hs @@ -106,7 +106,7 @@ tokenizeMatcher = filter (not . null ) . concatMap splitparens . words largeFilesMatcher :: Annex (FileMatcher Annex) largeFilesMatcher = go =<< annexLargeFiles <$> Annex.getGitConfig where - go Nothing = return matchAll + go Nothing = return matchAll go (Just expr) = do gm <- groupMap rc <- readRemoteLog diff --git a/Annex/ReplaceFile.hs b/Annex/ReplaceFile.hs index 9700d4b60c..0355ddd51e 100644 --- a/Annex/ReplaceFile.hs +++ b/Annex/ReplaceFile.hs @@ -33,7 +33,7 @@ replaceFileOr file action rollback = do tmpfile <- liftIO $ setup tmpdir go tmpfile `catchNonAsync` (const $ rollback tmpfile) where - setup tmpdir = do + setup tmpdir = do (tmpfile, h) <- openTempFileWithDefaultPermissions tmpdir "tmp" hClose h return tmpfile diff --git a/Annex/Ssh.hs b/Annex/Ssh.hs index ad636b4aac..3b7bd7d692 100644 --- a/Annex/Ssh.hs +++ b/Annex/Ssh.hs @@ -78,10 +78,10 @@ bestSocketPath abssocketfile = do then Just socketfile else Nothing where - -- ssh appends a 16 char extension to the socket when setting it + -- ssh appends a 16 char extension to the socket when setting it -- up, which needs to be taken into account when checking -- that a valid socket was constructed. - sshgarbage = replicate (1+16) 'X' + sshgarbage = replicate (1+16) 'X' sshConnectionCachingParams :: FilePath -> [CommandParam] sshConnectionCachingParams socketfile = diff --git a/Annex/TaggedPush.hs b/Annex/TaggedPush.hs index 35fdf333c4..a31758022e 100644 --- a/Annex/TaggedPush.hs +++ b/Annex/TaggedPush.hs @@ -49,13 +49,13 @@ fromTaggedBranch b = case split "/" $ Git.fromRef b of taggedPush :: UUID -> Maybe String -> Git.Ref -> Remote -> Git.Repo -> IO Bool taggedPush u info branch remote = Git.Command.runBool - [ Param "push" - , Param $ Remote.name remote + [ Param "push" + , Param $ Remote.name remote {- Using forcePush here is safe because we "own" the tagged branch - we're pushing; it has no other writers. Ensures it is pushed - even if it has been rewritten by a transition. -} - , Param $ Git.Branch.forcePush $ refspec Annex.Branch.name - , Param $ refspec branch - ] + , Param $ Git.Branch.forcePush $ refspec Annex.Branch.name + , Param $ refspec branch + ] where refspec b = Git.fromRef b ++ ":" ++ Git.fromRef (toTaggedBranch u info b) diff --git a/Annex/Transfer.hs b/Annex/Transfer.hs index d33d3073b6..fb89869f88 100644 --- a/Annex/Transfer.hs +++ b/Annex/Transfer.hs @@ -69,7 +69,7 @@ runTransfer' ignorelock t file shouldretry a = do return False else do ok <- retry info metervar $ - bracketIO (return fd) (cleanup tfile) (const $ a meter) + bracketIO (return fd) (cleanup tfile) (const $ a meter) unless ok $ recordFailedTransfer t info return ok where diff --git a/Annex/View.hs b/Annex/View.hs index a1d873f500..4cbf274aa0 100644 --- a/Annex/View.hs +++ b/Annex/View.hs @@ -102,7 +102,7 @@ refineView origview = checksize . calc Unchanged origview let (components', viewchanges) = runWriter $ mapM (\c -> updateViewComponent c field vf) (viewComponents view) viewchange = if field `elem` map viewField (viewComponents origview) - then maximum viewchanges + then maximum viewchanges else Narrowing in (view { viewComponents = components' }, viewchange) | otherwise = @@ -207,7 +207,7 @@ viewComponentMatcher :: ViewComponent -> (MetaData -> Maybe [MetaValue]) viewComponentMatcher viewcomponent = \metadata -> matcher (currentMetaDataValues metafield metadata) where - metafield = viewField viewcomponent + metafield = viewField viewcomponent matcher = case viewFilter viewcomponent of FilterValues s -> \values -> setmatches $ S.intersection s values @@ -236,8 +236,8 @@ toViewPath = concatMap escapeslash . fromMetaValue fromViewPath :: FilePath -> MetaValue fromViewPath = toMetaValue . deescapeslash [] where - deescapeslash s [] = reverse s - deescapeslash s (c:cs) + deescapeslash s [] = reverse s + deescapeslash s (c:cs) | c == pseudoSlash = case cs of (c':cs') | c' == pseudoSlash -> deescapeslash (pseudoSlash:s) cs' diff --git a/Annex/View/ViewedFile.hs b/Annex/View/ViewedFile.hs index 25ac16a346..ef901f7004 100644 --- a/Annex/View/ViewedFile.hs +++ b/Annex/View/ViewedFile.hs @@ -58,7 +58,7 @@ viewedFileReuse = takeFileName dirFromViewedFile :: ViewedFile -> FilePath dirFromViewedFile = joinPath . drop 1 . sep [] "" where - sep l _ [] = reverse l + sep l _ [] = reverse l sep l curr (c:cs) | c == '%' = sep (reverse curr:l) "" cs | c == '\\' = case cs of diff --git a/Assistant.hs b/Assistant.hs index 82f1572414..2ba778d807 100644 --- a/Assistant.hs +++ b/Assistant.hs @@ -119,7 +119,7 @@ startDaemon assistant foreground startdelay cannotrun listenhost startbrowser = ) #endif where - desc + desc | assistant = "assistant" | otherwise = "watch" start daemonize webappwaiter = withThreadState $ \st -> do @@ -147,7 +147,7 @@ startDaemon assistant foreground startdelay cannotrun listenhost startbrowser = let threads = if isJust cannotrun then webappthread else webappthread ++ - [ watch $ commitThread + [ watch commitThread #ifdef WITH_WEBAPP #ifdef WITH_PAIRING , assist $ pairListenerThread urlrenderer @@ -158,29 +158,29 @@ startDaemon assistant foreground startdelay cannotrun listenhost startbrowser = , assist $ xmppReceivePackThread urlrenderer #endif #endif - , assist $ pushThread - , assist $ pushRetryThread - , assist $ mergeThread - , assist $ transferWatcherThread - , assist $ transferPollerThread - , assist $ transfererThread - , assist $ remoteControlThread - , assist $ daemonStatusThread + , assist pushThread + , assist pushRetryThread + , assist mergeThread + , assist transferWatcherThread + , assist transferPollerThread + , assist transfererThread + , assist remoteControlThread + , assist daemonStatusThread , assist $ sanityCheckerDailyThread urlrenderer - , assist $ sanityCheckerHourlyThread + , assist sanityCheckerHourlyThread , assist $ problemFixerThread urlrenderer #ifdef WITH_CLIBS , assist $ mountWatcherThread urlrenderer #endif - , assist $ netWatcherThread + , assist netWatcherThread , assist $ upgraderThread urlrenderer , assist $ upgradeWatcherThread urlrenderer - , assist $ netWatcherFallbackThread + , assist netWatcherFallbackThread , assist $ transferScannerThread urlrenderer , assist $ cronnerThread urlrenderer - , assist $ configMonitorThread - , assist $ glacierThread - , watch $ watchThread + , assist configMonitorThread + , assist glacierThread + , watch watchThread -- must come last so that all threads that wait -- on it have already started waiting , watch $ sanityCheckerStartupThread startdelay diff --git a/Assistant/Alert.hs b/Assistant/Alert.hs index 745694f59a..a41baa85f1 100644 --- a/Assistant/Alert.hs +++ b/Assistant/Alert.hs @@ -145,7 +145,7 @@ syncResultAlert' succeeded failed = makeAlertFiller (not $ null succeeded) $ , alertHeader = Just $ tenseWords msg } where - msg + msg | null succeeded = ["Failed to sync with", showRemotes failed] | null failed = ["Synced with", showRemotes succeeded] | otherwise = diff --git a/Assistant/Alert/Utility.hs b/Assistant/Alert/Utility.hs index be631e9991..ea1280dac9 100644 --- a/Assistant/Alert/Utility.hs +++ b/Assistant/Alert/Utility.hs @@ -119,7 +119,7 @@ mergeAlert i al m = maybe updatePrune updateCombine (alertCombiner al) where bloat = M.size m' - maxAlerts pruneold l = - let (f, rest) = partition (\(_, a) -> isFiller a) l + let (f, rest) = partition (\(_, a) -> isFiller a) l in drop bloat f ++ rest updatePrune = pruneBloat $ M.filterWithKey pruneSame $ M.insertWith' const i al m diff --git a/Assistant/DaemonStatus.hs b/Assistant/DaemonStatus.hs index 35f8fc8564..3edc2c1744 100644 --- a/Assistant/DaemonStatus.hs +++ b/Assistant/DaemonStatus.hs @@ -65,7 +65,7 @@ calcSyncRemotes = do , syncingToCloudRemote = any iscloud syncdata } where - iscloud r = not (Remote.readonly r) && Remote.availability r == Remote.GloballyAvailable + iscloud r = not (Remote.readonly r) && Remote.availability r == Remote.GloballyAvailable {- Updates the syncRemotes list from the list of all remotes in Annex state. -} updateSyncRemotes :: Assistant () diff --git a/Assistant/DeleteRemote.hs b/Assistant/DeleteRemote.hs index cc05786e40..a900753a79 100644 --- a/Assistant/DeleteRemote.hs +++ b/Assistant/DeleteRemote.hs @@ -62,7 +62,7 @@ removableRemote urlrenderer uuid = do <$> liftAnnex (Remote.remoteFromUUID uuid) mapM_ (queueremaining r) keys where - queueremaining r k = + queueremaining r k = queueTransferWhenSmall "remaining object in unwanted remote" Nothing (Transfer Download uuid k) r {- Scanning for keys can take a long time; do not tie up diff --git a/Assistant/Gpg.hs b/Assistant/Gpg.hs index a55a0cab73..8ae4418f44 100644 --- a/Assistant/Gpg.hs +++ b/Assistant/Gpg.hs @@ -20,7 +20,7 @@ newUserId :: IO UserId newUserId = do oldkeys <- secretKeys username <- myUserName - let basekeyname = username ++ "'s git-annex encryption key" + let basekeyname = username ++ "'s git-annex encryption key" return $ Prelude.head $ filter (\n -> M.null $ M.filter (== n) oldkeys) ( basekeyname : map (\n -> basekeyname ++ show n) ([2..] :: [Int]) diff --git a/Assistant/MakeRemote.hs b/Assistant/MakeRemote.hs index 967a4d41d2..d244a7729b 100644 --- a/Assistant/MakeRemote.hs +++ b/Assistant/MakeRemote.hs @@ -48,7 +48,7 @@ makeRsyncRemote :: RemoteName -> String -> Annex String makeRsyncRemote name location = makeRemote name location $ const $ void $ go =<< Command.InitRemote.findExisting name where - go Nothing = setupSpecialRemote name Rsync.remote config Nothing + go Nothing = setupSpecialRemote name Rsync.remote config Nothing (Nothing, Command.InitRemote.newConfig name) go (Just (u, c)) = setupSpecialRemote name Rsync.remote config Nothing (Just u, c) diff --git a/Assistant/NetMessager.hs b/Assistant/NetMessager.hs index acb18b6484..f042b4e4e8 100644 --- a/Assistant/NetMessager.hs +++ b/Assistant/NetMessager.hs @@ -80,7 +80,7 @@ checkImportantNetMessages (storedclient, sentclient) = go <<~ netMessager queuePushInitiation :: NetMessage -> Assistant () queuePushInitiation msg@(Pushing clientid stage) = do tv <- getPushInitiationQueue side - liftIO $ atomically $ do + liftIO $ atomically $ do r <- tryTakeTMVar tv case r of Nothing -> putTMVar tv [msg] @@ -88,7 +88,7 @@ queuePushInitiation msg@(Pushing clientid stage) = do let !l' = msg : filter differentclient l putTMVar tv l' where - side = pushDestinationSide stage + side = pushDestinationSide stage differentclient (Pushing cid _) = cid /= clientid differentclient _ = True queuePushInitiation _ = noop diff --git a/Assistant/Repair.hs b/Assistant/Repair.hs index 5e5a28dcec..50442fe3bb 100644 --- a/Assistant/Repair.hs +++ b/Assistant/Repair.hs @@ -63,7 +63,7 @@ runRepair u mrmt destructiverepair = do return ok where - localrepair fsckresults = do + localrepair fsckresults = do -- Stop the watcher from running while running repairs. changeSyncable Nothing False @@ -140,9 +140,9 @@ repairStaleGitLocks r = do repairStaleLocks :: [FilePath] -> Assistant () repairStaleLocks lockfiles = go =<< getsizes where - getsize lf = catchMaybeIO $ + getsize lf = catchMaybeIO $ (\s -> (lf, fileSize s)) <$> getFileStatus lf - getsizes = liftIO $ catMaybes <$> mapM getsize lockfiles + getsizes = liftIO $ catMaybes <$> mapM getsize lockfiles go [] = return () go l = ifM (liftIO $ null <$> Lsof.query ("--" : map fst l)) ( do diff --git a/Assistant/Ssh.hs b/Assistant/Ssh.hs index e1a78cd00e..7b82f46242 100644 --- a/Assistant/Ssh.hs +++ b/Assistant/Ssh.hs @@ -92,7 +92,7 @@ parseSshUrl u , sshCapabilities = [] } where - (user, host) = if '@' `elem` userhost + (user, host) = if '@' `elem` userhost then separate (== '@') userhost else ("", userhost) fromrsync s @@ -260,7 +260,7 @@ setupSshKeyPair sshkeypair sshdata = do fixSshKeyPairIdentitiesOnly :: IO () fixSshKeyPairIdentitiesOnly = changeUserSshConfig $ unlines . go [] . lines where - go c [] = reverse c + go c [] = reverse c go c (l:[]) | all (`isInfixOf` l) indicators = go (fixedline l:l:c) [] | otherwise = go (l:c) [] @@ -268,7 +268,7 @@ fixSshKeyPairIdentitiesOnly = changeUserSshConfig $ unlines . go [] . lines | all (`isInfixOf` l) indicators && not ("IdentitiesOnly" `isInfixOf` next) = go (fixedline l:l:c) (next:rest) | otherwise = go (l:c) (next:rest) - indicators = ["IdentityFile", "key.git-annex"] + indicators = ["IdentityFile", "key.git-annex"] fixedline tmpl = takeWhile isSpace tmpl ++ "IdentitiesOnly yes" {- Add StrictHostKeyChecking to any ssh config stanzas that were written diff --git a/Assistant/Threads/Committer.hs b/Assistant/Threads/Committer.hs index 4a47a9e2c9..47c2aa4aae 100644 --- a/Assistant/Threads/Committer.hs +++ b/Assistant/Threads/Committer.hs @@ -164,8 +164,8 @@ waitChangeTime a = waitchanges 0 -} aftermaxcommit oldchanges = loop (30 :: Int) where - loop 0 = continue oldchanges - loop n = do + loop 0 = continue oldchanges + loop n = do liftAnnex noop -- ensure Annex state is free liftIO $ threadDelaySeconds (Seconds 1) changes <- getAnyChanges @@ -301,7 +301,7 @@ handleAdds havelsof delayadd cs = returnWhen (null incomplete) $ do add change@(InProcessAddChange { keySource = ks }) = catchDefaultIO Nothing <~> doadd where - doadd = sanitycheck ks $ do + doadd = sanitycheck ks $ do (mkey, mcache) <- liftAnnex $ do showStart "add" $ keyFilename ks Command.Add.ingest $ Just ks diff --git a/Assistant/Threads/Cronner.hs b/Assistant/Threads/Cronner.hs index 0fe7f58f4c..6dc6f4c6b1 100644 --- a/Assistant/Threads/Cronner.hs +++ b/Assistant/Threads/Cronner.hs @@ -87,7 +87,7 @@ cronnerThread urlrenderer = namedThreadUnchecked "Cronner" $ do liftIO $ waitNotification h debug ["reloading changed activities"] go h amap' nmap' - startactivities as lastruntimes = forM as $ \activity -> + startactivities as lastruntimes = forM as $ \activity -> case connectActivityUUID activity of Nothing -> do runner <- asIO2 (sleepingActivityThread urlrenderer) @@ -108,8 +108,8 @@ cronnerThread urlrenderer = namedThreadUnchecked "Cronner" $ do sleepingActivityThread :: UrlRenderer -> ScheduledActivity -> Maybe LocalTime -> Assistant () sleepingActivityThread urlrenderer activity lasttime = go lasttime =<< getnexttime lasttime where - getnexttime = liftIO . nextTime schedule - go _ Nothing = debug ["no scheduled events left for", desc] + getnexttime = liftIO . nextTime schedule + go _ Nothing = debug ["no scheduled events left for", desc] go l (Just (NextTimeExactly t)) = waitrun l t Nothing go l (Just (NextTimeWindow windowstart windowend)) = waitrun l windowstart (Just windowend) @@ -129,7 +129,7 @@ sleepingActivityThread urlrenderer activity lasttime = go lasttime =<< getnextti go l =<< getnexttime l else run nowt where - tolate nowt tz = case mmaxt of + tolate nowt tz = case mmaxt of Just maxt -> nowt > maxt -- allow the job to start 10 minutes late Nothing ->diffUTCTime diff --git a/Assistant/Threads/SanityChecker.hs b/Assistant/Threads/SanityChecker.hs index 3371f212fc..9fd963a69b 100644 --- a/Assistant/Threads/SanityChecker.hs +++ b/Assistant/Threads/SanityChecker.hs @@ -258,7 +258,7 @@ checkOldUnused :: UrlRenderer -> Assistant () checkOldUnused urlrenderer = go =<< annexExpireUnused <$> liftAnnex Annex.getGitConfig where go (Just Nothing) = noop - go (Just (Just expireunused)) = expireUnused (Just expireunused) + go (Just (Just expireunused)) = expireUnused (Just expireunused) go Nothing = maybe noop prompt =<< describeUnusedWhenBig prompt msg = diff --git a/Assistant/Threads/UpgradeWatcher.hs b/Assistant/Threads/UpgradeWatcher.hs index ffad09d3dd..431e6f339e 100644 --- a/Assistant/Threads/UpgradeWatcher.hs +++ b/Assistant/Threads/UpgradeWatcher.hs @@ -51,9 +51,9 @@ upgradeWatcherThread urlrenderer = namedThread "UpgradeWatcher" $ do let depth = length (splitPath dir) + 1 let nosubdirs f = length (splitPath f) == depth void $ liftIO $ watchDir dir nosubdirs False hooks (startup mvar) - -- Ignore bogus events generated during the startup scan. + -- Ignore bogus events generated during the startup scan. -- We ask the watcher to not generate them, but just to be safe.. - startup mvar scanner = do + startup mvar scanner = do r <- scanner void $ swapMVar mvar Started return r diff --git a/Assistant/Threads/Upgrader.hs b/Assistant/Threads/Upgrader.hs index 637c82a7d9..100c15414d 100644 --- a/Assistant/Threads/Upgrader.hs +++ b/Assistant/Threads/Upgrader.hs @@ -39,7 +39,7 @@ upgraderThread urlrenderer = namedThread "Upgrader" $ h <- liftIO . newNotificationHandle False . networkConnectedNotifier =<< getDaemonStatus go h =<< liftIO getCurrentTime where - {- Wait for a network connection event. Then see if it's been + {- Wait for a network connection event. Then see if it's been - half a day since the last upgrade check. If so, proceed with - check. -} go h lastchecked = do diff --git a/Assistant/Threads/Watcher.hs b/Assistant/Threads/Watcher.hs index fe9a95471b..2e69e1640d 100644 --- a/Assistant/Threads/Watcher.hs +++ b/Assistant/Threads/Watcher.hs @@ -72,7 +72,7 @@ needLsof = error $ unlines {- A special exception that can be thrown to pause or resume the watcher. -} data WatcherControl = PauseWatcher | ResumeWatcher - deriving (Show, Eq, Typeable) + deriving (Show, Eq, Typeable) instance E.Exception WatcherControl @@ -192,7 +192,7 @@ runHandler handler file filestatus = void $ do liftAnnex Annex.Queue.flushWhenFull recordChange change where - normalize f + normalize f | "./" `isPrefixOf` file = drop 2 f | otherwise = f @@ -246,7 +246,7 @@ onAddDirect symlinkssupported matcher file fs = do debug ["add direct", file] add matcher file where - {- On a filesystem without symlinks, we'll get changes for regular + {- On a filesystem without symlinks, we'll get changes for regular - files that git uses to stand-in for symlinks. Detect when - this happens, and stage the symlink, rather than annexing the - file. -} @@ -276,7 +276,7 @@ onAddSymlink isdirect file filestatus = unlessIgnored file $ do onAddSymlink' :: Maybe String -> Maybe Key -> Bool -> Handler onAddSymlink' linktarget mk isdirect file filestatus = go mk where - go (Just key) = do + go (Just key) = do when isdirect $ liftAnnex $ void $ addAssociatedFile key file link <- liftAnnex $ inRepo $ gitAnnexLink file key diff --git a/Assistant/Threads/WebApp.hs b/Assistant/Threads/WebApp.hs index 416c078741..d01096c7a9 100644 --- a/Assistant/Threads/WebApp.hs +++ b/Assistant/Threads/WebApp.hs @@ -6,6 +6,7 @@ -} {-# LANGUAGE TemplateHaskell, MultiParamTypeClasses #-} +{-# LANGUAGE ViewPatterns, OverloadedStrings #-} {-# LANGUAGE CPP #-} {-# OPTIONS_GHC -fno-warn-orphans #-} @@ -97,7 +98,7 @@ webAppThread assistantdata urlrenderer noannex cannotrun postfirstrun listenhost urlfile <- getAnnex' $ fromRepo gitAnnexUrlFile go tlssettings addr webapp htmlshim (Just urlfile) where - -- The webapp thread does not wait for the startupSanityCheckThread + -- The webapp thread does not wait for the startupSanityCheckThread -- to finish, so that the user interface remains responsive while -- that's going on. thread = namedThreadUnchecked "WebApp" diff --git a/Assistant/Threads/XMPPClient.hs b/Assistant/Threads/XMPPClient.hs index 2f70b508f6..8ce99eac64 100644 --- a/Assistant/Threads/XMPPClient.hs +++ b/Assistant/Threads/XMPPClient.hs @@ -131,7 +131,7 @@ xmppClient urlrenderer d creds xmppuuid = {- XEP-0199 says that the server will respond with either - a ping response or an error message. Either will - cause traffic, so good enough. -} - pingstanza = xmppPing selfjid + pingstanza = xmppPing selfjid handlemsg selfjid (PresenceMessage p) = do void $ inAssistant $ diff --git a/Assistant/Threads/XMPPPusher.hs b/Assistant/Threads/XMPPPusher.hs index 30c91c7f09..35c76ebf1a 100644 --- a/Assistant/Threads/XMPPPusher.hs +++ b/Assistant/Threads/XMPPPusher.hs @@ -34,7 +34,7 @@ xmppReceivePackThread = pusherThread "XMPPReceivePack" ReceivePack pusherThread :: String -> PushSide -> UrlRenderer -> NamedThread pusherThread threadname side urlrenderer = namedThread threadname $ go Nothing where - go lastpushedto = do + go lastpushedto = do msg <- waitPushInitiation side $ selectNextPush lastpushedto debug ["started running push", logNetMessage msg] @@ -78,4 +78,4 @@ selectNextPush lastpushedto l = go [] l (Pushing clientid _) | Just clientid /= lastpushedto -> (m, rejected ++ ms) _ -> go (m:rejected) ms - go [] [] = undefined + go [] [] = undefined diff --git a/Assistant/TransferQueue.hs b/Assistant/TransferQueue.hs index 93c982224b..d138e16efd 100644 --- a/Assistant/TransferQueue.hs +++ b/Assistant/TransferQueue.hs @@ -92,7 +92,7 @@ queueTransfersMatching matching reason schedule k f direction filterM (wantSend True (Just k) f . Remote.uuid) $ filter (\r -> not (inset s r || Remote.readonly r)) rs where - locs = S.fromList <$> Remote.keyLocations k + locs = S.fromList <$> Remote.keyLocations k inset s r = S.member (Remote.uuid r) s gentransfer r = Transfer { transferDirection = direction diff --git a/Assistant/Types/NetMessager.hs b/Assistant/Types/NetMessager.hs index 5ae987a616..f5ad85b4a4 100644 --- a/Assistant/Types/NetMessager.hs +++ b/Assistant/Types/NetMessager.hs @@ -85,7 +85,7 @@ logNetMessage (Pushing c stage) = show $ Pushing (logClientID c) $ SendPackOutput n _ -> SendPackOutput n elided s -> s where - elided = T.encodeUtf8 $ T.pack "" + elided = T.encodeUtf8 $ T.pack "" logNetMessage (PairingNotification stage c uuid) = show $ PairingNotification stage (logClientID c) uuid logNetMessage m = show m diff --git a/Assistant/Upgrade.hs b/Assistant/Upgrade.hs index b847068c29..a05d5e316a 100644 --- a/Assistant/Upgrade.hs +++ b/Assistant/Upgrade.hs @@ -52,7 +52,7 @@ unattendedUpgrade = do prepUpgrade :: Assistant () prepUpgrade = do void $ addAlert upgradingAlert - void $ liftIO $ setEnv upgradedEnv "1" True + liftIO $ setEnv upgradedEnv "1" True prepRestart postUpgrade :: URLString -> Assistant () @@ -78,7 +78,7 @@ upgradedEnv = "GIT_ANNEX_UPGRADED" startDistributionDownload :: GitAnnexDistribution -> Assistant () startDistributionDownload d = go =<< liftIO . newVersionLocation d =<< liftIO oldVersionLocation where - go Nothing = debug ["Skipping redundant upgrade"] + go Nothing = debug ["Skipping redundant upgrade"] go (Just dest) = do liftAnnex $ setUrlPresent k u hook <- asIO1 $ distributionDownloadComplete d dest cleanup diff --git a/Assistant/WebApp/Bootstrap3.hs b/Assistant/WebApp/Bootstrap3.hs index 795778a8d4..3fa20fc4dd 100644 --- a/Assistant/WebApp/Bootstrap3.hs +++ b/Assistant/WebApp/Bootstrap3.hs @@ -1,7 +1,6 @@ {-# LANGUAGE QuasiQuotes #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE CPP #-} -- | Helper functions for creating forms when using Bootstrap v3. -- This is a copy of the Yesod.Form.Bootstrap3 module that has been slightly -- modified to be compatible with Yesod 1.0.1 @@ -149,20 +148,13 @@ data BootstrapFormLayout = -- > ^{bootstrapSubmit MsgSubmit} -- -- Since: yesod-form 1.3.8 -#if MIN_VERSION_yesod(1,2,0) -renderBootstrap3 :: Monad m => BootstrapFormLayout -> FormRender m a -#else renderBootstrap3 :: BootstrapFormLayout -> FormRender sub master a -#endif renderBootstrap3 formLayout aform fragment = do (res, views') <- aFormToForm aform let views = views' [] has (Just _) = True has Nothing = False widget = [whamlet| -#if MIN_VERSION_yesod(1,2,0) - $newline never -#endif #{fragment} $forall view <- views
@@ -193,11 +185,7 @@ renderBootstrap3 formLayout aform fragment = do nequals a b = a /= b -- work around older hamlet versions not liking /= -- | (Internal) Render a help widget for tooltips and errors. -#if MIN_VERSION_yesod(1,2,0) -helpWidget :: FieldView site -> WidgetT site IO () -#else helpWidget :: FieldView sub master -> GWidget sub master () -#endif helpWidget view = [whamlet| $maybe tt <- fvTooltip view #{tt} @@ -242,13 +230,7 @@ instance IsString msg => IsString (BootstrapSubmit msg) where -- layout. -- -- Since: yesod-form 1.3.8 -#if MIN_VERSION_yesod(1,2,0) -bootstrapSubmit - :: (RenderMessage site msg, HandlerSite m ~ site, MonadHandler m) - => BootstrapSubmit msg -> AForm m () -#else bootstrapSubmit :: (RenderMessage master msg) => BootstrapSubmit msg -> AForm sub master () -#endif bootstrapSubmit = formToAForm . liftM (second return) . mbootstrapSubmit @@ -257,13 +239,7 @@ bootstrapSubmit = formToAForm . liftM (second return) . mbootstrapSubmit -- anyway. -- -- Since: yesod-form 1.3.8 -#if MIN_VERSION_yesod(1,2,0) -mbootstrapSubmit - :: (RenderMessage site msg, HandlerSite m ~ site, MonadHandler m) - => BootstrapSubmit msg -> MForm m (FormResult (), FieldView site) -#else mbootstrapSubmit :: (RenderMessage master msg) => BootstrapSubmit msg -> MForm sub master (FormResult (), FieldView sub master) -#endif mbootstrapSubmit (BootstrapSubmit msg classes attrs) = let res = FormSuccess () widget = [whamlet|
") }) + + (\theId name isSel -> do { (asWidgetT . toWidget) + ((Text.Blaze.Internal.preEscapedText . pack) @@ -1098,7 +1107,77 @@ index c6091a9..3d7b267 100644 , fieldEnctype = UrlEncoded } -@@ -665,9 +1114,21 @@ fileField = Field +@@ -559,69 +1008,6 @@ optionsPairs opts = do + optionsEnum :: (MonadHandler m, Show a, Enum a, Bounded a) => m (OptionList a) + optionsEnum = optionsPairs $ map (\x -> (pack $ show x, x)) [minBound..maxBound] + +-#if MIN_VERSION_persistent(2, 0, 0) +-optionsPersist :: ( YesodPersist site, PersistEntity a +- , PersistQuery (PersistEntityBackend a) +- , PathPiece (Key a) +- , RenderMessage site msg +- , YesodPersistBackend site ~ PersistEntityBackend a +- ) +-#else +-optionsPersist :: ( YesodPersist site, PersistEntity a +- , PersistQuery (YesodPersistBackend site (HandlerT site IO)) +- , PathPiece (Key a) +- , PersistEntityBackend a ~ PersistMonadBackend (YesodPersistBackend site (HandlerT site IO)) +- , RenderMessage site msg +- ) +-#endif +- => [Filter a] +- -> [SelectOpt a] +- -> (a -> msg) +- -> HandlerT site IO (OptionList (Entity a)) +-optionsPersist filts ords toDisplay = fmap mkOptionList $ do +- mr <- getMessageRender +- pairs <- runDB $ selectList filts ords +- return $ map (\(Entity key value) -> Option +- { optionDisplay = mr (toDisplay value) +- , optionInternalValue = Entity key value +- , optionExternalValue = toPathPiece key +- }) pairs +- +--- | An alternative to 'optionsPersist' which returns just the @Key@ instead of +--- the entire @Entity@. +--- +--- Since 1.3.2 +-#if MIN_VERSION_persistent(2, 0, 0) +-optionsPersistKey +- :: (YesodPersist site +- , PersistEntity a +- , PersistQuery (PersistEntityBackend a) +- , PathPiece (Key a) +- , RenderMessage site msg +- , YesodPersistBackend site ~ PersistEntityBackend a +- ) +-#else +-optionsPersistKey +- :: (YesodPersist site +- , PersistEntity a +- , PersistQuery (YesodPersistBackend site (HandlerT site IO)) +- , PathPiece (Key a) +- , RenderMessage site msg +- , PersistEntityBackend a ~ PersistMonadBackend (YesodDB site)) +-#endif +- => [Filter a] +- -> [SelectOpt a] +- -> (a -> msg) +- -> HandlerT site IO (OptionList (Key a)) +- +-optionsPersistKey filts ords toDisplay = fmap mkOptionList $ do +- mr <- getMessageRender +- pairs <- runDB $ selectList filts ords +- return $ map (\(Entity key value) -> Option +- { optionDisplay = mr (toDisplay value) +- , optionInternalValue = key +- , optionExternalValue = toPathPiece key +- }) pairs + + selectFieldHelper + :: (Eq a, RenderMessage site FormMessage) +@@ -665,9 +1051,21 @@ fileField = Field case files of [] -> Right Nothing file:_ -> Right $ Just file @@ -1123,7 +1202,7 @@ index c6091a9..3d7b267 100644 , fieldEnctype = Multipart } -@@ -694,10 +1155,19 @@ fileAFormReq fs = AForm $ \(site, langs) menvs ints -> do +@@ -694,10 +1092,19 @@ fileAFormReq fs = AForm $ \(site, langs) menvs ints -> do { fvLabel = toHtml $ renderMessage site langs $ fsLabel fs , fvTooltip = fmap (toHtml . renderMessage site langs) $ fsTooltip fs , fvId = id' @@ -1147,7 +1226,7 @@ index c6091a9..3d7b267 100644 , fvErrors = errs , fvRequired = True } -@@ -726,10 +1196,19 @@ fileAFormOpt fs = AForm $ \(master, langs) menvs ints -> do +@@ -726,10 +1133,19 @@ fileAFormOpt fs = AForm $ \(master, langs) menvs ints -> do { fvLabel = toHtml $ renderMessage master langs $ fsLabel fs , fvTooltip = fmap (toHtml . renderMessage master langs) $ fsTooltip fs , fvId = id' @@ -1172,10 +1251,10 @@ index c6091a9..3d7b267 100644 , fvRequired = False } diff --git a/Yesod/Form/Functions.hs b/Yesod/Form/Functions.hs -index 5fd03e6..b14d900 100644 +index 9e6abaf..0c2a0ce 100644 --- a/Yesod/Form/Functions.hs +++ b/Yesod/Form/Functions.hs -@@ -59,12 +59,16 @@ import Text.Blaze (Markup, toMarkup) +@@ -60,12 +60,16 @@ import Text.Blaze (Markup, toMarkup) #define toHtml toMarkup import Yesod.Core import Network.Wai (requestMethod) @@ -1193,7 +1272,7 @@ index 5fd03e6..b14d900 100644 -- | Get a unique identifier. newFormIdent :: Monad m => MForm m Text -@@ -216,7 +220,14 @@ postHelper form env = do +@@ -217,7 +221,14 @@ postHelper form env = do let token = case reqToken req of Nothing -> mempty @@ -1209,7 +1288,7 @@ index 5fd03e6..b14d900 100644 m <- getYesod langs <- languages ((res, xml), enctype) <- runFormGeneric (form token) m langs env -@@ -296,7 +307,12 @@ getHelper :: MonadHandler m +@@ -297,7 +308,12 @@ getHelper :: MonadHandler m -> Maybe (Env, FileEnv) -> m (a, Enctype) getHelper form env = do @@ -1223,7 +1302,7 @@ index 5fd03e6..b14d900 100644 langs <- languages m <- getYesod runFormGeneric (form fragment) m langs env -@@ -331,10 +347,15 @@ identifyForm +@@ -332,10 +348,15 @@ identifyForm identifyForm identVal form = \fragment -> do -- Create hidden . let fragment' = @@ -1243,7 +1322,7 @@ index 5fd03e6..b14d900 100644 -- Check if we got its value back. mp <- askParams -@@ -364,22 +385,70 @@ renderTable, renderDivs, renderDivsNoLabels :: Monad m => FormRender m a +@@ -365,22 +386,70 @@ renderTable, renderDivs, renderDivsNoLabels :: Monad m => FormRender m a renderTable aform fragment = do (res, views') <- aFormToForm aform let views = views' [] @@ -1330,7 +1409,7 @@ index 5fd03e6..b14d900 100644 return (res, widget) where addIsFirst [] = [] -@@ -395,19 +464,66 @@ renderDivsMaybeLabels :: Monad m => Bool -> FormRender m a +@@ -396,19 +465,66 @@ renderDivsMaybeLabels :: Monad m => Bool -> FormRender m a renderDivsMaybeLabels withLabels aform fragment = do (res, views') <- aFormToForm aform let views = views' [] @@ -1410,7 +1489,7 @@ index 5fd03e6..b14d900 100644 return (res, widget) -- | Render a form using Bootstrap v2-friendly shamlet syntax. -@@ -435,19 +551,62 @@ renderBootstrap2 aform fragment = do +@@ -436,19 +552,62 @@ renderBootstrap2 aform fragment = do let views = views' [] has (Just _) = True has Nothing = False @@ -2002,18 +2081,6 @@ index 7e4af07..b59745a 100644 , fieldEnctype = UrlEncoded } where -diff --git a/yesod-form.cabal b/yesod-form.cabal -index bfe94df..1f5aef5 100644 ---- a/yesod-form.cabal -+++ b/yesod-form.cabal -@@ -51,7 +51,6 @@ library - exposed-modules: Yesod.Form - Yesod.Form.Types - Yesod.Form.Functions -- Yesod.Form.Bootstrap3 - Yesod.Form.Input - Yesod.Form.Fields - Yesod.Form.Jquery -- -2.1.0 +2.1.1 diff --git a/standalone/no-th/haskell-patches/yesod-persistent_do-not-really-build.patch b/standalone/no-th/haskell-patches/yesod-persistent_do-not-really-build.patch index a2210d4c4a..76aad4e340 100644 --- a/standalone/no-th/haskell-patches/yesod-persistent_do-not-really-build.patch +++ b/standalone/no-th/haskell-patches/yesod-persistent_do-not-really-build.patch @@ -1,14 +1,14 @@ -From 92a34bc2b09572a58a4e696e0d8a0a61475535f7 Mon Sep 17 00:00:00 2001 +From e82ed4e6fd7b5ea6dbe474b5de2755ec5794161c Mon Sep 17 00:00:00 2001 From: dummy -Date: Tue, 10 Jun 2014 19:09:56 +0000 -Subject: [PATCH] do not really build +Date: Thu, 16 Oct 2014 02:23:50 +0000 +Subject: [PATCH] stub out --- yesod-persistent.cabal | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/yesod-persistent.cabal b/yesod-persistent.cabal -index b44499b..ef33863 100644 +index b116f3a..017b184 100644 --- a/yesod-persistent.cabal +++ b/yesod-persistent.cabal @@ -14,16 +14,6 @@ description: Some helpers for using Persistent from Yesod. @@ -16,8 +16,8 @@ index b44499b..ef33863 100644 library build-depends: base >= 4 && < 5 - , yesod-core >= 1.2.2 && < 1.3 -- , persistent >= 1.2 && < 1.4 -- , persistent-template >= 1.2 && < 1.4 +- , persistent >= 1.2 && < 2.1 +- , persistent-template >= 1.2 && < 2.1 - , transformers >= 0.2.2 - , blaze-builder - , conduit @@ -29,5 +29,5 @@ index b44499b..ef33863 100644 test-suite test -- -2.0.0 +2.1.1 diff --git a/standalone/no-th/haskell-patches/yesod_hack-TH.patch b/standalone/no-th/haskell-patches/yesod_hack-TH.patch index 001d4a4712..ebf8a786b1 100644 --- a/standalone/no-th/haskell-patches/yesod_hack-TH.patch +++ b/standalone/no-th/haskell-patches/yesod_hack-TH.patch @@ -1,13 +1,13 @@ -From da032b804c0a35c2831664e28c9211f4fe712593 Mon Sep 17 00:00:00 2001 +From 59091cd37958fee79b9e346fe3118d5ed7d0104b Mon Sep 17 00:00:00 2001 From: dummy -Date: Tue, 10 Jun 2014 20:39:42 +0000 -Subject: [PATCH] avoid TH +Date: Thu, 16 Oct 2014 02:36:37 +0000 +Subject: [PATCH] hack TH --- Yesod.hs | 19 ++++++++++++-- - Yesod/Default/Main.hs | 32 +----------------------- + Yesod/Default/Main.hs | 31 +---------------------- Yesod/Default/Util.hs | 69 ++------------------------------------------------- - 3 files changed, 20 insertions(+), 100 deletions(-) + 3 files changed, 20 insertions(+), 99 deletions(-) diff --git a/Yesod.hs b/Yesod.hs index b367144..fbe309c 100644 @@ -41,7 +41,7 @@ index b367144..fbe309c 100644 +insert = undefined + diff --git a/Yesod/Default/Main.hs b/Yesod/Default/Main.hs -index 565ed35..41c2df0 100644 +index 565ed35..bf46642 100644 --- a/Yesod/Default/Main.hs +++ b/Yesod/Default/Main.hs @@ -1,10 +1,8 @@ @@ -64,7 +64,7 @@ index 565ed35..41c2df0 100644 import System.Log.FastLogger (LogStr, toLogStr) import Language.Haskell.TH.Syntax (qLocation) -@@ -55,34 +53,6 @@ defaultMain load getApp = do +@@ -55,33 +53,6 @@ defaultMain load getApp = do type LogFunc = Loc -> LogSource -> LogLevel -> LogStr -> IO () @@ -95,10 +95,9 @@ index 565ed35..41c2df0 100644 -#else - const True -#endif -- + -- | Run your application continously, listening for SIGINT and exiting -- when received - -- diff --git a/Yesod/Default/Util.hs b/Yesod/Default/Util.hs index a10358e..0547424 100644 --- a/Yesod/Default/Util.hs @@ -196,5 +195,5 @@ index a10358e..0547424 100644 - else return $ Just ex - else return Nothing -- -2.0.0 +2.1.1