filestore 0.6.4 → 0.6.5
raw patch · 4 files changed
+113/−100 lines, 4 filesdep ~Diffdep ~containersdep ~timePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: Diff, containers, time
API changes (from Hackage documentation)
Files
- CHANGES +7/−0
- Data/FileStore/Git.hs +91/−4
- extra/post-update +0/−85
- filestore.cabal +15/−11
CHANGES view
@@ -1,3 +1,10 @@+Version 0.6.5 released 28 Aug 2020++* Removed data files in extra.+* Add git post-update script as a ByteString literal in+ Data.FileStore.Git (Justus Adam). This will facilitate+ making gitit independent of data files.+ Version 0.6.4 released 21 Nov 2019 * Data.File.Generic now exports PolyDiff(..) as well as Diff,
Data/FileStore/Git.hs view
@@ -34,7 +34,6 @@ import System.FilePath ((</>), splitFileName) import System.Directory (createDirectoryIfMissing, doesDirectoryExist, executable, getPermissions, setPermissions) import Control.Exception (throwIO)-import Paths_filestore import qualified Control.Exception as E -- | Return a filestore implemented using the git distributed revision control system@@ -79,12 +78,10 @@ then do -- Add the post-update hook, so that changes made remotely via git -- will be reflected in the working directory.- postupdatepath <- getDataFileName $ "extra" </> "post-update"- postupdatecontents <- B.readFile postupdatepath let postupdatedir = repo </> ".git" </> "hooks" createDirectoryIfMissing True postupdatedir let postupdate = postupdatedir </> "post-update"- B.writeFile postupdate postupdatecontents+ B.writeFile postupdate postUpdate perms <- getPermissions postupdate setPermissions postupdate (perms {executable = True}) -- Set up repo to allow push to current branch@@ -369,3 +366,93 @@ pcErr :: forall a. String -> IO a pcErr = throwIO . UnknownError . (++) "filestore parseChanges "++postUpdate :: B.ByteString+postUpdate =+ B.pack + "#!/bin/bash\n\+ \#\n\+ \# This hook does two things:\n\+ \#\n\+ \# 1. update the \"info\" files that allow the list of references to be\n\+ \# queries over dumb transports such as http\n\+ \#\n\+ \# 2. if this repository looks like it is a non-bare repository, and\n\+ \# the checked-out branch is pushed to, then update the working copy.\n\+ \# This makes \"push\" function somewhat similarly to darcs and bzr.\n\+ \#\n\+ \# To enable this hook, make this file executable by \"chmod +x post-update\".\n\+ \\n\+ \git-update-server-info\n\+ \\n\+ \is_bare=$(git-config --get --bool core.bare)\n\+ \\n\+ \if [ -z \"$is_bare\" ]\n\+ \then\n\+ \ # for compatibility's sake, guess\n\+ \ git_dir_full=$(cd $GIT_DIR; pwd)\n\+ \ case $git_dir_full in */.git) is_bare=false;; *) is_bare=true;; esac\n\+ \fi\n\+ \\n\+ \update_wc() {\n\+ \ ref=$1\n\+ \ echo \"Push to checked out branch $ref\" >&2\n\+ \ if [ ! -f $GIT_DIR/logs/HEAD ]\n\+ \ then\n\+ \ echo \"E:push to non-bare repository requires a HEAD reflog\" >&2\n\+ \ exit 1\n\+ \ fi\n\+ \ if (cd $GIT_WORK_TREE; git-diff-files -q --exit-code >/dev/null)\n\+ \ then\n\+ \ wc_dirty=0\n\+ \ else\n\+ \ echo \"W:unstaged changes found in working copy\" >&2\n\+ \ wc_dirty=1\n\+ \ desc=\"working copy\"\n\+ \ fi\n\+ \ if git diff-index --cached HEAD@{1} >/dev/null\n\+ \ then\n\+ \ index_dirty=0\n\+ \ else\n\+ \ echo \"W:uncommitted, staged changes found\" >&2\n\+ \ index_dirty=1\n\+ \ if [ -n \"$desc\" ]\n\+ \ then\n\+ \ desc=\"$desc and index\"\n\+ \ else\n\+ \ desc=\"index\"\n\+ \ fi\n\+ \ fi\n\+ \ if [ \"$wc_dirty\" -ne 0 -o \"$index_dirty\" -ne 0 ]\n\+ \ then\n\+ \ new=$(git rev-parse HEAD)\n\+ \ echo \"W:stashing dirty $desc - see git-stash(1)\" >&2\n\+ \ ( trap 'echo trapped $$; git symbolic-ref HEAD \"'\"$ref\"'\"' 2 3 13 15 ERR EXIT\n\+ \ git-update-ref --no-deref HEAD HEAD@{1}\n\+ \ cd $GIT_WORK_TREE\n\+ \ git stash save \"dirty $desc before update to $new\";\n\+ \ git-symbolic-ref HEAD \"$ref\"\n\+ \ )\n\+ \ fi\n\+ \\n\+ \ # eye candy - show the WC updates :)\n\+ \ echo \"Updating working copy\" >&2\n\+ \ (cd $GIT_WORK_TREE\n\+ \ git-diff-index -R --name-status HEAD >&2\n\+ \ git-reset --hard HEAD)\n\+ \}\n\+ \\n\+ \if [ \"$is_bare\" = \"false\" ]\n\+ \then\n\+ \ active_branch=`git-symbolic-ref HEAD`\n\+ \ export GIT_DIR=$(cd $GIT_DIR; pwd)\n\+ \ GIT_WORK_TREE=${GIT_WORK_TREE-..}\n\+ \ for ref\n\+ \ do\n\+ \ if [ \"$ref\" = \"$active_branch\" ]\n\+ \ then\n\+ \ update_wc $ref\n\+ \ fi\n\+ \ done\n\+ \fi"+
− extra/post-update
@@ -1,85 +0,0 @@-#!/bin/bash-#-# This hook does two things:-#-# 1. update the "info" files that allow the list of references to be-# queries over dumb transports such as http-#-# 2. if this repository looks like it is a non-bare repository, and-# the checked-out branch is pushed to, then update the working copy.-# This makes "push" function somewhat similarly to darcs and bzr.-#-# To enable this hook, make this file executable by "chmod +x post-update".--git-update-server-info--is_bare=$(git-config --get --bool core.bare)--if [ -z "$is_bare" ]-then- # for compatibility's sake, guess- git_dir_full=$(cd $GIT_DIR; pwd)- case $git_dir_full in */.git) is_bare=false;; *) is_bare=true;; esac-fi--update_wc() {- ref=$1- echo "Push to checked out branch $ref" >&2- if [ ! -f $GIT_DIR/logs/HEAD ]- then- echo "E:push to non-bare repository requires a HEAD reflog" >&2- exit 1- fi- if (cd $GIT_WORK_TREE; git-diff-files -q --exit-code >/dev/null)- then- wc_dirty=0- else- echo "W:unstaged changes found in working copy" >&2- wc_dirty=1- desc="working copy"- fi- if git diff-index --cached HEAD@{1} >/dev/null- then- index_dirty=0- else- echo "W:uncommitted, staged changes found" >&2- index_dirty=1- if [ -n "$desc" ]- then- desc="$desc and index"- else- desc="index"- fi- fi- if [ "$wc_dirty" -ne 0 -o "$index_dirty" -ne 0 ]- then- new=$(git rev-parse HEAD)- echo "W:stashing dirty $desc - see git-stash(1)" >&2- ( trap 'echo trapped $$; git symbolic-ref HEAD "'"$ref"'"' 2 3 13 15 ERR EXIT- git-update-ref --no-deref HEAD HEAD@{1}- cd $GIT_WORK_TREE- git stash save "dirty $desc before update to $new";- git-symbolic-ref HEAD "$ref"- )- fi-- # eye candy - show the WC updates :)- echo "Updating working copy" >&2- (cd $GIT_WORK_TREE- git-diff-index -R --name-status HEAD >&2- git-reset --hard HEAD)-}--if [ "$is_bare" = "false" ]-then- active_branch=`git-symbolic-ref HEAD`- export GIT_DIR=$(cd $GIT_DIR; pwd)- GIT_WORK_TREE=${GIT_WORK_TREE-..}- for ref- do- if [ "$ref" = "$active_branch" ]- then- update_wc $ref- fi- done-fi
filestore.cabal view
@@ -1,5 +1,5 @@ Name: filestore-Version: 0.6.4+Version: 0.6.5 Cabal-Version: >= 1.10 Build-type: Simple Synopsis: Interface for versioning file stores.@@ -15,7 +15,7 @@ Maintainer: jgm@berkeley.edu Bug-Reports: https://github.com/jgm/filestore/issues -Data-Files: extra/post-update, CHANGES+Extra-Source-Files: CHANGES Source-repository head type: git@@ -36,22 +36,26 @@ directory >= 1.0 && < 1.4, parsec >= 2 && < 3.2, process >= 1.0 && < 1.7,- time >= 1.5 && < 1.10,+ time >= 1.5 && < 1.11, xml >= 1.3 && < 1.4, split >= 0.1 && < 0.3, Diff >= 0.4 && < 0.5, old-locale >= 1.0 && < 1.1 - Exposed-modules: Data.FileStore, Data.FileStore.Types, Data.FileStore.Git, Data.FileStore.Darcs, Data.FileStore.Mercurial,- -- Data.FileStore.Sqlite3,- Data.FileStore.Utils, Data.FileStore.Generic- Other-modules: Paths_filestore,- Data.FileStore.DarcsXml,- Data.FileStore.MercurialCommandServer,+ Exposed-modules: Data.FileStore+ Data.FileStore.Types+ Data.FileStore.Git+ Data.FileStore.Darcs+ Data.FileStore.Mercurial+ -- Data.FileStore.Sqlite3+ Data.FileStore.Utils+ Data.FileStore.Generic+ Other-modules: Data.FileStore.DarcsXml+ Data.FileStore.MercurialCommandServer Data.FileStore.Compat.Locale- Default-Extensions: FlexibleInstances, CPP+ Default-Extensions: FlexibleInstances Default-Language: Haskell98- if flag(maxcount) + if flag(maxcount) cpp-options: -DUSE_MAXCOUNT if impl(ghc >= 6.12) Ghc-Options: -Wall -fno-warn-unused-do-bind