Commands that allow specifying which repository to act on using the repository's description will now fail when multiple repositories match, rather than picking a repository at random.
So will --in= Note that since limitIn is not used by preferred content expressions, it's ok for it to throw an exception.
This commit is contained in:
parent
935d3f562d
commit
005e8744c1
3 changed files with 24 additions and 16 deletions
34
Remote.hs
34
Remote.hs
|
@ -37,6 +37,7 @@ module Remote (
|
||||||
keyPossibilities,
|
keyPossibilities,
|
||||||
keyPossibilitiesTrusted,
|
keyPossibilitiesTrusted,
|
||||||
nameToUUID,
|
nameToUUID,
|
||||||
|
nameToUUID',
|
||||||
showTriedRemotes,
|
showTriedRemotes,
|
||||||
showLocations,
|
showLocations,
|
||||||
forceTrust,
|
forceTrust,
|
||||||
|
@ -48,7 +49,6 @@ module Remote (
|
||||||
import qualified Data.Map as M
|
import qualified Data.Map as M
|
||||||
import Text.JSON
|
import Text.JSON
|
||||||
import Text.JSON.Generic
|
import Text.JSON.Generic
|
||||||
import Data.Tuple
|
|
||||||
import Data.Ord
|
import Data.Ord
|
||||||
|
|
||||||
import Common.Annex
|
import Common.Annex
|
||||||
|
@ -121,23 +121,25 @@ noRemoteUUIDMsg r = "cannot determine uuid for " ++ name r
|
||||||
- and returns its UUID. Finds even repositories that are not
|
- and returns its UUID. Finds even repositories that are not
|
||||||
- configured in .git/config. -}
|
- configured in .git/config. -}
|
||||||
nameToUUID :: RemoteName -> Annex UUID
|
nameToUUID :: RemoteName -> Annex UUID
|
||||||
nameToUUID "." = getUUID -- special case for current repo
|
nameToUUID = either error return <=< nameToUUID'
|
||||||
nameToUUID "here" = getUUID
|
|
||||||
nameToUUID "" = error "no remote specified"
|
nameToUUID' :: RemoteName -> Annex (Either String UUID)
|
||||||
nameToUUID n = byName' n >>= go
|
nameToUUID' "." = Right <$> getUUID -- special case for current repo
|
||||||
|
nameToUUID' "here" = Right <$> getUUID
|
||||||
|
nameToUUID' n = byName' n >>= go
|
||||||
where
|
where
|
||||||
go (Right r) = case uuid r of
|
go (Right r) = return $ case uuid r of
|
||||||
NoUUID -> error $ noRemoteUUIDMsg r
|
NoUUID -> Left $ noRemoteUUIDMsg r
|
||||||
u -> return u
|
u -> Right u
|
||||||
go (Left e) = fromMaybe (error e) <$> bydescription
|
go (Left e) = do
|
||||||
bydescription = do
|
|
||||||
m <- uuidMap
|
m <- uuidMap
|
||||||
case M.lookup n $ transform swap m of
|
return $ case M.keys (M.filter (== n) m) of
|
||||||
Just u -> return $ Just u
|
[u] -> Right u
|
||||||
Nothing -> return $ byuuid m
|
[] -> let u = toUUID n
|
||||||
byuuid m = M.lookup (toUUID n) $ transform double m
|
in case M.keys (M.filterWithKey (\k _ -> k == u) m) of
|
||||||
transform a = M.fromList . map a . M.toList
|
[] -> Left e
|
||||||
double (a, _) = (a, a)
|
_ -> Right u
|
||||||
|
_us -> Left "Found multiple repositories with that description"
|
||||||
|
|
||||||
{- Pretty-prints a list of UUIDs of remotes, for human display.
|
{- Pretty-prints a list of UUIDs of remotes, for human display.
|
||||||
-
|
-
|
||||||
|
|
4
debian/changelog
vendored
4
debian/changelog
vendored
|
@ -10,6 +10,10 @@ git-annex (5.20140307) UNRELEASED; urgency=medium
|
||||||
* webapp: Use securemem for constant time auth token comparisons.
|
* webapp: Use securemem for constant time auth token comparisons.
|
||||||
* copy --fast --to remote: Avoid printing anything for files that
|
* copy --fast --to remote: Avoid printing anything for files that
|
||||||
are already believed to be present on the remote.
|
are already believed to be present on the remote.
|
||||||
|
* Commands that allow specifying which repository to act on using
|
||||||
|
the repository's description will now fail when multiple repositories
|
||||||
|
match, rather than picking a repository at random.
|
||||||
|
(So will --in=)
|
||||||
|
|
||||||
-- Joey Hess <joeyh@debian.org> Thu, 06 Mar 2014 16:17:01 -0400
|
-- Joey Hess <joeyh@debian.org> Thu, 06 Mar 2014 16:17:01 -0400
|
||||||
|
|
||||||
|
|
|
@ -40,3 +40,5 @@ Now, git annex dead somecopy will randomly (based on the order of the UUIDs?) ch
|
||||||
### What version of git-annex are you using? On what operating system?
|
### What version of git-annex are you using? On what operating system?
|
||||||
|
|
||||||
git-annex 4.20131024 on linux. Also occurs on OSX.
|
git-annex 4.20131024 on linux. Also occurs on OSX.
|
||||||
|
|
||||||
|
> [[fixed|done]] --[[Joey]]
|
||||||
|
|
Loading…
Reference in a new issue