convert existing non-annexed file to non-exception
This commit is contained in:
parent
b26ce646e4
commit
b9f921248e
3 changed files with 21 additions and 8 deletions
|
@ -258,8 +258,7 @@ performQuvi relaxed pageurl videourl file = ifAnnexed file addurl geturl
|
||||||
|
|
||||||
#ifdef WITH_QUVI
|
#ifdef WITH_QUVI
|
||||||
addUrlFileQuvi :: Bool -> URLString -> URLString -> FilePath -> Annex (Maybe Key)
|
addUrlFileQuvi :: Bool -> URLString -> URLString -> FilePath -> Annex (Maybe Key)
|
||||||
addUrlFileQuvi relaxed quviurl videourl file = do
|
addUrlFileQuvi relaxed quviurl videourl file = stopUnless (doesNotExist file) $ do
|
||||||
checkDoesNotExist file
|
|
||||||
let key = Backend.URL.fromUrl quviurl Nothing
|
let key = Backend.URL.fromUrl quviurl Nothing
|
||||||
ifM (pure relaxed <||> Annex.getState Annex.fast)
|
ifM (pure relaxed <||> Annex.getState Annex.fast)
|
||||||
( do
|
( do
|
||||||
|
@ -309,19 +308,20 @@ addUrlChecked relaxed url u checkexistssize key
|
||||||
)
|
)
|
||||||
|
|
||||||
addUrlFile :: Bool -> URLString -> Url.UrlInfo -> FilePath -> Annex (Maybe Key)
|
addUrlFile :: Bool -> URLString -> Url.UrlInfo -> FilePath -> Annex (Maybe Key)
|
||||||
addUrlFile relaxed url urlinfo file = do
|
addUrlFile relaxed url urlinfo file = stopUnless (doesNotExist file) $ do
|
||||||
checkDoesNotExist file
|
|
||||||
liftIO $ createDirectoryIfMissing True (parentDir file)
|
liftIO $ createDirectoryIfMissing True (parentDir file)
|
||||||
ifM (Annex.getState Annex.fast <||> pure relaxed)
|
ifM (Annex.getState Annex.fast <||> pure relaxed)
|
||||||
( nodownload url urlinfo file
|
( nodownload url urlinfo file
|
||||||
, downloadWeb url urlinfo file
|
, downloadWeb url urlinfo file
|
||||||
)
|
)
|
||||||
|
|
||||||
checkDoesNotExist :: FilePath -> Annex ()
|
doesNotExist :: FilePath -> Annex Bool
|
||||||
checkDoesNotExist file = go =<< liftIO (catchMaybeIO $ getSymbolicLinkStatus file)
|
doesNotExist file = go =<< liftIO (catchMaybeIO $ getSymbolicLinkStatus file)
|
||||||
where
|
where
|
||||||
go Nothing = return ()
|
go Nothing = return True
|
||||||
go (Just _) = error $ file ++ " already exists and is not annexed; not overwriting"
|
go (Just _) = do
|
||||||
|
warning $ file ++ " already exists and is not annexed; not overwriting"
|
||||||
|
return False
|
||||||
|
|
||||||
downloadWeb :: URLString -> Url.UrlInfo -> FilePath -> Annex (Maybe Key)
|
downloadWeb :: URLString -> Url.UrlInfo -> FilePath -> Annex (Maybe Key)
|
||||||
downloadWeb url urlinfo file = do
|
downloadWeb url urlinfo file = do
|
||||||
|
|
|
@ -17,3 +17,5 @@ $> echo "http://www.onerussian.com/tmp/banner.png 123" | git annex addurl --batc
|
||||||
"""]]
|
"""]]
|
||||||
|
|
||||||
[[!meta author=yoh]]
|
[[!meta author=yoh]]
|
||||||
|
|
||||||
|
> [[fixed|done]] --[[Joey]]
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
[[!comment format=mdwn
|
||||||
|
username="joey"
|
||||||
|
subject="""comment 2"""
|
||||||
|
date="2016-01-15T18:24:28Z"
|
||||||
|
content="""
|
||||||
|
Dude, you're /dev/nulling stderr, where the error is printed.
|
||||||
|
|
||||||
|
In any case, sure, we can make addurl not throw a fatal error in this
|
||||||
|
particular case. There are of course many other error conditions where it
|
||||||
|
may still throw a fatal error.
|
||||||
|
"""]]
|
Loading…
Add table
Reference in a new issue