webapp: When a repository's group is changed, rescan for transfers.
This commit is contained in:
parent
c9e4c218a6
commit
740ec66dcf
2 changed files with 27 additions and 9 deletions
|
@ -14,6 +14,7 @@ import Assistant.WebApp.Utility
|
||||||
import Assistant.DaemonStatus
|
import Assistant.DaemonStatus
|
||||||
import Assistant.MakeRemote (uniqueRemoteName)
|
import Assistant.MakeRemote (uniqueRemoteName)
|
||||||
import Assistant.WebApp.Configurators.XMPP (xmppNeeded)
|
import Assistant.WebApp.Configurators.XMPP (xmppNeeded)
|
||||||
|
import Assistant.ScanRemotes
|
||||||
import qualified Remote
|
import qualified Remote
|
||||||
import qualified Types.Remote as Remote
|
import qualified Types.Remote as Remote
|
||||||
import qualified Remote.List as Remote
|
import qualified Remote.List as Remote
|
||||||
|
@ -60,18 +61,12 @@ getRepoConfig uuid mremote = RepoConfig
|
||||||
|
|
||||||
setRepoConfig :: UUID -> Maybe Remote -> RepoConfig -> RepoConfig -> Handler ()
|
setRepoConfig :: UUID -> Maybe Remote -> RepoConfig -> RepoConfig -> Handler ()
|
||||||
setRepoConfig uuid mremote oldc newc = do
|
setRepoConfig uuid mremote oldc newc = do
|
||||||
when (repoDescription oldc /= repoDescription newc) $ liftAnnex $ do
|
when descriptionChanged $ liftAnnex $ do
|
||||||
maybe noop (describeUUID uuid . T.unpack) (repoDescription newc)
|
maybe noop (describeUUID uuid . T.unpack) (repoDescription newc)
|
||||||
void uuidMapLoad
|
void uuidMapLoad
|
||||||
when (repoGroup oldc /= repoGroup newc) $ liftAnnex $
|
when nameChanged $ do
|
||||||
case repoGroup newc of
|
|
||||||
RepoGroupStandard g -> setStandardGroup uuid g
|
|
||||||
RepoGroupCustom s -> groupSet uuid $ S.fromList $ words s
|
|
||||||
when (repoSyncable oldc /= repoSyncable newc) $
|
|
||||||
changeSyncable mremote (repoSyncable newc)
|
|
||||||
when (isJust mremote && makeLegalName (T.unpack $ repoName oldc) /= makeLegalName (T.unpack $ repoName newc)) $ do
|
|
||||||
liftAnnex $ do
|
liftAnnex $ do
|
||||||
name <- fromRepo $ uniqueRemoteName (T.unpack $ repoName newc) 0
|
name <- fromRepo $ uniqueRemoteName (legalName newc) 0
|
||||||
{- git remote rename expects there to be a
|
{- git remote rename expects there to be a
|
||||||
- remote.<name>.fetch, and exits nonzero if
|
- remote.<name>.fetch, and exits nonzero if
|
||||||
- there's not. Special remotes don't normally
|
- there's not. Special remotes don't normally
|
||||||
|
@ -90,6 +85,28 @@ setRepoConfig uuid mremote oldc newc = do
|
||||||
]
|
]
|
||||||
void $ Remote.remoteListRefresh
|
void $ Remote.remoteListRefresh
|
||||||
liftAssistant updateSyncRemotes
|
liftAssistant updateSyncRemotes
|
||||||
|
when groupChanged $ do
|
||||||
|
liftAnnex $ case repoGroup newc of
|
||||||
|
RepoGroupStandard g -> setStandardGroup uuid g
|
||||||
|
RepoGroupCustom s -> groupSet uuid $ S.fromList $ words s
|
||||||
|
{- Enabling syncing will cause a scan,
|
||||||
|
- so avoid queueing a duplicate scan. -}
|
||||||
|
when (repoSyncable newc && not syncableChanged) $ liftAssistant $
|
||||||
|
case mremote of
|
||||||
|
Just remote -> do
|
||||||
|
addScanRemotes True [remote]
|
||||||
|
Nothing -> do
|
||||||
|
addScanRemotes True
|
||||||
|
=<< syncDataRemotes <$> getDaemonStatus
|
||||||
|
when syncableChanged $
|
||||||
|
changeSyncable mremote (repoSyncable newc)
|
||||||
|
where
|
||||||
|
syncableChanged = repoSyncable oldc /= repoSyncable newc
|
||||||
|
groupChanged = repoGroup oldc /= repoGroup newc
|
||||||
|
nameChanged = isJust mremote && legalName oldc /= legalName newc
|
||||||
|
descriptionChanged = repoDescription oldc /= repoDescription newc
|
||||||
|
|
||||||
|
legalName = makeLegalName . T.unpack . repoName
|
||||||
|
|
||||||
editRepositoryAForm :: RepoConfig -> AForm WebApp WebApp RepoConfig
|
editRepositoryAForm :: RepoConfig -> AForm WebApp WebApp RepoConfig
|
||||||
editRepositoryAForm def = RepoConfig
|
editRepositoryAForm def = RepoConfig
|
||||||
|
|
1
debian/changelog
vendored
1
debian/changelog
vendored
|
@ -12,6 +12,7 @@ git-annex (4.20130406) UNRELEASED; urgency=low
|
||||||
* Avoid using runghc when building the Debian package, as that needs ghci.
|
* Avoid using runghc when building the Debian package, as that needs ghci.
|
||||||
* webapp: New --listen= option allows running the webapp on one computer
|
* webapp: New --listen= option allows running the webapp on one computer
|
||||||
and connecting to it from another. (Note: Does not yet use HTTPS.)
|
and connecting to it from another. (Note: Does not yet use HTTPS.)
|
||||||
|
* webapp: When a repository's group is changed, rescan for transfers.
|
||||||
|
|
||||||
-- Joey Hess <joeyh@debian.org> Sat, 06 Apr 2013 15:24:15 -0400
|
-- Joey Hess <joeyh@debian.org> Sat, 06 Apr 2013 15:24:15 -0400
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue