Merge branch 'master' into symlink-missing

This commit is contained in:
Joey Hess 2020-11-16 10:03:12 -04:00
commit 26cf26caca
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
13 changed files with 100 additions and 43 deletions

View file

@ -65,7 +65,7 @@ main = do
topdir <- getCurrentDirectory topdir <- getCurrentDirectory
changeWorkingDirectory repodir changeWorkingDirectory repodir
updated <- catMaybes <$> mapM (getbuild repodir) autobuilds updated <- catMaybes <$> mapM (getbuild repodir) autobuilds
state <- Annex.new =<< Git.Construct.fromPath "." state <- Annex.new =<< Git.Construct.fromPath (toRawFilePath ".")
ood <- Annex.eval state $ do ood <- Annex.eval state $ do
buildrpms topdir updated buildrpms topdir updated
makeinfos updated version makeinfos updated version
@ -84,7 +84,7 @@ getbuild repodir (url, f) = do
let dest = repodir </> f let dest = repodir </> f
let tmp = dest ++ ".tmp" let tmp = dest ++ ".tmp"
removeWhenExistsWith removeFile tmp removeWhenExistsWith removeFile tmp
createDirectoryIfMissing True (parentDir dest) createDirectoryIfMissing True (fromRawFilePath (parentDir (toRawFilePath dest)))
let oops s = do let oops s = do
removeWhenExistsWith removeFile tmp removeWhenExistsWith removeFile tmp
putStrLn $ "*** " ++ s putStrLn $ "*** " ++ s

View file

@ -1,4 +1,14 @@
git-annex (8.20201104) UNRELEASED; urgency=medium git-annex (8.20201117) UNRELEASED; urgency=medium
* adjust: New --unlock-present mode which locks files whose content is not
present (so the broken symlink is visible), while unlocking files whose
content is present.
* examinekey: Added a "file" format variable for consistency with find,
and for easier scripting.
-- Joey Hess <id@joeyh.name> Mon, 16 Nov 2020 09:38:32 -0400
git-annex (8.20201116) upstream; urgency=medium
* move: Fix a regression in the last release that made move --to not * move: Fix a regression in the last release that made move --to not
honor numcopies settings. honor numcopies settings.
@ -10,11 +20,8 @@ git-annex (8.20201104) UNRELEASED; urgency=medium
copied it from some other repository. copied it from some other repository.
* examinekey: Added two new format variables: objectpath and objectpointer * examinekey: Added two new format variables: objectpath and objectpointer
* examinekey: Added --migrate-to-backend * examinekey: Added --migrate-to-backend
* adjust: New --unlock-present mode which locks files whose content is not
present (so the broken symlink is visible), while unlocking files whose
content is present.
-- Joey Hess <id@joeyh.name> Mon, 09 Nov 2020 15:15:20 -0400 -- Joey Hess <id@joeyh.name> Mon, 16 Nov 2020 09:36:35 -0400
git-annex (8.20201103) upstream; urgency=medium git-annex (8.20201103) upstream; urgency=medium

View file

@ -9,7 +9,7 @@ module Command.ExamineKey where
import Command import Command
import qualified Utility.Format import qualified Utility.Format
import Command.Find (parseFormatOption, showFormatted, keyVars) import Command.Find (parseFormatOption, showFormatted, formatVars)
import Annex.Link import Annex.Link
import Backend import Backend
import Types.Backend import Types.Backend
@ -57,7 +57,7 @@ run o _ input = do
showFormatted (format o) (serializeKey' k) $ showFormatted (format o) (serializeKey' k) $
[ ("objectpath", fromRawFilePath objectpath) [ ("objectpath", fromRawFilePath objectpath)
, ("objectpointer", fromRawFilePath objectpointer) , ("objectpointer", fromRawFilePath objectpointer)
] ++ keyVars k ] ++ formatVars k af
return True return True
where where
-- Parse the input, which is either a key, or in batch mode -- Parse the input, which is either a key, or in batch mode

