Fix referring to remotes by uuid.

I think that I broke this in some fairly recent refactoring.
This commit is contained in:
Joey Hess 2011-09-30 02:23:24 -04:00
parent c86a2f686a
commit a7e7dda55a
2 changed files with 10 additions and 3 deletions

View file

@ -87,7 +87,8 @@ genList = do
u <- getUUID r u <- getUUID r
generate t r u (M.lookup u m) generate t r u (M.lookup u m)
{- Looks up a remote by name. (Or by UUID.) -} {- Looks up a remote by name. (Or by UUID.) Only finds currently configured
- git remotes. -}
byName :: String -> Annex (Remote Annex) byName :: String -> Annex (Remote Annex)
byName n = do byName n = do
res <- byName' n res <- byName' n
@ -106,7 +107,8 @@ byName' n = do
matching r = n == name r || n == uuid r matching r = n == name r || n == uuid r
{- Looks up a remote by name (or by UUID, or even by description), {- Looks up a remote by name (or by UUID, or even by description),
- and returns its UUID. -} - and returns its UUID. Finds even remotes that are not configured in
- .git/config. -}
nameToUUID :: String -> Annex UUID nameToUUID :: String -> Annex UUID
nameToUUID "." = getUUID =<< Annex.gitRepo -- special case for current repo nameToUUID "." = getUUID =<< Annex.gitRepo -- special case for current repo
nameToUUID n = do nameToUUID n = do
@ -115,7 +117,11 @@ nameToUUID n = do
Left e -> fromMaybe (error e) <$> byDescription Left e -> fromMaybe (error e) <$> byDescription
Right r -> return $ uuid r Right r -> return $ uuid r
where where
byDescription = M.lookup n . invertMap <$> uuidMap byDescription = do
m <- uuidMap
case M.lookup n $ invertMap m of
Just u -> return $ Just u
Nothing -> return $ M.lookup n m
invertMap = M.fromList . map swap . M.toList invertMap = M.fromList . map swap . M.toList
swap (a, b) = (b, a) swap (a, b) = (b, a)

1
debian/changelog vendored
View file

@ -1,6 +1,7 @@
git-annex (3.20110929) UNRELEASED; urgency=low git-annex (3.20110929) UNRELEASED; urgency=low
* Various speed improvements gained by using ByteStrings. * Various speed improvements gained by using ByteStrings.
* Fix referring to remotes by uuid.
-- Joey Hess <joeyh@debian.org> Thu, 29 Sep 2011 18:58:53 -0400 -- Joey Hess <joeyh@debian.org> Thu, 29 Sep 2011 18:58:53 -0400