From cffc5e74129be798801086c612efd099fe7148ac Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 7 Nov 2013 18:02:00 -0400 Subject: webapp: Improve UI around remote that have no annex.uuid set, either because setup of them is incomplete, or because the remote git repository is not a git-annex repository. Complicated by such repositories potentially being repos that should have an annex.uuid, but it failed to be gotten, perhaps due to the past ssh repo setup bugs. This is handled now by an Upgrade Repository button. --- Assistant/MakeRemote.hs | 1 + Command/List.hs | 2 +- Git/GCrypt.hs | 1 - Git/Remote.hs | 7 +++++-- Git/Types.hs | 4 +++- Remote.hs | 9 ++++++++- Types/Remote.hs | 2 +- debian/changelog | 3 +++ .../unfinished_repository_when_using_annex-ignore_true_.mdwn | 2 ++ 9 files changed, 24 insertions(+), 7 deletions(-) diff --git a/Assistant/MakeRemote.hs b/Assistant/MakeRemote.hs index 32a3fd6f5..bf316e49d 100644 --- a/Assistant/MakeRemote.hs +++ b/Assistant/MakeRemote.hs @@ -20,6 +20,7 @@ import qualified Command.InitRemote import Logs.UUID import Logs.Remote import Git.Remote +import Git.Types (RemoteName) import Creds import Assistant.Gpg import Utility.Gpg (KeyId) diff --git a/Command/List.hs b/Command/List.hs index fda8f3dc7..12c27c022 100644 --- a/Command/List.hs +++ b/Command/List.hs @@ -22,7 +22,7 @@ import Logs.UUID import Annex.UUID import qualified Option import qualified Annex -import Git.Remote +import Git.Types (RemoteName) def :: [Command] def = [noCommit $ withOptions [allrepos] $ command "list" paramPaths seek diff --git a/Git/GCrypt.hs b/Git/GCrypt.hs index 0da68bf24..156441dae 100644 --- a/Git/GCrypt.hs +++ b/Git/GCrypt.hs @@ -15,7 +15,6 @@ import Git.Construct import qualified Git.Config as Config import qualified Git.Command as Command import Utility.Gpg -import Git.Remote urlPrefix :: String urlPrefix = "gcrypt::" diff --git a/Git/Remote.hs b/Git/Remote.hs index dfb6a721c..9d969c416 100644 --- a/Git/Remote.hs +++ b/Git/Remote.hs @@ -11,6 +11,7 @@ module Git.Remote where import Common import Git +import Git.Types import qualified Git.Command import qualified Git.BuildVersion @@ -21,8 +22,6 @@ import Network.URI import Git.FilePath #endif -type RemoteName = String - {- Construct a legal git remote name out of an arbitrary input string. - - There seems to be no formal definition of this in the git source, @@ -62,6 +61,10 @@ remoteLocationIsUrl :: RemoteLocation -> Bool remoteLocationIsUrl (RemoteUrl _) = True remoteLocationIsUrl _ = False +remoteLocationIsSshUrl :: RemoteLocation -> Bool +remoteLocationIsSshUrl (RemoteUrl u) = "ssh://" `isPrefixOf` u +remoteLocationIsSshUrl _ = False + {- Determines if a given remote location is an url, or a local - path. Takes the repository's insteadOf configuration into account. -} parseRemoteLocation :: String -> Repo -> RemoteLocation diff --git a/Git/Types.hs b/Git/Types.hs index 2a33fb27d..e63e93077 100644 --- a/Git/Types.hs +++ b/Git/Types.hs @@ -36,13 +36,15 @@ data Repo = Repo , fullconfig :: M.Map String [String] , remotes :: [Repo] -- remoteName holds the name used for this repo in remotes - , remoteName :: Maybe String + , remoteName :: Maybe RemoteName -- alternate environment to use when running git commands , gitEnv :: Maybe [(String, String)] -- global options to pass to git when running git commands , gitGlobalOpts :: [CommandParam] } deriving (Show, Eq) +type RemoteName = String + {- A git ref. Can be a sha1, or a branch or tag name. -} newtype Ref = Ref String deriving (Eq, Ord) diff --git a/Remote.hs b/Remote.hs index 71db09ce7..56a40c71e 100644 --- a/Remote.hs +++ b/Remote.hs @@ -24,6 +24,7 @@ module Remote ( remoteMap, uuidDescriptions, byName, + byNameOnly, byNameWithUUID, byCost, prettyPrintUUIDs, @@ -58,7 +59,7 @@ import Logs.Trust import Logs.Location hiding (logStatus) import Remote.List import Config -import Git.Remote +import Git.Types (RemoteName) {- Map from UUIDs of Remotes to a calculated value. -} remoteMap :: (Remote -> a) -> Annex (M.Map UUID a) @@ -104,6 +105,12 @@ byName' n = handle . filter matching <$> remoteList handle (match:_) = Right match matching r = n == name r || toUUID n == uuid r +{- Only matches remote name, not UUID -} +byNameOnly :: RemoteName -> Annex (Maybe Remote) +byNameOnly n = headMaybe . filter matching <$> remoteList + where + matching r = n == name r + {- Looks up a remote by name (or by UUID, or even by description), - and returns its UUID. Finds even remotes that are not configured in - .git/config. -} diff --git a/Types/Remote.hs b/Types/Remote.hs index 9afcbbe55..8a94dcc05 100644 --- a/Types/Remote.hs +++ b/Types/Remote.hs @@ -18,7 +18,7 @@ import Types.UUID import Types.GitConfig import Config.Cost import Utility.Metered -import Git.Remote +import Git.Types import Utility.SafeCommand type RemoteConfigKey = String diff --git a/debian/changelog b/debian/changelog index bfa20a8cb..904fa5cb8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -16,6 +16,9 @@ git-annex (5.20131102) UNRELEASED; urgency=low * watcher: Avoid loop when adding a file owned by someone else fails in indirect mode because its permissions cannot be modified. * webapp: Avoid encoding problems when displaying the daemon log file. + * webapp: Improve UI around remote that have no annex.uuid set, + either because setup of them is incomplete, or because the remote + git repository is not a git-annex repository. -- Joey Hess Sat, 02 Nov 2013 14:54:36 -0400 diff --git a/doc/bugs/unfinished_repository_when_using_annex-ignore_true_.mdwn b/doc/bugs/unfinished_repository_when_using_annex-ignore_true_.mdwn index 29de94143..848f1b30b 100644 --- a/doc/bugs/unfinished_repository_when_using_annex-ignore_true_.mdwn +++ b/doc/bugs/unfinished_repository_when_using_annex-ignore_true_.mdwn @@ -21,3 +21,5 @@ Start the webapp. upgrade supported from repository versions: 0 1 2 Kubuntu 13.10 x86_64 + +> [[fixed|done]] --[[Joey]] -- cgit v1.2.3