When displaying a list of repositories, show git remote names in addition to their descriptions.

This commit is contained in:
Joey Hess 2011-09-30 15:02:08 -04:00
parent f88738223e
commit 29032cb70e
4 changed files with 19 additions and 10 deletions

View file

@ -136,18 +136,25 @@ nameToUUID n = do
prettyPrintUUIDs :: String -> [UUID] -> Annex String
prettyPrintUUIDs desc uuids = do
here <- getUUID =<< Annex.gitRepo
m <- M.union <$> uuidMap <*> availMap
m <- M.unionWith addname <$> uuidMap <*> remoteMap
maybeShowJSON [(desc, map (jsonify m here) uuids)]
return $ unwords $ map (\u -> "\t" ++ prettify m here u ++ "\n") uuids
where
availMap = M.fromList . map (\r -> (uuid r, name r)) <$> genList
addname d n
| d == n = d
| otherwise = n ++ " (" ++ d ++ ")"
remoteMap = M.fromList . map (\r -> (uuid r, name r)) <$> genList
findlog m u = M.findWithDefault "" u m
prettify m here u = base ++ ishere
prettify m here u
| not (null d) = u ++ " -- " ++ d
| otherwise = u
where
base = if not $ null $ findlog m u
then u ++ " -- " ++ findlog m u
else u
ishere = if here == u then " <-- here" else ""
ishere = here == u
n = findlog m u
d
| null n && ishere = "here"
| ishere = addname n "here"
| otherwise = n
jsonify m here u = toJSObject
[ ("uuid", toJSON u)
, ("description", toJSON $ findlog m u)

2
debian/changelog vendored
View file

@ -3,6 +3,8 @@ git-annex (3.20110929) UNRELEASED; urgency=low
* Various speed improvements gained by using ByteStrings.
* Fix referring to remotes by uuid.
* status: List all known repositories.
* When displaying a list of repositories, show git remote names
in addition to their descriptions.
-- Joey Hess <joeyh@debian.org> Thu, 29 Sep 2011 18:58:53 -0400

View file

@ -12,7 +12,7 @@ The only quirk I've noticed is this...
<pre>
$ git annex whereis .
whereis frink.jar (2 copies)
084603a8-7243-11e0-b1f5-83102bcd7953 -- testtest <-- here
084603a8-7243-11e0-b1f5-83102bcd7953 -- here (testtest)
1d1bc312-7243-11e0-a9ce-5f10c0ce9b0a
ok
</pre>

View file

@ -13,7 +13,7 @@ file.
0c443de8-e644-11df-acbf-f7cd7ca6210d -- laptop
whereis other_file (3 copies)
0c443de8-e644-11df-acbf-f7cd7ca6210d -- laptop
62b39bbe-4149-11e0-af01-bb89245a1e61 -- usb drive <-- here
62b39bbe-4149-11e0-af01-bb89245a1e61 -- here (usb drive)
7570b02e-15e9-11e0-adf0-9f3f94cb2eaa -- backup drive
What would be handy is some automated versions of get and drop, that only
@ -31,7 +31,7 @@ work toward having two copies of your files.
# git annex whereis
whereis my_cool_big_file (2 copies)
0c443de8-e644-11df-acbf-f7cd7ca6210d -- laptop
62b39bbe-4149-11e0-af01-bb89245a1e61 -- usb drive <-- here
62b39bbe-4149-11e0-af01-bb89245a1e61 -- here (usb drive)
whereis other_file (2 copies)
0c443de8-e644-11df-acbf-f7cd7ca6210d -- laptop
7570b02e-15e9-11e0-adf0-9f3f94cb2eaa -- backup drive