pushme 1.4.0 → 1.5.0
raw patch · 2 files changed
+18/−14 lines, 2 files
Files
- Main.hs +17/−13
- pushme.cabal +1/−1
Main.hs view
@@ -15,9 +15,9 @@ import Control.Lens import Control.Monad ( void, liftM2, (>=>) ) import Data.Aeson ( ToJSON(..), FromJSON(..) )-import Data.Aeson.TH ( deriveJSON )+import Data.Aeson.TH import qualified Data.ByteString.Char8 as BC ( writeFile, readFile )-import Data.Char ( isDigit )+import Data.Char ( isDigit, toLower ) import Data.Data ( Data ) import Data.Foldable ( for_ ) import Data.Function ( on )@@ -44,7 +44,7 @@ import GHC.Conc ( setNumCapabilities, getNumProcessors ) import Options.Applicative import Prelude hiding (FilePath, catch)-import Shelly hiding (find)+import Shelly hiding (find, trace) import System.Environment ( getArgs, withArgs ) import System.IO ( stderr ) import System.IO.Storage ( withStore, putValue, getValue )@@ -71,10 +71,14 @@ instance ToJSON FilePath where toJSON = toJSON . toTextIgnore +#if MIN_VERSION_shelly(1, 0, 0) format = (toStrict .) . Data.Text.Format.format+#else+format = Data.Text.Format.format+#endif version :: String-version = "1.3.0"+version = "1.4.1" copyright :: String copyright = "2013"@@ -135,7 +139,7 @@ makeLenses ''Fileset -$(deriveJSON (drop 8) ''Fileset)+$(deriveJSON defaultOptions{fieldLabelModifier = drop 8, constructorTagModifier = map toLower} ''Fileset) -- | A 'Container' is a physical grouping of files, reflecting an instance of -- a 'Fileset' somewhere on a storage medium. For every 'Fileset', there@@ -155,7 +159,7 @@ makeLenses ''Container -$(deriveJSON (drop 10) ''Container)+$(deriveJSON defaultOptions{fieldLabelModifier = drop 10, constructorTagModifier = map toLower} ''Container) instance NFData Container where rnf a = a `seq` ()@@ -183,7 +187,7 @@ makeLenses ''Store -$(deriveJSON (drop 6) ''Store)+$(deriveJSON defaultOptions{fieldLabelModifier = drop 6, constructorTagModifier = map toLower} ''Store) instance NFData Store where rnf a = a `seq` ()@@ -668,15 +672,16 @@ $ lookup (bnd^.bindingFileset.filesetName) flags annexCmds isRemote path = do- vrun_ "git-annex" $ ["-q" | not verb && not deb] <> ["add", "."]- vrun_ "git-annex" $ ["-q" | not verb && not deb] <> ["sync"] vrun_ "git-annex" $ ["-q" | not verb && not deb]+ <> ["add", "-c", "alwayscommit=false", "."]+ vrun_ "git-annex" $ ["-q" | not verb && not deb] <> [ "--auto" | not ((bnd^.bindingThat.infoStore.storeIsPrimary) || cpAll) ]- <> [ "copy" ]+ <> [ "copy", "-c", "alwayscommit=false" ] <> annexFlags <> [ "--to", bnd^.bindingThat.infoStore.storeAnnexName ]+ vrun_ "git-annex" $ ["-q" | not verb && not deb] <> ["sync"] if isRemote then sub $ do@@ -871,12 +876,11 @@ then silently $ do output <- doCopy (drun False) r toRemote useSudo options' let stats = M.fromList $- map (liftM2 (,) head (head . T.words . last)- . T.splitOn ": ")+ map (fmap (T.filter (/= ',') . (!! 1) . T.words) . T.breakOn ": ") . filter (": " `T.isInfixOf`) . T.lines $ output files = field "Number of files" stats- sent = field "Number of files transferred" stats+ sent = field "Number of regular files transferred" stats total = field "Total file size" stats xfer = field "Total transferred file size" stats noticeL $ format
pushme.cabal view
@@ -1,6 +1,6 @@ Name: pushme -Version: 1.4.0+Version: 1.5.0 Synopsis: Tool to synchronize multiple directories with rsync, zfs or git-annex Description: Script I use for synchronizing my data among machines.