debugging improvements

add timestamps to debug messages

Add lots of debug output in the assistant's threads.
This commit is contained in:
Joey Hess 2012-07-20 19:29:59 -04:00
parent 42e73537d1
commit b48d7747a3
11 changed files with 175 additions and 44 deletions

View file

@ -5,9 +5,12 @@
- Licensed under the GNU GPL version 3 or higher.
-}
module Assistant.Threads.Merger where
module Assistant.Threads.Merger (
mergeThread,
manualPull,
) where
import Common.Annex
import Assistant.Common
import Assistant.ThreadedMonad
import Utility.DirWatcher
import Utility.Types.DirWatcher
@ -19,6 +22,9 @@ import qualified Git.Branch
import qualified Command.Sync
import qualified Remote
thisThread :: ThreadName
thisThread = "Merger"
{- This thread watches for changes to .git/refs/heads/synced/*,
- which indicate incoming pushes. It merges those pushes into the
- currently checked out branch. -}
@ -33,6 +39,7 @@ mergeThread st = do
, errHook = hook onErr
}
void $ watchDir dir (const False) hooks id
debug thisThread ["watching", dir]
type Handler = Git.Repo -> FilePath -> Maybe FileStatus -> IO ()
@ -68,7 +75,11 @@ onAdd g file _
let changedbranch = Git.Ref $
"refs" </> "heads" </> takeFileName file
current <- Git.Branch.current g
when (Just changedbranch == current) $
when (Just changedbranch == current) $ do
liftIO $ debug thisThread
[ "merging changes into"
, show current
]
void $ mergeBranch changedbranch g
mergeBranch :: Git.Ref -> Git.Repo -> IO Bool