View file

@ -75,7 +75,8 @@ seek o = do
start :: FindOptions -> SeekInput -> RawFilePath -> Key -> CommandStart start :: FindOptions -> SeekInput -> RawFilePath -> Key -> CommandStart
start o _ file key = startingCustomOutput key $ do start o _ file key = startingCustomOutput key $ do
showFormatted (formatOption o) file $ ("file", fromRawFilePath file) : keyVars key showFormatted (formatOption o) file
(formatVars key (AssociatedFile (Just file)))
next $ return True next $ return True
startKeys :: FindOptions -> (SeekInput, Key, ActionItem) -> CommandStart startKeys :: FindOptions -> (SeekInput, Key, ActionItem) -> CommandStart
@ -92,8 +93,9 @@ showFormatted format unformatted vars =
Utility.Format.format formatter $ Utility.Format.format formatter $
M.fromList vars M.fromList vars
keyVars :: Key -> [(String, String)] formatVars :: Key -> AssociatedFile -> [(String, String)]
keyVars key = formatVars key (AssociatedFile af) =
(maybe id (\f l -> (("file", fromRawFilePath f) : l)) af)
[ ("key", serializeKey key) [ ("key", serializeKey key)
, ("backend", decodeBS $ formatKeyVariety $ fromKey keyVariety key) , ("backend", decodeBS $ formatKeyVariety $ fromKey keyVariety key)
, ("bytesize", size show) , ("bytesize", size show)

View file

@ -95,10 +95,8 @@ perform o remotemap key ai = do
mapM_ (showRemoteUrls remotemap) urls mapM_ (showRemoteUrls remotemap) urls
Just formatter -> liftIO $ do Just formatter -> liftIO $ do
let vs = catMaybes let vs = Command.Find.formatVars key
[ fmap (("file",) . fromRawFilePath) (AssociatedFile (actionItemWorkTreeFile ai))
(actionItemWorkTreeFile ai)
] ++ Command.Find.keyVars key
let showformatted muuid murl = putStr $ let showformatted muuid murl = putStr $
Utility.Format.format formatter $ Utility.Format.format formatter $
M.fromList $ vs ++ catMaybes M.fromList $ vs ++ catMaybes

View file

@ -33,6 +33,7 @@ touch file mtime = touchBoth file mtime mtime
#else #else
import Data.Time.Clock.POSIX import Data.Time.Clock.POSIX
import Utility.RawFilePath
{- Noop for Windows -} {- Noop for Windows -}
touchBoth :: RawFilePath -> POSIXTime -> POSIXTime -> Bool -> IO () touchBoth :: RawFilePath -> POSIXTime -> POSIXTime -> Bool -> IO ()

View file

@ -0,0 +1,8 @@
[[!comment format=mdwn
username="wting"
avatar="http://cdn.libravatar.org/avatar/ff65dc4f3eb58490220b89a7984c4d02"
subject="comment 3"
date="2020-11-13T23:08:26Z"
content="""
Thanks everyone for the quick response and turnaround on this!
"""]]

View file

@ -28,7 +28,8 @@ that can be determined purely by looking at the key.
These variables are also available for use in formats: ${key}, ${backend}, These variables are also available for use in formats: ${key}, ${backend},
${bytesize}, ${humansize}, ${keyname}, ${hashdirlower}, ${hashdirmixed}, ${bytesize}, ${humansize}, ${keyname}, ${hashdirlower}, ${hashdirmixed},
${mtime} (for the mtime field of a WORM key). ${mtime} (for the mtime field of a WORM key), ${file} (when a filename is
provided to examinekey).
Also, '\\n' is a newline, '\\000' is a NULL, etc. Also, '\\n' is a newline, '\\000' is a NULL, etc.

View file

@ -1,25 +0,0 @@
git-annex 8.20200810 released with [[!toggle text="these changes"]]
[[!toggleable text="""
* Added support for external backend programs. So if you want a hash
that git-annex doesn't support, or something stranger, you can write a
small program to implement it.
* Fix a bug in find --branch in the previous version.
* importfeed: Fix reversion that caused some '.' in filenames to be
replaced with '\_'
* Fix a lock file descriptor leak that could occur when running commands
like git-annex add with -J. Bug was introduced as part of a different FD
leak fix in version 6.20160318.
* Fix a hang when using git-annex with an old openssh 7.2p2, which had
some weird inheriting of ssh FDs by sshd. Bug was introduced in
git-annex version 7.20200202.7.
* move, copy --to: Sped up seeking files by 2x.
* drop: Sped up seeking files to drop by 2x, and also some performance
improvements to checking numcopies.
* Deal with unusual IFS settings in the shell scripts for linux
standalone and OSX app.
Thanks, Yaroslav Halchenko
* Avoid complaining that a file with "is beyond a symbolic link"
when the filepath is absolute and the symlink in question is not
actually inside the git repository.
* Slightly sped up the linux standalone bundle.
* Support building with dlist-1.0"""]]

View file

@ -0,0 +1,15 @@
git-annex 8.20201116 released with [[!toggle text="these changes"]]
[[!toggleable text="""
git-annex (8.20201116) upstream; urgency=medium
.
* move: Fix a regression in the last release that made move --to not
honor numcopies settings.
* sync --content: Fix a bug where a file that was not preferred content
could be transferred to a remote. This happened when the file got deleted
after the sync started running.
* Warn when adding a annex symlink or pointer file that uses a key that
is not known to the repository, to prevent confusion if the user has
copied it from some other repository.
* examinekey: Added two new format variables: objectpath and objectpointer
* examinekey: Added --migrate-to-backend
"""]]

View file

@ -0,0 +1,43 @@
[[!comment format=mdwn
username="yarikoptic"
avatar="http://cdn.libravatar.org/avatar/f11e9c84cb18d26a1748c33b48c924b4"
subject="comment 5"
date="2020-11-14T02:00:13Z"
content="""
Woohoo -- thank you Joey!
Here is my complete example which seems to work quite neatly. One aspect which you might (or not -- shouldn't matter to me but bash people might appreciate): could \"${filename}\" (if provided to examinekey) be passed into `format` as well? that would allow for easy looping like in this example, but on more than one key at a time.
Unrelated, just curious -- what is the best way to \"chain\" multiple batch processes in bash, like here `examinekey` and `registerurl`?
```bash
$> cat ./addurl-uberfast.sh
#!/bin/bash
export PS4='> '
set -x
set -eu
cd \"$(mktemp -d ${TMPDIR:-/tmp}/dl-XXXXXXX)\"
md5=f92bbc617f8c8714a251f1f208af37a0
size=6605
filename=GLwDrawA.h
url=http://www.onerussian.com/tmp/$filename
git init
git annex init
echo MD5-s$size--$md5 $filename | \
git-annex examinekey --batch --format='${key} ${objectpath}\n' --migrate-to-backend=MD5E | \
while read key objectpath; do
git-annex registerurl \"$key\" \"$url\"
# examinekey does not know ${filename} in its format so such looping isn't exactly
# possible easily in bash ATM
ln -s \"$objectpath\" \"$filename\"
git add \"$filename\"
git annex get \"$filename\"
git annex drop \"$filename\"
done
```
"""]]

View file

@ -0,0 +1,7 @@
[[!comment format=mdwn
username="joey"
subject="""comment 6"""
date="2020-11-16T13:52:12Z"
content="""
Good idea, I added ${file}
"""]]

View file

@ -1,5 +1,5 @@
Name: git-annex Name: git-annex
Version: 8.20201103 Version: 8.20201116
Cabal-Version: >= 1.10 Cabal-Version: >= 1.10
License: AGPL-3 License: AGPL-3
Maintainer: Joey Hess <id@joeyh.name> Maintainer: Joey Hess <id@joeyh.name>