summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-12-02 16:59:55 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-12-02 16:59:55 -0400
commit251c01d51e22dc295359ba1f85144afc4c178e7a (patch)
treef8b19d157e09349194ffe40591250a72c16c8f30
parent7b08584c5553c22b322a2d9c268fda855666f4ce (diff)
dead: A command which says that a repository is gone for good and you don't want git-annex to mention it again.
-rw-r--r--GitAnnex.hs2
-rw-r--r--Logs/Location.hs10
-rw-r--r--Logs/Trust.hs6
-rw-r--r--Types/TrustLevel.hs2
-rw-r--r--debian/changelog2
-rw-r--r--doc/git-annex.mdwn5
-rw-r--r--doc/tips/what_to_do_when_you_lose_a_repository.mdwn18
-rw-r--r--doc/trust.mdwn10
8 files changed, 40 insertions, 15 deletions
diff --git a/GitAnnex.hs b/GitAnnex.hs
index 42a6b7fd7..d768499dd 100644
--- a/GitAnnex.hs
+++ b/GitAnnex.hs
@@ -46,6 +46,7 @@ import qualified Command.Uninit
import qualified Command.Trust
import qualified Command.Untrust
import qualified Command.Semitrust
+import qualified Command.Dead
import qualified Command.AddUrl
import qualified Command.Map
import qualified Command.Upgrade
@@ -70,6 +71,7 @@ cmds = concat
, Command.Trust.def
, Command.Untrust.def
, Command.Semitrust.def
+ , Command.Dead.def
, Command.AddUrl.def
, Command.FromKey.def
, Command.DropKey.def
diff --git a/Logs/Location.hs b/Logs/Location.hs
index cb21a2d1c..27b4d709e 100644
--- a/Logs/Location.hs
+++ b/Logs/Location.hs
@@ -27,6 +27,7 @@ module Logs.Location (
import Common.Annex
import qualified Annex.Branch
import Logs.Presence
+import Logs.Trust
{- Log a change in the presence of a key's value in a repository. -}
logChange :: Key -> UUID -> LogStatus -> Annex ()
@@ -34,9 +35,14 @@ logChange key (UUID u) s = addLog (logFile key) =<< logNow s u
logChange _ NoUUID _ = return ()
{- Returns a list of repository UUIDs that, according to the log, have
- - the value of a key. -}
+ - the value of a key.
+ -
+ - Dead repositories are skipped.
+ -}
keyLocations :: Key -> Annex [UUID]
-keyLocations key = map toUUID <$> (currentLog . logFile) key
+keyLocations key = do
+ l <- map toUUID <$> (currentLog . logFile) key
+ snd <$> trustPartition DeadTrusted l
{- Finds all keys that have location log information.
- (There may be duplicate keys in the list.) -}
diff --git a/Logs/Trust.hs b/Logs/Trust.hs
index e447fbebc..f18f42511 100644
--- a/Logs/Trust.hs
+++ b/Logs/Trust.hs
@@ -67,12 +67,14 @@ parseTrust s
w = words s
parse "1" = Trusted
parse "0" = UnTrusted
+ parse "X" = DeadTrusted
parse _ = SemiTrusted
showTrust :: TrustLevel -> String
-showTrust SemiTrusted = "?"
-showTrust UnTrusted = "0"
showTrust Trusted = "1"
+showTrust UnTrusted = "0"
+showTrust DeadTrusted = "X"
+showTrust SemiTrusted = "?"
{- Changes the trust level for a uuid in the trustLog. -}
trustSet :: UUID -> TrustLevel -> Annex ()
diff --git a/Types/TrustLevel.hs b/Types/TrustLevel.hs
index ddb8e45e4..99d749730 100644
--- a/Types/TrustLevel.hs
+++ b/Types/TrustLevel.hs
@@ -14,7 +14,7 @@ import qualified Data.Map as M
import Types.UUID
-data TrustLevel = SemiTrusted | UnTrusted | Trusted
+data TrustLevel = Trusted | SemiTrusted | UnTrusted | DeadTrusted
deriving Eq
type TrustMap = M.Map UUID TrustLevel
diff --git a/debian/changelog b/debian/changelog
index d038c7849..4a2a3dd06 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -15,6 +15,8 @@ git-annex (3.20111123) UNRELEASED; urgency=low
git repository.
* --inbackend can be used to make git-annex only operate on files
whose content is stored using a specified key-value backend.
+ * dead: A command which says that a repository is gone for good
+ and you don't want git-annex to mention it again.
-- Joey Hess <joeyh@debian.org> Tue, 22 Nov 2011 17:53:42 -0400
diff --git a/doc/git-annex.mdwn b/doc/git-annex.mdwn
index e98c89fe3..9df5c3c6d 100644
--- a/doc/git-annex.mdwn
+++ b/doc/git-annex.mdwn
@@ -173,6 +173,11 @@ subdirectories).
Returns a repository to the default semi trusted state.
+* dead [repository ...]
+
+ Indicates that the repository has been irretrevably lost.
+ (To undo, use semitrust.)
+
# REPOSITORY MAINTENANCE COMMANDS
* fsck [path ...]
diff --git a/doc/tips/what_to_do_when_you_lose_a_repository.mdwn b/doc/tips/what_to_do_when_you_lose_a_repository.mdwn
index 16a55b37b..3be13b8ab 100644
--- a/doc/tips/what_to_do_when_you_lose_a_repository.mdwn
+++ b/doc/tips/what_to_do_when_you_lose_a_repository.mdwn
@@ -4,16 +4,16 @@ drive died or some other misfortune has befallen your data.
Unless you configured backups, git-annex can't get your data back. But it
can help you deal with the loss.
-First, go somewhere that knows about the lost repository, and mark it as
-untrusted.
+Go somewhere that knows about the lost repository, and mark it as
+dead:
- git annex untrust usbdrive
+ git annex dead usbdrive
-To remind yourself later what happened, you can change its description, too:
+This retains the [[location_tracking]] information for the repository,
+but avoids trying to access it, or list it as a location where files
+are present.
- git annex describe usbdrive "USB drive lost in Timbuktu. Probably gone forever."
+If you later found the drive, you could let git-annex know it's found
+like so:
-This retains the [[location_tracking]] information for the repository.
-Maybe you'll find the drive later. Maybe that's impossible. Either way,
-this lets git-annex tell you why a file is no longer accessible, and
-it avoids it relying on that drive to hold any content.
+ git annex semitrusted usbdrive
diff --git a/doc/trust.mdwn b/doc/trust.mdwn
index 7505a7af6..1fd47fd1d 100644
--- a/doc/trust.mdwn
+++ b/doc/trust.mdwn
@@ -1,8 +1,9 @@
-Git-annex supports three levels of trust of a repository:
+Git-annex supports several levels of trust of a repository:
* semitrusted (default)
* untrusted
* trusted
+* dead
## semitrusted
@@ -49,3 +50,10 @@ trust temporarily.
To configure a repository as fully and permanently trusted,
use the `git annex trust` command.
+
+## dead
+
+This is used to indicate that you have no trust that the repository
+exists at all. It's appropriate to use when a drive has been lost,
+or a directory irretrevably deleted. It will make git-annex avoid
+even showing the repository as a place where data might still reside.