diff options
author | Joey Hess <joey@kitenet.net> | 2011-09-30 15:02:08 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-09-30 15:02:29 -0400 |
commit | 29032cb70e66d18f25b9b942eb01dceeeb8aa300 (patch) | |
tree | ae8887cccb688b310b489924e3a3a2f0b311fbf2 /Remote.hs | |
parent | f88738223ee5156baac8f0fa0bde6d701f1fdd07 (diff) |
When displaying a list of repositories, show git remote names in addition to their descriptions.
Diffstat (limited to 'Remote.hs')
-rw-r--r-- | Remote.hs | 21 |
1 files changed, 14 insertions, 7 deletions
@@ -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) |