summaryrefslogtreecommitdiff
path: root/Assistant/Threads/Merger.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-07-20 19:29:59 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-07-20 19:29:59 -0400
commitb48d7747a3ac8bea7d58e8fff8faf791f98699c0 (patch)
treef5662f9161fd3c74c2f6467be270651d92ac3ead /Assistant/Threads/Merger.hs
parent42e73537d1977eac2da2760647e9131f5c9b9eed (diff)
debugging improvements
add timestamps to debug messages Add lots of debug output in the assistant's threads.
Diffstat (limited to 'Assistant/Threads/Merger.hs')
-rw-r--r--Assistant/Threads/Merger.hs17
1 files changed, 14 insertions, 3 deletions
diff --git a/Assistant/Threads/Merger.hs b/Assistant/Threads/Merger.hs
index c7da86a8d..10ea34692 100644
--- a/Assistant/Threads/Merger.hs
+++ b/Assistant/Threads/Merger.hs
@@ -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