diff --git a/Setup.lhs b/Setup.lhs
--- a/Setup.lhs
+++ b/Setup.lhs
@@ -146,7 +146,8 @@
           let pkgDescr = localPkgDescr lbi
           let verb = fromFlag (configVerbosity flags)
           checkForeignDeps pkgDescr lbi verb
-          let Just lib = library pkgDescr
+          let lib = maybe (error "darcs library was not configured - did it end up unbuildable?") id
+                          (library pkgDescr)
           let bi = libBuildInfo lib
           bi' <- maybeSetLibiconv flags bi lbi
           return lbi {localPkgDescr = pkgDescr {
@@ -173,8 +174,7 @@
   littleEndian <- testEndianness
   let args = ("-DPACKAGE_VERSION=" ++ show' version) :
              [arg | (arg, True) <-         -- include fst iff snd.
-              [("-DHAVE_HTTP", "x-have-http" `elem` customFields),
-               -- We have MAPI iff building on/for Windows.
+              [-- We have MAPI iff building on/for Windows.
                ("-DHAVE_MAPI", buildOS == Windows),
                ("-DLITTLEENDIAN", littleEndian),
                ("-DBIGENDIAN", not littleEndian)]]
diff --git a/darcs.cabal b/darcs.cabal
--- a/darcs.cabal
+++ b/darcs.cabal
@@ -1,5 +1,5 @@
 Name:           darcs
-version:        2.12.0
+version:        2.12.1
 License:        GPL
 License-file:   COPYING
 Author:         David Roundy <droundy@darcs.net>, <darcs-devel@darcs.net>
@@ -80,9 +80,6 @@
   description: Use pkgconfig to configure libcurl
   default: False
 
-flag http
-  description: Use the pure Haskell HTTP package for HTTP support.
-
 flag static
   description: Build static binary
   default:     False
@@ -118,11 +115,6 @@
     Description: Explicitly link against the libiconv library.
     Default: False
 
--- with time>=1.5 (needed with GHC 7.10) we get defaultTimeLocale from time:Data.Time
--- with time<1.5 we get defaultTimeLocale from old-locale:System.Locale
-flag use-time-1point5
-    default: True
-
 flag network-uri
   description: Get Network.URI from the network-uri package
   default: True
@@ -397,7 +389,7 @@
       c-sources:      src/h_iconv.c
       build-depends:  unix >= 2.6.0.1 && < 2.8
 
-    build-depends:   base >= 4.6 && < 4.10,
+    build-depends:   base >= 4.8 && < 4.10,
                      binary >= 0.5 && < 0.9,
                      containers >= 0.5 && < 0.6,
                      regex-compat-tdfa >= 0.95.1 && < 0.96,
@@ -422,10 +414,14 @@
                      attoparsec   >= 0.11 && < 0.14,
                      zip-archive  >= 0.2.3 && < 0.4,
                      async        >= 2.0.1.4 && < 2.2,
-                     sandi        >= 0.2 && < 0.4,
+                     sandi        >= 0.4 && < 0.5,
                      unix-compat  >= 0.1.2 && < 0.5,
                      bytestring   >= 0.10.0.2 && < 0.11,
                      old-time     >= 1.1 && < 1.2,
+                     time         >= 1.5 && < 1.7,
+    -- release notes of GHC 7.10.2 recommends to use text >= 1.2.1.3:
+    -- https://mail.haskell.org/pipermail/haskell/2015-July/024641.html
+                     text         >= 1.2.1.3 && < 1.3,
                      directory    >= 1.2.0.1 && < 1.3.0.0,
                      process      >= 1.1.0.2 && < 1.5.0.0,
                      array        >= 0.4.0.1 && < 0.6,
@@ -434,19 +430,6 @@
                      mmap         >= 0.5 && < 0.6,
                      zlib         >= 0.5.4.1 && < 0.7.0.0
 
-    -- release notes of GHC 7.10.2 recommends to use text >= 1.2.1.3:
-    -- https://mail.haskell.org/pipermail/haskell/2015-July/024641.html
-    if impl(ghc>=7.10)
-      build-depends:   text       >= 1.2.1.3 && < 1.3
-    else
-      build-depends:   text       >= 0.11.3.1 && < 1.3
-
-    if flag(use-time-1point5)
-      build-depends: time         >= 1.5 && < 1.7
-    else
-      build-depends: time         >= 1.4.0.1 && < 1.5,
-                     old-locale   >= 1.0.0.5 && < 1.1
-
     if flag(optimize)
       ghc-options:      -O2
     else
@@ -460,6 +443,10 @@
     if true
       ghc-options:      -Wall -funbox-strict-fields -fwarn-tabs -fno-warn-dodgy-imports
 
+    if impl(ghc>=8.0)
+      -- This warning is new in GHC 8.0 and is not easy to fix
+      ghc-options:      -fno-warn-redundant-constraints
+
     if flag(curl)
       cpp-options:       -DHAVE_CURL
       c-sources:         src/hscurl.c
@@ -470,17 +457,12 @@
         extra-libraries:   curl
         includes:          curl/curl.h
 
-    if flag(http)
-        if flag(network-uri)
-          build-depends:    network-uri == 2.6.*, network == 2.6.*
-        else
-          build-depends:    network >= 2.4.1.2 && < 2.6
-        build-depends:    HTTP    >= 4000.2.8 && < 4000.4
-        cpp-options:      -DHAVE_HTTP
-        x-have-http:
+    if flag(network-uri)
+      build-depends:    network-uri == 2.6.*, network == 2.6.*
+    else
+      build-depends:    network >= 2.4.1.2 && < 2.6
 
-    if (!flag(curl) && !flag(http))
-        buildable: False
+    build-depends:    HTTP    >= 4000.2.8 && < 4000.4
 
     -- The terminfo package cannot be built on Windows.
     if flag(terminfo) && !os(windows)
@@ -540,11 +522,15 @@
   if flag(rts)
     ghc-options: -rtsopts
 
+  if impl(ghc>=8.0)
+    -- This warning is new in GHC 8.0 and is not easy to fix
+    ghc-options:      -fno-warn-redundant-constraints
+
   -- see http://bugs.darcs.net/issue1037
   cc-options:       -D_REENTRANT
 
   build-depends:   darcs,
-                   base              >= 4.6 && < 4.10
+                   base              >= 4.8 && < 4.10
 
   -- if true to work around cabal bug with flag ordering
   if true
@@ -577,7 +563,7 @@
     build-depends:  Win32 >= 2.2 && < 2.4
 
   build-depends:   darcs,
-                   base         >= 4.6 && < 4.10,
+                   base         >= 4.8 && < 4.10,
                    array        >= 0.4.0.1 && < 0.6,
                    bytestring   >= 0.10.0.2 && < 0.11,
                    cmdargs      >= 0.10 && < 0.11,
@@ -586,21 +572,15 @@
                    mtl          >= 2.1 && < 2.3,
                    shelly       >= 1.6.2 && < 1.7,
                    split        >= 0.2.2 && < 0.3,
+                   text         >= 1.2.1.3 && < 1.3,
                    directory    >= 1.2.0.1 && < 1.3.0.0,
                    FindBin      >= 0.0 && < 0.1,
-                   QuickCheck   >= 2.6 && < 2.9,
+                   QuickCheck   >= 2.6 && < 2.10,
                    HUnit        >= 1.2.5.2 && < 1.4,
                    test-framework             >= 0.4.0 && < 0.9,
                    test-framework-hunit       >= 0.2.2 && < 0.4,
                    test-framework-quickcheck2 >= 0.3 && < 0.4,
                    zip-archive  >= 0.2.3 && < 0.4
-
-  -- release notes of GHC 7.10.2 recommends to use text >= 1.2.1.3:
-  -- https://mail.haskell.org/pipermail/haskell/2015-July/024641.html
-  if impl(ghc>=7.10)
-    build-depends:   text       >= 1.2.1.3 && < 1.3
-  else
-    build-depends:   text       >= 0.11.3.1 && < 1.3
 
   -- list all unit test modules not exported by libdarcs; otherwise Cabal won't
   -- include them in the tarball
diff --git a/harness/test.hs b/harness/test.hs
--- a/harness/test.hs
+++ b/harness/test.hs
@@ -240,7 +240,7 @@
      [ hashed        := False    += help "Run hashed-storage tests [no]"
      , failing       := False    += help "Run the failing (shell) tests [no]"
      , shell         := True     += help "Run the passing, non-network shell tests [yes]"
-     , network       := True     += help "Run the network shell tests [yes]"
+     , network       := False    += help "Run the network shell tests [no]"
      , unit          := True     += help "Run the unit tests [yes]"
      , myers         := False    += help "Use myers diff [no]"
      , patience      := True     += help "Use patience diff [yes]" += name "p"
diff --git a/release/distributed-context b/release/distributed-context
--- a/release/distributed-context
+++ b/release/distributed-context
@@ -1,1 +1,1 @@
-Just "\nContext:\n\n[TAG 2.12.0\nGuillaume Hoffmann <guillaumh@gmail.com>**20160429142058\n Ignore-this: 5c8cbe0424942686a2168f9e6fd8e35d\n] \n"
+Just "\nContext:\n\n[TAG 2.12.1\nGuillaume Hoffmann <guillaumh@gmail.com>**20160905184637\n Ignore-this: 4602b738424e50dc6f9577bc07833dd0\n] \n"
diff --git a/src/Darcs/Patch/ReadMonads.hs b/src/Darcs/Patch/ReadMonads.hs
--- a/src/Darcs/Patch/ReadMonads.hs
+++ b/src/Darcs/Patch/ReadMonads.hs
@@ -193,9 +193,6 @@
 class (Functor m, Applicative m, Alternative m, Monad m, MonadPlus m) => ParserM m where
     -- | Applies a parsing function inside the 'ParserM' monad.
     work :: (B.ByteString -> Maybe (ParserState a)) -> m a
-    -- | Applies a parsing function, that can return 'Nothing',
-    -- inside the 'ParserM' monad.
-    maybeWork :: (B.ByteString -> Maybe (ParserState a)) -> m (Maybe a)
     -- | Allows for the inspection of the input that is yet to be parsed.
     peekInput :: m B.ByteString
     -- | Run the parser
@@ -244,9 +241,6 @@
 
 instance ParserM SM where
     work = SM
-    maybeWork f = SM $ \s -> case f s of
-                                  Just (x :*: s') -> Just (Just x :*: s')
-                                  Nothing -> Just (Nothing :*: s)
     peekInput = SM $ \s -> Just (s :*: s)
     parse = parseStrictly
 
diff --git a/src/Darcs/Patch/V2/Non.hs b/src/Darcs/Patch/V2/Non.hs
--- a/src/Darcs/Patch/V2/Non.hs
+++ b/src/Darcs/Patch/V2/Non.hs
@@ -162,17 +162,14 @@
 
 -- |abstract over 'FL'/'RL'
 class WL l where
-   toFL :: l p wX wY -> FL p wX wY
    toRL :: l p wX wY -> RL p wX wY
    invertWL :: Invert p => l p wX wY -> l p wY wX
 
 instance WL FL where
-   toFL = id
    toRL = reverseFL
    invertWL = reverseRL . invertFL
 
 instance WL RL where
-   toFL = reverseRL
    toRL = id
    invertWL = reverseFL . invertRL
 
diff --git a/src/Darcs/UI/Commands/Record.hs b/src/Darcs/UI/Commands/Record.hs
--- a/src/Darcs/UI/Commands/Record.hs
+++ b/src/Darcs/UI/Commands/Record.hs
@@ -227,27 +227,29 @@
 recordCmd fps cfg args = do
     checkNameIsNotOption (patchname cfg) (isInteractive cfg)
     withRepoLock NoDryRun (useCache cfg) YesUpdateWorking (umask cfg) $ RepoJob $ \(repository :: Repository rt p wR wU wR) -> do
-      files <- if null args then return Nothing
-          else Just . sort <$> fixSubPaths fps args
-      when (files == Just []) $ fail "No valid arguments were given."
       let scan = scanKnown (O.adds (lookfor cfg)) (includeBoring cfg)
-      files' <- traverse (filterExistingPaths repository (verbosity cfg) (useIndex cfg) scan) files
-      when (verbosity cfg /= O.Quiet) $
-          traverse_ (reportNonExisting scan) files'
-      let existing_files = fmap snd files'
-      when (existing_files == Just []) $
-          fail "None of the files you specified exist."
+      existing_files <- do
+        files <- if null args then return Nothing
+                 else Just . sort <$> fixSubPaths fps args
+        when (files == Just []) $ fail "No valid arguments were given."
+        files' <- traverse (filterExistingPaths repository (verbosity cfg) (useIndex cfg) scan) files
+        when (verbosity cfg /= O.Quiet) $
+            traverse_ (reportNonExisting scan) files'
+        let files'' = fmap snd files'
+        when (files'' == Just []) $
+            fail "None of the files you specified exist."
+        return files''
       announceFiles (verbosity cfg) existing_files "Recording changes in"
       debugMessage "About to get the unrecorded changes."
       Sealed replacePs <- if O.replaces (lookfor cfg) == O.YesLookForReplaces
-          then getReplaces (diffingOpts cfg) repository files
+          then getReplaces (diffingOpts cfg) repository existing_files
           else return (Sealed NilFL)
       movesPs <- if O.moves (lookfor cfg) == O.YesLookForMoves
-          then getMovesPs repository files
+          then getMovesPs repository existing_files
           else return NilFL
       changes <- unrecordedChangesWithPatches
                    movesPs (unsafeCoerceP replacePs :: FL (PrimOf p) wR wR)
-                   (diffingOpts cfg) repository files
+                   (diffingOpts cfg) repository existing_files
       debugMessage "I've got unrecorded changes."
       case changes of
           NilFL | not (askDeps cfg) -> do
diff --git a/src/Darcs/UI/Commands/Send.hs b/src/Darcs/UI/Commands/Send.hs
--- a/src/Darcs/UI/Commands/Send.hs
+++ b/src/Darcs/UI/Commands/Send.hs
@@ -37,9 +37,7 @@
 import Control.Monad ( when, unless, forM_ )
 import Darcs.Util.Tree ( Tree )
 import Data.List ( intercalate, isPrefixOf )
-#ifdef HAVE_HTTP
 import Data.List ( stripPrefix )
-#endif
 import Data.Maybe ( isNothing, fromMaybe )
 
 import Darcs.UI.Commands
@@ -482,7 +480,6 @@
     ts -> do announce_recipients ts
              return ts
     where the_targets = collectTargets opts
-#ifdef HAVE_HTTP
           -- the ifdef above is to so that darcs only checks the remote
           -- _darcs/post if we have an implementation of postUrl.  See
           -- our HTTP module for more details
@@ -494,9 +491,6 @@
                           return (p++emails)
           readPost = map parseLine . lines where
               parseLine t = maybe (Post t) SendMail $ stripPrefix "mailto:" t
-#else
-          check_post = who_to_email
-#endif
           who_to_email the_remote_repo =
               do email <- (BC.unpack `fmap`
                            fetchFilePS (prefsUrl the_remote_repo++"/email")
diff --git a/src/Darcs/UI/Commands/WhatsNew.hs b/src/Darcs/UI/Commands/WhatsNew.hs
--- a/src/Darcs/UI/Commands/WhatsNew.hs
+++ b/src/Darcs/UI/Commands/WhatsNew.hs
@@ -27,7 +27,7 @@
 import Prelude ()
 import Darcs.Prelude
 
-import Control.Monad ( void )
+import Control.Monad ( void, when )
 import Control.Monad.Reader ( runReaderT )
 import Control.Monad.State ( evalStateT, liftIO )
 import Darcs.Util.Tree ( Tree )
@@ -73,11 +73,12 @@
     , commandAlias, nodefaults
     )
 import Darcs.Repository.Resolution ( patchsetConflictResolutions )
-import Darcs.UI.Commands.Util ( announceFiles )
+import Darcs.UI.Commands.Util ( announceFiles, filterExistingPaths )
 import Darcs.UI.Flags
     ( DarcsFlag (Summary, LookForAdds, LookForMoves), diffAlgorithm, diffingOpts
     , isUnified, useCache, fixSubPaths
     , verbosity, isInteractive, isUnified, lookForAdds, lookForMoves, lookForReplaces, hasSummary
+    , scanKnown, useIndex
     )
 import Darcs.UI.Options ( DarcsOption, (^), odesc, ocheck, onormalise, defaultFlags, parseFlags )
 import qualified Darcs.UI.Options.All as O
@@ -225,9 +226,16 @@
 whatsnewCmd :: (AbsolutePath, AbsolutePath) -> [DarcsFlag] -> [String] -> IO ()
 whatsnewCmd fps opts args =
    withRepository (useCache opts) $ RepoJob $ \(repo :: Repository rt p wR wU wR) -> do
-    files <- if null args
-                 then return Nothing
-                 else Just <$> fixSubPaths fps args
+    let scan = scanKnown (O.adds (parseFlags O.lookfor opts)) (parseFlags O.includeBoring opts)
+    existing_files <- do
+      files <- if null args then return Nothing
+               else Just . nubSort <$> fixSubPaths fps args
+      when (files == Just []) $ fail "No valid arguments were given."
+      files' <- traverse (filterExistingPaths repo (verbosity opts) (useIndex opts) scan) files
+      let files'' = fmap snd files'
+      when (files'' == Just []) $
+        fail "None of the files you specified exist."
+      return files''
     let isLookForMoves = lookForMoves opts == O.YesLookForMoves && parseFlags O.summary opts /= Just O.NoSummary
         isLookForAdds = lookForAdds opts == O.YesLookForAdds && parseFlags O.summary opts /= Just O.NoSummary
         isLookForReplaces = lookForReplaces opts == O.YesLookForReplaces
@@ -238,12 +246,12 @@
               | isMachineReadable = (Summary:opts)
               | otherwise         = opts
     movesPs <- if isLookForMoves
-        then getMovesPs repo files
+        then getMovesPs repo existing_files
         else return NilFL
     Sealed replacePs <- if isLookForReplaces
-        then getReplaces (diffingOpts opts) repo files
+        then getReplaces (diffingOpts opts) repo existing_files
         else return (Sealed NilFL)
-    Sealed noLookChanges <- filteredUnrecordedChanges opts' repo files movesPs
+    Sealed noLookChanges <- filteredUnrecordedChanges opts' repo existing_files movesPs
                                                                        (unsafeCoerceP replacePs :: FL (PrimOf p) wR wR)
     pristine <- readRecorded repo
     -- If we are looking for moves, return the corresponding FL of changes.
@@ -251,14 +259,14 @@
     Sealed unaddedNewPathsPs <- if isLookForAdds
         then do
             -- Use opts not opts', here, since we *do* want to look for adds.
-            Sealed lookChanges <- filteredUnrecordedChanges opts repo files movesPs (unsafeCoerceP replacePs :: FL (PrimOf p) wR wR)
+            Sealed lookChanges <- filteredUnrecordedChanges opts repo existing_files movesPs (unsafeCoerceP replacePs :: FL (PrimOf p) wR wR)
             noLookAddsTree <- applyAddPatchesToPristine noLookChanges pristine
             lookAddsTree <- applyAddPatchesToPristine lookChanges pristine
             ftf <- filetypeFunction
             -- Return the patches that create files/dirs that aren't yet added.
             unFreeLeft <$> treeDiff (diffAlgorithm opts) ftf noLookAddsTree lookAddsTree
         else return (Sealed NilFL)
-    announceFiles (verbosity opts) files "What's new in"
+    announceFiles (verbosity opts) existing_files "What's new in"
     exitOnNoChanges (unaddedNewPathsPs, noLookChanges)
     if maybeIsInteractive opts
       then runInteractive (interactiveHunks pristine) opts' pristine noLookChanges
diff --git a/src/Darcs/Util/DateTime.hs b/src/Darcs/Util/DateTime.hs
--- a/src/Darcs/Util/DateTime.hs
+++ b/src/Darcs/Util/DateTime.hs
@@ -3,10 +3,6 @@
 --  BSD3
 
 {-# LANGUAGE CPP #-}
-#if MIN_VERSION_time(1,5,0)
--- for parseTime, which we need to use while we support time-1.4
-{-# OPTIONS_GHC -fno-warn-deprecations #-}
-#endif
 module Darcs.Util.DateTime
     ( getCurrentTime, toSeconds
     , formatDateTime, fromClockTime, parseDateTime, startOfTime
@@ -20,17 +16,13 @@
     ( UTCTime(UTCTime), UniversalTime(ModJulianDate)
     , getModJulianDate, secondsToDiffTime, getCurrentTime
     )
-import Data.Time.Format ( formatTime, parseTime )
+import Data.Time.Format ( formatTime, parseTimeM )
 import Data.Time.LocalTime
     ( utc
     , localTimeToUT1, ut1ToLocalTime
     , localTimeToUTC, utcToLocalTime
     )
-#if MIN_VERSION_time(1,5,0)
 import Data.Time ( defaultTimeLocale )
-#else
-import System.Locale ( defaultTimeLocale )
-#endif
 import System.Time ( ClockTime(TOD) )
 
 toSeconds    :: UTCTime -> Integer
@@ -63,7 +55,7 @@
 formatDateTime = formatTime defaultTimeLocale
 
 parseDateTime :: String -> String -> Maybe UTCTime
-parseDateTime = parseTime defaultTimeLocale
+parseDateTime = parseTimeM True defaultTimeLocale
 
 fromClockTime           :: ClockTime -> UTCTime
 fromClockTime (TOD s _) = fromSeconds s
diff --git a/src/Darcs/Util/Download.hs b/src/Darcs/Util/Download.hs
--- a/src/Darcs/Util/Download.hs
+++ b/src/Darcs/Util/Download.hs
@@ -51,11 +51,8 @@
 
 #ifdef HAVE_CURL
 import qualified Darcs.Util.Download.Curl as Curl
-#elif defined(HAVE_HTTP)
-import qualified Darcs.Util.Download.HTTP as HTTP
 #else
-import Darcs.Util.Progress ( debugFail )
-import qualified HTTP ( requestUrl, waitNextUrl )
+import qualified Darcs.Util.Download.HTTP as HTTP
 #endif
 
 #include "impossible.h"
@@ -294,18 +291,11 @@
 waitNextUrl' = Curl.waitNextUrl
 pipeliningEnabled = Curl.pipeliningEnabled
 
-#elif defined(HAVE_HTTP)
+#else
 
 setDebugHTTP = return ()
 requestUrl = HTTP.requestUrl
 waitNextUrl' = HTTP.waitNextUrl
-pipeliningEnabled = return False
-
-#else
-
-setDebugHTTP = debugMessage "URL.setDebugHttp works only with libcurl"
-requestUrl _ _ _ = debugFail "URL.requestUrl: there is no libcurl!"
-waitNextUrl' = debugFail "URL.waitNextUrl': there is no libcurl!"
 pipeliningEnabled = return False
 
 #endif
diff --git a/src/Darcs/Util/Download/HTTP.hs b/src/Darcs/Util/Download/HTTP.hs
--- a/src/Darcs/Util/Download/HTTP.hs
+++ b/src/Darcs/Util/Download/HTTP.hs
@@ -11,7 +11,6 @@
 
 import Darcs.Util.Download.Request ( ConnectionError(..) )
 
-#ifdef HAVE_HTTP
 import Control.Exception ( catch, IOException )
 import Data.IORef ( newIORef, readIORef, writeIORef, IORef )
 import Network.HTTP
@@ -23,7 +22,6 @@
 import qualified Data.ByteString as B
 import qualified Data.ByteString.Char8 as BC
 import Version ( version )
-#endif
 
 fetchUrl :: String -> IO String
 postUrl
@@ -35,8 +33,6 @@
 requestUrl :: String -> FilePath -> a -> IO String
 waitNextUrl :: IO (String, String, Maybe ConnectionError)
 
-#ifdef HAVE_HTTP
-
 headers :: [Header]
 headers =  [Header HdrUserAgent $ "darcs-HTTP/" ++ version]
 
@@ -102,13 +98,3 @@
                        _         -> Nothing
              return (u, e, ce)
     where h = return . ioeGetErrorString
-
-#else
-
-fetchUrl _ = debugFail "Network.HTTP does not exist"
-postUrl _ _ _ = debugFail "Cannot use http POST because darcs was not compiled with Network.HTTP."
-
-requestUrl _ _ _ = debugFail "Network.HTTP does not exist"
-waitNextUrl = debugFail "Network.HTTP does not exist"
-
-#endif
diff --git a/src/Darcs/Util/External.hs b/src/Darcs/Util/External.hs
--- a/src/Darcs/Util/External.hs
+++ b/src/Darcs/Util/External.hs
@@ -60,7 +60,6 @@
 import qualified Data.ByteString as B (ByteString, readFile )
 import qualified Data.ByteString.Lazy as BL
 
-#ifdef HAVE_HTTP
 import Network.Browser
     ( browse
     , request
@@ -79,7 +78,6 @@
     ( parseURI
     , uriScheme
     )
-#endif
 
 
 copyFileOrUrl :: String    -- ^ remote darcs executable
@@ -180,7 +178,6 @@
 -- make sure to force consumption of file contents to avoid that. See
 -- "fetchFilePS" for details.
 fetchFileLazyPS :: String -> Cachable -> IO BL.ByteString
-#ifdef HAVE_HTTP
 fetchFileLazyPS x c = case parseURI x of
   Just x' | uriScheme x' == "http:" -> do
     rsp <- fmap snd . browse $ do
@@ -192,9 +189,6 @@
       then fail $ "fetchFileLazyPS: " ++ rspReason rsp
       else return $ rspBody rsp
   _ -> copyAndReadFile BL.readFile x c
-#else
-fetchFileLazyPS = copyAndReadFile BL.readFile
-#endif
 
 gzFetchFilePS :: String -> Cachable -> IO B.ByteString
 gzFetchFilePS = copyAndReadFile gzReadFilePS
@@ -207,10 +201,6 @@
                            | otherwise = return ()
 
 speculateRemote :: String -> FilePath -> IO () -- speculations are always Cachable
-#if defined(HAVE_CURL) || defined(HAVE_HTTP)
 speculateRemote u v = copyUrl u v Cachable
-#else
-speculateRemote u _ = return ()
-#endif
 
 
diff --git a/src/Darcs/Util/Hash.hs b/src/Darcs/Util/Hash.hs
--- a/src/Darcs/Util/Hash.hs
+++ b/src/Darcs/Util/Hash.hs
@@ -27,8 +27,8 @@
 base16 :: BS.ByteString -> BS.ByteString
 debase16 :: BS.ByteString -> Maybe BS.ByteString
 
-base16 = BS8.map toLower . B16.b16_enc
-debase16 bs = case B16.b16_dec $ BS8.map toUpper bs of
+base16 = BS8.map toLower . B16.b16Enc
+debase16 bs = case B16.b16Dec $ BS8.map toUpper bs of
                 Right (s, _) -> Just s
                 Left _ -> Nothing
 
diff --git a/src/Darcs/Util/Path.hs b/src/Darcs/Util/Path.hs
--- a/src/Darcs/Util/Path.hs
+++ b/src/Darcs/Util/Path.hs
@@ -313,10 +313,9 @@
 
 class CharLike c where
   toChar :: c -> Char
-  fromChar :: Char -> c
+
 instance CharLike Char where
   toChar = id
-  fromChar = id
 
 instance CharLike c => FilePathLike [c] where
   toFilePath = map toChar
diff --git a/tests/annotate.sh b/tests/annotate.sh
--- a/tests/annotate.sh
+++ b/tests/annotate.sh
@@ -1,16 +1,64 @@
 #!/usr/bin/env bash
 . lib
 
-darcs init
+darcs init temp1
+cd temp1
 mkdir a b
 touch a/a b/b
-darcs add --rec .
-darcs record -a -m ab -A test
+darcs record -lam ab
 darcs annotate a/a
 echo x > c
-darcs add c
-darcs record -a -m foo -A 'Mark Stosberg <a@b.com>'
+darcs record -lam foo -A 'Mark Stosberg <a@b.com>'
 darcs annotate c
 darcs annotate c | grep "a@b.com"
 cd ..
-rm -rf temp
+rm -rf temp1
+
+# issue1473 annotate repodir
+mkdir temp1
+cd temp1
+darcs init
+mkdir a b
+touch a/a b/b
+darcs add --rec .
+darcs record -a -m ab -A test
+darcs annotate a/a
+darcs annotate . > inner
+# annotate --repodir=something '.' should work
+cd ..
+darcs annotate --repodir temp1 '.' > temp1/outer
+cd temp1
+diff inner outer
+
+cd ..
+rm -rf temp1
+
+# issue2207 : annotate on directories
+darcs init temp1
+cd temp1
+mkdir d
+touch d/f
+darcs record -lam 'p1'
+darcs annotate d | grep 'p1'
+cd ..
+rm -rf temp1
+
+# issue1473 - check that annotate works with and without
+# repodir and with "." argument.  It should fail with the empty string as
+# a single argument and without any arguments.
+
+darcs init temp1
+cd temp1
+echo 'Example content.' > f
+darcs record -lam 'Added f.'
+darcs annotate .
+darcs annotate f
+not darcs annotate
+not darcs annotate ''
+
+cd ..
+darcs annotate --repodir=temp1 .
+darcs annotate --repodir=temp1 f
+not darcs annotate --repodir=temp1
+not darcs annotate --repodir=temp1 ''
+rm -rf temp1
diff --git a/tests/apply-hunks.sh b/tests/apply-hunks.sh
--- a/tests/apply-hunks.sh
+++ b/tests/apply-hunks.sh
@@ -1,29 +1,29 @@
 #!/usr/bin/env bash
 . ./lib
 
+
+# issue701
 rm -rf temp0 temp1 temp2
 
 # step 1
-mkdir temp0
+darcs init temp0 --darcs-2
 cd temp0
-darcs init --darcs-2
 echo m1 > foo
-darcs add foo
-darcs record -a -m m1 -A moi --ignore-times
+darcs record -lam m1
 cd ..
 
 # step 2
-darcs get temp0 temp1
+darcs clone temp0 temp1
 cd temp1
 echo a1 > foo
-darcs record foo -a -m a1 -A moi --ignore-times
+darcs record foo -a -m a1
 cd ..
 
 
 # step 3
 cd temp0
 echo m2 > foo
-darcs record -a -m m2 -A moi --ignore-times
+darcs record -a -m m2
 cd ..
 
 
@@ -31,26 +31,26 @@
 cd temp1
 darcs pull -a
 echo m2-a1 > foo
-darcs record -a -m 'Fix conflict m2-a1' -A moi --ignore-times
+darcs record -a -m 'Fix conflict m2-a1'
 cd ..
 
 #step 5
 cd temp0
 echo m3 > foo
-darcs record -a -m m3 -A moi --ignore-times
+darcs record -a -m m3
 cd ..
 
 #step 6
-darcs get temp0 temp2
+darcs clone temp0 temp2
 cd temp2
 echo b1 > foo
-darcs record -a -m b1 -A moi --ignore-times
+darcs record -a -m b1
 cd ..
 
 #step 7
 cd temp0
 echo m4 > foo
-darcs record -a -m m4 -A moi --ignore-times
+darcs record -a -m m4
 cd ..
 
 #step 8
diff --git a/tests/apply-reorder.sh b/tests/apply-reorder.sh
--- a/tests/apply-reorder.sh
+++ b/tests/apply-reorder.sh
@@ -6,7 +6,7 @@
 . lib                  # Load some portability helpers.
 
 check_patches_order () {
-    darcs changes | tr -d "\n" | grep $1.*$2.*$3
+    darcs log | tr -d "\n" | grep $1.*$2.*$3
 }
 
 test_init () {
@@ -16,8 +16,7 @@
     cd R1
 
     touch "r1_0"
-    darcs add "r1_0"
-    darcs record -a --author=me -m "Adding r1_0" "r1_0"
+    darcs record -lam "Adding r1_0"
 
     cd ..
 
@@ -26,17 +25,15 @@
     cd R2
 
     touch "r2_0"
-    darcs add "r2_0"
-    darcs record -a --author=me -m "Adding r2_0" "r2_0"
-    darcs send --no-minimize --author=me -a --no-edit-description -o ../R1/P 
+    darcs record -lam "Adding r2_0"
+    darcs send --no-minimize -a --no-edit-description -o ../R1/P 
 
     cd ..
 
     cd R1
 
     touch "r1_1"
-    darcs add "r1_1"
-    darcs record -a --author=me -m "Adding r1_1" "r1_1"
+    darcs record -lam "Adding r1_1"
     
     cd ..
 }
diff --git a/tests/apply.sh b/tests/apply.sh
new file mode 100644
--- /dev/null
+++ b/tests/apply.sh
@@ -0,0 +1,244 @@
+#!/usr/bin/env bash
+## Test for issue2017 - apply should gracefully handle tag missing
+## from context (complain, not crash)
+##
+## Copyright (C) 2010 Eric Kow
+## Copyright (C) 2012 Owen Stephens
+##
+## Permission is hereby granted, free of charge, to any person
+## obtaining a copy of this software and associated documentation
+## files (the "Software"), to deal in the Software without
+## restriction, including without limitation the rights to use, copy,
+## modify, merge, publish, distribute, sublicense, and/or sell copies
+## of the Software, and to permit persons to whom the Software is
+## furnished to do so, subject to the following conditions:
+##
+## The above copyright notice and this permission notice shall be
+## included in all copies or substantial portions of the Software.
+##
+## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+## EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+## MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+## NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+## BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+## ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+## CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+## SOFTWARE.
+
+. lib                           # Load some portability helpers.
+
+# issue1427: apply gzipped bundles
+
+rm -rf temp1 temp2
+
+darcs init temp1
+darcs init temp2
+
+cd temp1
+touch foo bar
+darcs record -lam add_foo_bar
+darcs mv foo zig
+darcs mv bar foo
+darcs mv zig bar
+darcs record -lam swap_foo_bar
+darcs send --output=funpatch --dont-sign -a ../temp2
+
+gzip funpatch
+
+cd ../temp2
+darcs apply ../temp1/funpatch.gz
+cd ..
+cmp temp1/bar temp2/bar
+
+rm -rf temp2
+darcs init temp2
+cd temp2
+darcs apply ../temp1/funpatch.gz
+## Also test that "darcs apply" can accept a patch on stdin.
+darcs obl -a
+darcs apply < ../temp1/funpatch.gz
+cd ..
+cmp temp1/bar temp2/bar
+
+rm -rf temp1 temp2
+
+## issue2017 - apply should gracefully handle tag missing
+## from context (complain, not crash)
+
+darcs init R
+cd R
+echo 'Example content.' > f
+darcs record -lam 'Add f'
+cd ..
+
+# variant 0 - this passes trivially
+darcs clone R R0
+darcs clone R0 S0
+darcs tag 's' --repo S0
+darcs clone S0 T0
+cd T0
+echo 'More content.' > f
+darcs record -lam 'Modify f'
+darcs send -o foo.dpatch -a
+cd ..
+not darcs apply --repo R0 T0/foo.dpatch > log 2>&1
+not grep bug log
+grep missing log
+
+# variant 1 - tag in shared context
+darcs clone R R1
+darcs tag '1' --repo R1
+darcs clone R1 S1
+darcs tag 's1' --repo S1
+darcs clone S1 T1
+cd T1
+echo 'More content.' > f
+darcs record -lam 'Modify f'
+darcs send -o foo.dpatch -a
+cd ..
+# sanity check: should be able to cherry pick
+darcs clone R1 R1b
+cd R1b
+[ `darcs log --count` -eq 2 ]
+darcs pull ../T1 --match 'touch f' --all
+[ `darcs log --count` -eq 3 ]
+cd ..
+# the test: can't apply this due to incorrect context
+not darcs apply --repo R1 T1/foo.dpatch > log 2>&1
+not grep 'bug' log
+grep missing log
+
+# variant 2 - tag created after the fact
+darcs clone R  R2
+darcs clone R2 S2
+darcs tag 's2' --repo S2
+darcs clone S2 T2
+cd T2
+echo 'More content.' > f
+darcs record -lam 'Modify f'
+darcs send -o foo.dpatch -a
+cd ..
+darcs tag '2'  --repo R2  # only tag after
+not darcs apply --repo R2 T2/foo.dpatch > log 2>&1
+not grep 'bug' log
+grep missing log
+
+rm -rf R* S* T*
+
+# issue1921
+# Attempting to apply a patch which depends on a missing tag should not cause
+# darcs to die.
+
+darcs init R
+cd R
+
+# Setup a repo with a tagged patch, and another patch ontop, so we have a split
+# inventory
+touch file1
+darcs rec -alm 'Add file1'
+darcs tag -m 'file1 tag'
+touch file2
+darcs rec -alm 'Add file2'
+
+# Take a copy of the repo at this point
+darcs clone . ../S
+
+# Add the tag which we will fail on
+darcs tag -m 'file2 tag'
+
+# Take a copy with the tag
+darcs clone . ../T
+
+# Add our patch which will depend only on the last tag.
+echo 'file1' > file1
+darcs rec -am 'file1 content'
+
+# Create a patch bundle with the new patch (by sending against the repo we
+# copied, with the last tag)
+darcs send ../T -a -o ../patch.dpatch --no-edit-description
+
+cd ../S
+
+# Try to apply to the patch which depends on the missing tag (we expect darcs
+# to fail gracefully here)
+not darcs apply ../patch.dpatch &> apply_output.txt
+
+# A best-attempt at ensuring darcs warns about the missing tag:
+grep "tagged file2 tag" apply_output.txt
+grep "FATAL: Cannot apply this bundle. We are missing the above patches." apply_output.txt
+cd ..
+rm -rf R S
+
+## issue1873 - apply should complain about the right
+## patches if it says some are missing
+
+rm -rf R S
+darcs init R
+cd R
+echo a > a
+darcs rec -lam a
+echo b > a
+darcs rec -lam b
+echo x > x
+darcs rec -lam x
+echo c > a
+darcs rec -lam c
+echo y > y
+darcs rec -lam y
+echo d > a
+darcs rec -lam d
+cd ..
+
+darcs clone R S
+darcs unpull -p x -a --repo R
+darcs send   --no-minimize -p x -a --repo S -o R/x.dpatch
+darcs unpull -p y -a --repo R
+not darcs apply --repo R R/x.dpatch 2>&1 | tee log
+
+not grep '^  \* d' log # does not complain about an unrelated patch
+    grep '^  \* y' log # complains about the offending one instead
+
+cd ..
+rm -rf R S
+
+## Test that apply --skip-conflicts filters the conflicts
+## appropriately.
+
+darcs init R
+cd R
+echo 'foo' > foo
+echo 'bar' > bar
+darcs rec -lam 'Add foo and bar'
+darcs clone . ../S
+echo 'foo2' > foo
+darcs rec -lam 'Change foo (2)'
+echo 'bar2' > bar
+darcs rec -lam 'Change bar (2)'
+cd ../S
+echo 'foo3' > foo
+darcs rec -lam 'Change foo (3)'
+cd ../R
+darcs send -a ../S -o ../S/applyme.dpatch
+cd ../S
+darcs apply --skip-conflicts applyme.dpatch
+test `darcs log --count` -eq 3
+cd ..
+rm -rf R S
+
+# issue2193 - "darcs apply --test runs the test twice.
+
+darcs init R
+darcs clone R S
+
+# Create a patch bundle
+cd R
+echo 'Example content.' >file1
+darcs rec -lam patch1
+darcs send --dont-edit-description --output=./patch1 -a ../S
+
+# Setup a test that prints a unique string, apply the patch set,
+# check that the unique string occurs in the output once.
+cd ../S
+darcs setpref test 'echo 2a427e65f322be754dce67c829e5f8a3'
+darcs apply --test ../R/patch1 > log 2>&1
+[ `fgrep -c 2a427e65f322be754dce67c829e5f8a3 log` -eq 1 ]
diff --git a/tests/apply_skip_conflicts.sh b/tests/apply_skip_conflicts.sh
deleted file mode 100644
--- a/tests/apply_skip_conflicts.sh
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/usr/bin/env bash
-## Test that apply --skip-conflicts filters the conflicts
-## appropriately.
-##
-## Copyright (C) 2009 Ganesh Sittampalam
-##
-## Permission is hereby granted, free of charge, to any person
-## obtaining a copy of this software and associated documentation
-## files (the "Software"), to deal in the Software without
-## restriction, including without limitation the rights to use, copy,
-## modify, merge, publish, distribute, sublicense, and/or sell copies
-## of the Software, and to permit persons to whom the Software is
-## furnished to do so, subject to the following conditions:
-##
-## The above copyright notice and this permission notice shall be
-## included in all copies or substantial portions of the Software.
-##
-## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-## EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-## MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-## NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-## BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-## ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-## CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-## SOFTWARE.
-
-. lib                  # Load some portability helpers.
-rm -rf R S                      # Another script may have left a mess.
-
-mkdir R
-cd R
-darcs init
-echo 'foo' > foo
-echo 'bar' > bar
-darcs rec -lam 'Add foo and bar'
-cd ..
-
-darcs get R S
-
-cd R
-echo 'foo2' > foo
-darcs rec -lam 'Change foo (2)'
-echo 'bar2' > bar
-darcs rec -lam 'Change bar (2)'
-cd ..
-
-cd S
-echo 'foo3' > foo
-darcs rec -lam 'Change foo (3)'
-cd ..
-
-cd R
-darcs send -a ../S -o ../S/applyme.dpatch
-cd ..
-
-cd S
-darcs apply --skip-conflicts applyme.dpatch
-test `darcs changes --count` -eq 3
-cd ..
diff --git a/tests/check-read-only.sh b/tests/check-read-only.sh
deleted file mode 100644
--- a/tests/check-read-only.sh
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/usr/bin/env bash
-## Test for issue2001: check is not read-only 
-##
-## Copyright (C) 2011 Florent Becker
-##
-## Permission is hereby granted, free of charge, to any person
-## obtaining a copy of this software and associated documentation
-## files (the "Software"), to deal in the Software without
-## restriction, including without limitation the rights to use, copy,
-## modify, merge, publish, distribute, sublicense, and/or sell copies
-## of the Software, and to permit persons to whom the Software is
-## furnished to do so, subject to the following conditions:
-##
-## The above copyright notice and this permission notice shall be
-## included in all copies or substantial portions of the Software.
-##
-## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-## EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-## MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-## NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-## BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-## ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-## CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-## SOFTWARE.
-
-. lib                           # Load some portability helpers.
-darcs init      --repo R        # Create our test repos.
-
-cd R
-mkdir d e                       # Change the working tree.
-echo 'Example content.' > d/f
-darcs record -lam 'Add d/f and e.'
-darcs mv d/f e/
-darcs record -am 'Move d/f to e/f.'
-rm _darcs/pristine.hashed/*     # Make the repository bogus
-cp -r _darcs archive
-not darcs check
-diff -r _darcs archive
diff --git a/tests/clone.sh b/tests/clone.sh
new file mode 100644
--- /dev/null
+++ b/tests/clone.sh
@@ -0,0 +1,187 @@
+#!/usr/bin/env bash
+
+. lib
+
+rm -rf temp1
+darcs init temp1
+cd temp1
+touch t.t
+darcs record -lam "initial add"
+darcs log --context > my_context
+DIR=`pwd`
+abs_to_context="${DIR}/my_context"
+cd ..
+rm -rf temp2
+darcs clone temp1 --context="${abs_to_context}" temp2
+darcs log --context --repo temp2 > repo2_context
+diff -u "${abs_to_context}" repo2_context
+cd ..
+rm -rf temp1 temp2
+
+# issue1865: cover interaction of clone --context with tags
+
+darcs init temp1
+cd temp1
+touch t.t
+darcs record -lam "initial add"
+darcs tag -m tt
+echo x > x
+darcs rec -lam "x"
+darcs log --context > my_context
+abs_to_context="$(pwd)/my_context"
+cd ..
+darcs clone temp1 --context="${abs_to_context}" temp2
+darcs log --context --repo temp2 > repo2_context
+diff -u "${abs_to_context}" repo2_context
+rm -rf temp1 temp2
+
+# issue1041
+
+# should fail, since temp1 doesn't exist
+not darcs clone temp1 temp2
+# verify that temp2 wasn't created
+not cd temp2
+
+rm -rf temp1 temp2
+
+# issue2199 "darcs clone --tag" gets too much if tag is dirty
+
+darcs init temp1
+cd temp1
+echo 'wibble' > file
+darcs rec -lam 'wibble'
+echo 'wobble' > file
+darcs rec -lam 'wobble'
+cd ..
+
+darcs clone temp1 temp2
+
+cd temp2
+darcs unpull --patch 'wobble' -a
+darcs tag 'wibble'
+cd ..
+
+cd temp1
+darcs pull ../temp2 -a
+cd ..
+
+darcs clone --tag wibble temp1 temp3
+cd temp3
+darcs log | not grep wobble
+cd ..
+rm -rf temp1 temp2 temp3
+
+
+# issue885: darcs clone --to-match
+
+darcs init temp1
+cd temp1
+echo first > a
+darcs record -lam 'first'
+firsthash=`darcs log --xml | grep 'hash=' | sed -e "s/.*hash='//" -e "s/'>//"`
+echo second > b
+darcs record -lam 'second'
+
+cd ..
+darcs init temp2
+cd temp2
+darcs pull -a --match "hash $firsthash" ../temp1
+     # pulling that patch works ok
+cd ..
+darcs clone --to-match "hash $firsthash" temp1 temp3
+     # cloning up to that patch does not
+rm -rf temp1 temp2 temp3
+
+# various tests for clone --tag
+
+rm -rf temp1 temp2
+darcs init temp1
+cd temp1
+echo ALL ignore-times >> _darcs/prefs/defaults
+echo A > foo
+darcs record -lam AA
+echo B > foo
+darcs record -am BB
+echo C > foo
+darcs record -am CC
+darcs tag -m 1.0
+cp foo foo_version_1.0
+echo D > foo
+darcs record -am DD
+echo E > foo
+darcs record -am EE
+echo F > foo
+darcs record -am FF
+
+cd ..
+darcs clone --tag 1.0 --repo-name temp2 temp1
+cmp temp2/foo temp1/foo_version_1.0
+rm -rf temp1 temp2 temp3
+
+# clone --tag with commuted patches
+
+darcs init temp1
+cd temp1
+cat > file <<EOF
+1
+2
+3
+4
+EOF
+darcs rec -alm 'Add file'
+cat > file <<EOF
+2
+3
+4
+EOF
+darcs rec -alm 'Remove line 1'
+cat > file <<EOF
+2
+4
+EOF
+darcs rec -alm 'Remove line 3'
+cd ..
+darcs init temp2
+cd temp2
+echo ynyy | darcs pull ../temp1
+darcs tag -m Tag
+darcs push -a ../temp1
+cd ..
+darcs clone --tag=Tag temp1 temp3
+cd temp3
+darcs check
+cd ..
+rm -rf temp1 temp2 temp3
+
+# clone --tag : check that pending looks ok
+
+darcs init temp1
+cd temp1
+mkdir d
+darcs rec -lam 'add d'
+darcs tag t
+rmdir d
+darcs rec -am 'rm d'
+cd ..
+darcs clone --tag t temp1 temp2
+cd temp2
+if [ -f _darcs/patches/pending ]; then
+	if grep -v '^[{}]$' _darcs/patches/pending >/dev/null; then
+		cat _darcs/patches/pending
+		exit 1
+	fi
+fi
+cd ..
+rm -rf temp1 temp2
+
+
+# issue2230 - darcs clone --context checks the validity of the context
+# file too late.
+
+darcs init temp1
+touch fake_context.txt
+not darcs clone --context fake_context.txt temp1 temp2
+
+# The clone should fail, so we shouldn't have an temp2 repo
+[[ ! -e temp2 ]]
+rm -rf temp1
diff --git a/tests/diff.sh b/tests/diff.sh
--- a/tests/diff.sh
+++ b/tests/diff.sh
@@ -1,14 +1,12 @@
 #!/usr/bin/env bash
 . ./lib
 
-rm -rf temp-$$
-mkdir temp-$$
-cd temp-$$
+rm -rf temp1
+darcs init temp1
+cd temp1
 
-darcs initialize
 echo text > afile.txt
-darcs add afile.txt
-darcs record --author me --all --no-test --name init
+darcs record -lam init
 darcs diff
 darcs diff --no-unified -p . --store-in-mem > diffinmem
 darcs diff --no-unified -p . --no-store-in-mem > diffondisk
@@ -20,4 +18,131 @@
 diff diffnoarg diffdot
 
 cd ..
-rm -rf temp-$$
+rm -rf temp1
+
+
+# issue966
+
+darcs init temp1
+cd temp1
+echo "aaa diff" > file
+darcs record -lam "aaa"
+echo "bbb diff" >> file
+darcs record -a -m "bbb"
+
+darcs diff --patch "aaa" | grep "aaa diff"
+darcs diff --patch "bbb" | grep "bbb diff"
+
+darcs tag release-1
+darcs optimize clean
+
+echo "ccc diff" >> file
+darcs record -a -m "ccc"
+darcs diff --patch "ccc" | grep "ccc diff"
+
+# here is where we have a problem
+darcs diff --patch "aaa" | grep "aaa diff"
+darcs diff --patch "bbb" | grep "bbb diff"
+cd ..
+rm -rf temp1
+
+# issue1139 diff last
+
+darcs init temp1
+cd temp1
+
+echo text > foo
+darcs rec -lam 'add foo'
+
+echo newtext > foo
+darcs record -am 'modify foo'
+
+darcs diff --no-unified --store-in-mem --last=1 > out1
+grep text out1
+grep foo out1
+
+darcs diff --no-unified --last=1 > out
+grep text out
+grep foo out
+
+diff -u out1 out
+
+cd ..
+rm -rf temp1
+
+# issue 1139 diff with no args
+darcs init temp1
+cd temp1
+
+echo text > foo
+darcs record -lam 'add foo'
+echo newtext > foo
+darcs diff --no-unified --store > out1
+grep text out1
+grep foo out1
+
+darcs diff --no-unified > out
+grep text out
+grep foo out
+diff out out1
+cd ..
+rm -rf temp1
+
+# issue1290 - darcs diff --index
+darcs init temp1
+cd temp1
+
+echo '1' > f
+darcs record -lam 'one'
+echo '2' > f
+darcs record -lam 'two'
+echo '3' > f
+darcs record -lam 'three'
+echo '4' > f
+darcs record -lam 'four'
+# in the following outputs of `darcs diff`, we delete the
+# lines "diff -rN old-... new-..." since they can be different
+# if tests are run in parallel
+darcs diff --no-unified --from-patch one --to-patch two | sed /^diff/d > d1
+darcs diff --no-unified --index=3-4 |sed /^diff/d > d2 # the numbers go backwards
+diff -q d1 d2
+cd ..
+rm -rf temp1
+
+
+# issue2052 - Ensure we use unified Diff by default.
+
+darcs init temp1
+cd temp1
+touch a
+darcs record -lam 'Add a'
+echo testing > a
+test `darcs diff | grep -c "diff -rN -u"` -eq 1
+test `darcs diff --no-unified | grep -c "diff -rN -u"` -eq 0
+test `darcs diff --no-unified | grep -c "diff -rN"` -eq 1
+cd ..
+rm -rf temp1
+
+# issue2067: inexistant files result in empty lines in darcs
+
+darcs init temp1
+cd temp1
+darcs diff a b c d 2> /dev/null | wc -l | grep "^ *0$"
+cd ..
+rm -rf temp1
+
+# issue2179 - darcs diff on a dir should diff everything in and below
+# that directory
+
+darcs init temp1
+cd temp1
+mkdir dir
+touch dir/file
+darcs rec -alm 'Add dir/file'
+echo testing > dir/file
+darcs wh | grep testing
+darcs diff | grep testing
+darcs diff dir/file | grep testing
+darcs diff dir | grep testing
+cd ..
+rm -rf temp1
diff --git a/tests/get.sh b/tests/get.sh
deleted file mode 100644
--- a/tests/get.sh
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/usr/bin/env bash
-
-. lib
-
-rm -rf temp1
-mkdir temp1
-cd temp1
-darcs init
-touch t.t
-darcs add t.t
-darcs record -am "initial add"
-darcs changes --context > my_context
-DIR=`pwd`
-abs_to_context="${DIR}/my_context"
-cd ..
-rm -rf temp2
-darcs get temp1 --context="${abs_to_context}" temp2
-darcs changes --context --repo temp2 > repo2_context
-diff -u "${abs_to_context}" repo2_context
diff --git a/tests/get_tag.sh b/tests/get_tag.sh
deleted file mode 100644
--- a/tests/get_tag.sh
+++ /dev/null
@@ -1,87 +0,0 @@
-#!/usr/bin/env bash
-. ./lib
-
-rm -rf temp1 temp2
-mkdir temp1
-cd temp1
-darcs initialize
-echo ALL ignore-times >> _darcs/prefs/defaults
-echo A > foo
-darcs add foo
-darcs record -a -m AA -A x
-echo B > foo
-darcs record -a -m BB -A x
-echo C > foo
-darcs record -a -m CC -A x
-darcs tag -m 1.0 -A x
-cp foo foo_version_1.0
-echo D > foo
-darcs record -a -m DD -A x
-echo E > foo
-darcs record -a -m EE -A x
-echo F > foo
-darcs record -a -m FF -A x
-
-
-# Check that get store commuted patches
-cd ..
-darcs get --tag 1.0 --repo-name temp2 temp1
-cmp temp2/foo temp1/foo_version_1.0
-rm -rf temp1 temp2 temp3
-
-mkdir temp1
-cd temp1
-darcs init
-cat > file <<EOF
-1
-2
-3
-4
-EOF
-darcs rec -Ax -alm 'Add file'
-cat > file <<EOF
-2
-3
-4
-EOF
-darcs rec -Ax -alm 'Remove line 1'
-cat > file <<EOF
-2
-4
-EOF
-darcs rec -Ax -alm 'Remove line 3'
-cd ..
-mkdir temp2
-cd temp2
-darcs init
-echo ynyy | darcs pull ../temp1
-darcs tag -Ax -m Tag
-darcs push -a ../temp1
-cd ..
-darcs get --tag=Tag temp1 temp3
-cd temp3
-darcs check
-cd ..
-rm -rf temp1 temp2 temp3
-
-# Check that pending looks ok
-mkdir temp1
-cd temp1
-darcs init
-mkdir d
-darcs add d
-darcs rec -Ax -am 'add d'
-darcs tag -Ax t
-rmdir d
-darcs rec -Ax -am 'rm d'
-cd ..
-darcs get --tag t temp1 temp2
-cd temp2
-if [ -f _darcs/patches/pending ]; then
-	if grep -v '^[{}]$' _darcs/patches/pending >/dev/null; then
-		cat _darcs/patches/pending
-		exit 1
-	fi
-fi
-cd ..
-rm -rf temp1 temp2
diff --git a/tests/init.sh b/tests/init.sh
--- a/tests/init.sh
+++ b/tests/init.sh
@@ -23,3 +23,13 @@
 darcs init x
 
 rm -rf temp1 temp2 x
+
+## issue1266 - attempting to initialize a repository inside
+## another repository should cause a warning, because while perfectly
+## legitimate, it is likely to be accidental.
+
+rm -rf out
+darcs init --repodir temp1
+darcs init --repodir temp1/temp2 2>&1 | tee out
+grep -i WARNING out   # A warning should be printed.
+rm -rf temp1 out
diff --git a/tests/issue1041.sh b/tests/issue1041.sh
deleted file mode 100644
--- a/tests/issue1041.sh
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/usr/bin/env bash
-
-. lib
-
-rm -rf temp1 temp2
-
-# this should fail, since temp1 doesn't exist...
-not darcs get temp1 temp2
-
-# verify that temp2 wasn't created
-not cd temp2
-
-rm -rf temp1 temp2
diff --git a/tests/issue1110_get_hashed.sh b/tests/issue1110_get_hashed.sh
deleted file mode 100644
--- a/tests/issue1110_get_hashed.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/usr/bin/env bash
-. ./lib
-rm -rf temp1 temp1-h
-
-gunzip -c $TESTDATA/many-files--old-fashioned-inventory.tgz | tar xf -
-mv many-files--old-fashioned-inventory temp1
-
-darcs get temp1 temp1-h
-test -e temp1-h/_darcs/hashed_inventory
-rm -rf temp1 temp1-h
diff --git a/tests/issue1139-diff-last.sh b/tests/issue1139-diff-last.sh
deleted file mode 100644
--- a/tests/issue1139-diff-last.sh
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/usr/bin/env bash
-. ./lib
-
-rm -rf temp-$$
-mkdir temp-$$
-cd temp-$$
-
-darcs initialize
-echo text > foo
-darcs add foo
-darcs rec -am 'add foo'
-
-echo newtext > foo
-darcs record -am 'modify foo'
-
-darcs diff --no-unified --store-in-mem --last=1 > out1
-cat out1
-grep text out1
-grep foo out1
-
-darcs diff --no-unified --last=1 > out
-cat out
-grep text out
-grep foo out
-
-diff -u out1 out
-
-cd ..
-
-rm -rf temp-$$
diff --git a/tests/issue1139-diff-with-no-args.sh b/tests/issue1139-diff-with-no-args.sh
deleted file mode 100644
--- a/tests/issue1139-diff-with-no-args.sh
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/usr/bin/env bash
-. ./lib
-
-rm -rf temp-$$
-mkdir temp-$$
-cd temp-$$
-
-darcs initialize
-echo text > foo
-darcs add foo
-darcs record -am 'add foo'
-echo newtext > foo
-darcs wh
-
-darcs diff --no-unified --store > out1
-cat out1
-grep text out1
-grep foo out1
-
-darcs diff --no-unified > out
-cat out
-grep text out
-grep foo out
-
-diff out out1
-
-cd ..
-
-rm -rf temp-$$
diff --git a/tests/issue1248.sh b/tests/issue1248.sh
deleted file mode 100644
--- a/tests/issue1248.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/usr/bin/env bash
-## Test for issue1248 - darcs doesn't handle darcs 1 repos with compressed
-## inventories
-##
-## Placed into the public domain by Ganesh Sittampalam, 2009
-
-. lib
-
-gunzip -c  $TESTDATA/oldfashioned-compressed.tgz | tar xf -
-cd oldfashioned-compressed
-darcs optimize upgrade
-darcs check
diff --git a/tests/issue1266_init_inside_a_repo.sh b/tests/issue1266_init_inside_a_repo.sh
deleted file mode 100644
--- a/tests/issue1266_init_inside_a_repo.sh
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/usr/bin/env bash
-## Test for issue1266 - attempting to initialize a repository inside
-## another repository should cause a warning, because while perfectly
-## legitimate, it is likely to be accidental.
-##
-## Copyright (C) 2009  Trent W. Buck
-##
-## Permission is hereby granted, free of charge, to any person
-## obtaining a copy of this software and associated documentation
-## files (the "Software"), to deal in the Software without
-## restriction, including without limitation the rights to use, copy,
-## modify, merge, publish, distribute, sublicense, and/or sell copies
-## of the Software, and to permit persons to whom the Software is
-## furnished to do so, subject to the following conditions:
-##
-## The above copyright notice and this permission notice shall be
-## included in all copies or substantial portions of the Software.
-##
-## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-## EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-## MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-## NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-## BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-## ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-## CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-## SOFTWARE.
-
-. lib
-
-rm -rf temp1 out                # Another script may have left a mess.
-darcs init --repodir temp1
-darcs init --repodir temp1/temp2 2>&1 | tee out
-grep -i WARNING out             # A warning should be printed.
diff --git a/tests/issue1290-diff-index.sh b/tests/issue1290-diff-index.sh
deleted file mode 100644
--- a/tests/issue1290-diff-index.sh
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/usr/bin/env bash
-## Test for issue1290 - darcs diff --index
-##
-## Copyright (C) 2010 Eric Kow
-##
-## Permission is hereby granted, free of charge, to any person
-## obtaining a copy of this software and associated documentation
-## files (the "Software"), to deal in the Software without
-## restriction, including without limitation the rights to use, copy,
-## modify, merge, publish, distribute, sublicense, and/or sell copies
-## of the Software, and to permit persons to whom the Software is
-## furnished to do so, subject to the following conditions:
-##
-## The above copyright notice and this permission notice shall be
-## included in all copies or substantial portions of the Software.
-##
-## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-## EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-## MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-## NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-## BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-## ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-## CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-## SOFTWARE.
-
-. lib                           # Load some portability helpers.
-rm -rf R                        # Another script may have left a mess.
-darcs init      --repo R        # Create our test repos.
-
-cd R
- echo '1' > f
- darcs record -lam 'one'
- echo '2' > f
- darcs record -lam 'two'
- echo '3' > f
- darcs record -lam 'three'
- echo '4' > f
- darcs record -lam 'four'
- # in the following outputs of `darcs diff`, we delete the
- # lines "diff -rN old-... new-..." since they can be different
- # if tests are run in parallel
- darcs diff --no-unified --from-patch one --to-patch two | sed /^diff/d > d1
- darcs diff --no-unified --index=3-4 |sed /^diff/d > d2 # the numbers go backwards
- diff -q d1 d2
-cd ..
diff --git a/tests/issue1427_apply_gz.sh b/tests/issue1427_apply_gz.sh
deleted file mode 100644
--- a/tests/issue1427_apply_gz.sh
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/usr/bin/env bash
-. ./lib
-
-rm -rf temp1 temp2
-mkdir temp1 temp2
-
-cd temp2
-darcs init
-
-cd ../temp1
-darcs init
-touch foo bar
-darcs add foo bar
-darcs record -a -m add_foo_bar -A x
-darcs mv foo zig
-darcs mv bar foo
-darcs mv zig bar
-darcs record -a -m swap_foo_bar -A x
-darcs send --author=me --output=funpatch --dont-sign -a ../temp2
-
-gzip funpatch
-
-cd ../temp2
-darcs apply ../temp1/funpatch.gz
-cd ..
-cmp temp1/bar temp2/bar
-rm -rf temp2
-
-mkdir temp2
-cd temp2
-darcs init
-darcs apply ../temp1/funpatch.gz
-## Also test that "darcs apply" can accept a patch on stdin.
-darcs obl -a
-darcs apply < ../temp1/funpatch.gz
-cd ..
-cmp temp1/bar temp2/bar
-
-
-rm -rf temp1 temp2
-
diff --git a/tests/issue1472_read_too_much.sh b/tests/issue1472_read_too_much.sh
deleted file mode 100644
--- a/tests/issue1472_read_too_much.sh
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/usr/bin/env bash
-## Test for issue1472 - running "darcs record ./foo" shouldn't even
-## TRY to read ./bar.
-##
-## Copyright (C) 2009  Trent W. Buck
-##
-## Permission is hereby granted, free of charge, to any person
-## obtaining a copy of this software and associated documentation
-## files (the "Software"), to deal in the Software without
-## restriction, including without limitation the rights to use, copy,
-## modify, merge, publish, distribute, sublicense, and/or sell copies
-## of the Software, and to permit persons to whom the Software is
-## furnished to do so, subject to the following conditions:
-##
-## The above copyright notice and this permission notice shall be
-## included in all copies or substantial portions of the Software.
-##
-## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-## EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-## MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-## NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-## BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-## ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-## CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-## SOFTWARE.
-
-. lib                  # Load some portability helpers.
-rm -rf R                        # Another script may have left a mess.
-darcs init      --repo R        # Create our test repo.
-mkdir R/d/                      # Change the working tree.
-echo 'Example content.' >R/f
-echo 'Similar content.' >R/d/f
-chmod 0 R/f                     # Make R/f unreadable, so that
-                                # attempting to read it will result in
-                                # an error.
-darcs record    --repo R -lam 'Only changes to R/d/.' d
-rm -rf R/                       # Clean up after ourselves.
diff --git a/tests/issue1473.sh b/tests/issue1473.sh
deleted file mode 100644
--- a/tests/issue1473.sh
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/usr/bin/env bash
-## Test for issue1473 - check that darcs annotate works with and without
-## repodir and with "." argument.  It should fail with the empty string as
-## a single argument and without any arguments.
-##
-## Permission is hereby granted, free of charge, to any person
-## obtaining a copy of this software and associated documentation
-## files (the "Software"), to deal in the Software without
-## restriction, including without limitation the rights to use, copy,
-## modify, merge, publish, distribute, sublicense, and/or sell copies
-## of the Software, and to permit persons to whom the Software is
-## furnished to do so, subject to the following conditions:
-##
-## The above copyright notice and this permission notice shall be
-## included in all copies or substantial portions of the Software.
-##
-## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-## EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-## MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-## NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-## BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-## ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-## CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-## SOFTWARE.
-. lib                           # Load some portability helpers.
-
-rm -rf R S                      # Another script may have left a mess.
-darcs init      --repo R        # Create our test repos.
-
-cd R
-echo 'Example content.' > f
-darcs record -lam 'Added f.'
-darcs annotate .
-darcs annotate f
-not darcs annotate
-not darcs annotate ''
-
-cd ..
-darcs annotate --repodir=R .
-darcs annotate --repodir=R f
-not darcs annotate --repodir=R
-not darcs annotate --repodir=R ''
diff --git a/tests/issue1473_annotate_repodir.sh b/tests/issue1473_annotate_repodir.sh
deleted file mode 100644
--- a/tests/issue1473_annotate_repodir.sh
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/usr/bin/env bash
-. ./lib
-
-rm -rf temp
-mkdir temp
-cd temp
-darcs init
-mkdir a b
-touch a/a b/b
-darcs add --rec .
-darcs record -a -m ab -A test
-darcs annotate a/a
-darcs annotate . > inner
-# annotate --repodir=something '.' should work
-cd ..
-darcs annotate --repodir temp '.' > temp/outer
-cd temp
-diff inner outer
-
-cd ..
-rm -rf temp
-
diff --git a/tests/issue1584_optimize_upgrade.sh b/tests/issue1584_optimize_upgrade.sh
deleted file mode 100644
--- a/tests/issue1584_optimize_upgrade.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env bash
-## Test for issue1584 - darcs optimize --upgrade
-##
-## Copyright (C) 2009 Eric Kow <kowey@darcs.net>
-##
-## Permission is hereby granted, free of charge, to any person
-## obtaining a copy of this software and associated documentation
-## files (the "Software"), to deal in the Software without
-## restriction, including without limitation the rights to use, copy,
-## modify, merge, publish, distribute, sublicense, and/or sell copies
-## of the Software, and to permit persons to whom the Software is
-## furnished to do so, subject to the following conditions:
-##
-## The above copyright notice and this permission notice shall be
-## included in all copies or substantial portions of the Software.
-##
-## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-## EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-## MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-## NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-## BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-## ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-## CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-## SOFTWARE.
-
-. lib                  # Load some portability helpers.
-rm -rf R                        # Another script may have left a mess.
-gunzip -c $TESTDATA/many-files--old-fashioned-inventory.tgz | tar xf -
-mv many-files--old-fashioned-inventory R
-
-echo x > R/foo # Unrecorded change
-darcs optimize upgrade  --repo R
-darcs check     --repo R
-grep hashed R/_darcs/format
-not grep darcs-2 R/_darcs/format
-darcs whatsnew  --repo R | grep 'hunk ./foo 1'
diff --git a/tests/issue1705-show-contents-index.sh b/tests/issue1705-show-contents-index.sh
deleted file mode 100644
--- a/tests/issue1705-show-contents-index.sh
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/usr/bin/env bash
-## Test for issue1705 - <darcs show contents --index=1     => darcs failed:  Pattern not specified in get_nonrange_match>
-##
-## Copyright (C) 2009  Thomas Hartman
-##
-## Permission is hereby granted, free of charge, to any person
-## obtaining a copy of this software and associated documentation
-## files (the "Software"), to deal in the Software without
-## restriction, including without limitation the rights to use, copy,
-## modify, merge, publish, distribute, sublicense, and/or sell copies
-## of the Software, and to permit persons to whom the Software is
-## furnished to do so, subject to the following conditions:
-##
-## The above copyright notice and this permission notice shall be
-## included in all copies or substantial portions of the Software.
-##
-## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-## EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-## MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-## NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-## BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-## ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-## CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-## SOFTWARE.
-
-. ../tests/lib                  # Load some portability helpers.
-rm -rf R S                      # Another script may have left a mess.
-darcs init      --repo R        # Create our test repos.
-cd R
-echo 111 > 1
-darcs add 1
-darcs record --author="whoever" -am'add file 1'
-darcs show contents --index=1 1
-cd ..
-rm -rf R
diff --git a/tests/issue1749-rmdir.sh b/tests/issue1749-rmdir.sh
deleted file mode 100644
--- a/tests/issue1749-rmdir.sh
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/usr/bin/env bash
-## Test for issueXXX - darcs remove <dir> corrupts the patch sequence
-##
-## Copyright (C) 2009 Eric Kow <kowey@darcs.net>
-##
-## Permission is hereby granted, free of charge, to any person
-## obtaining a copy of this software and associated documentation
-## files (the "Software"), to deal in the Software without
-## restriction, including without limitation the rights to use, copy,
-## modify, merge, publish, distribute, sublicense, and/or sell copies
-## of the Software, and to permit persons to whom the Software is
-## furnished to do so, subject to the following conditions:
-##
-## The above copyright notice and this permission notice shall be
-## included in all copies or substantial portions of the Software.
-##
-## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-## EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-## MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-## NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-## BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-## ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-## CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-## SOFTWARE.
-
-. lib                  # Load some portability helpers.
-rm -rf R                        # Another script may have left a mess.
-darcs init   --repo R
-cd R
-
-mkdir dir
-touch dir/file
-
-darcs add dir/file              # adds dir too (which is fine)
-darcs rec -a -m"add dir and file"
-
-not darcs remove dir
-# removed dir but not file - should be nothing to add
-not darcs rec -a -m"remove dir"
-
-darcs obliterate -a --patch "remove dir" | grep 'No patches selected!'
-darcs check
diff --git a/tests/issue1848-rollback-p.sh b/tests/issue1848-rollback-p.sh
deleted file mode 100644
--- a/tests/issue1848-rollback-p.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env bash
-## Test for issue1848 - interactive selection of primitive patches
-## should still work with rollback -p
-##
-## Copyright (C) 2010 Eric Kow
-##
-## Permission is hereby granted, free of charge, to any person
-## obtaining a copy of this software and associated documentation
-## files (the "Software"), to deal in the Software without
-## restriction, including without limitation the rights to use, copy,
-## modify, merge, publish, distribute, sublicense, and/or sell copies
-## of the Software, and to permit persons to whom the Software is
-## furnished to do so, subject to the following conditions:
-##
-## The above copyright notice and this permission notice shall be
-## included in all copies or substantial portions of the Software.
-##
-## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-## EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-## MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-## NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-## BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-## ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-## CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-## SOFTWARE.
-
-. lib                           # Load some portability helpers.
-rm -rf R S                      # Another script may have left a mess.
-darcs init      --repo R        # Create our test repos.
-
-cd R
-echo 'f' > f
-echo 'g' > g
-darcs record -lam 'Add f and g'
-echo ynq | darcs rollback -p 'f and g'
-cd ..
diff --git a/tests/issue1865-get-context.sh b/tests/issue1865-get-context.sh
deleted file mode 100644
--- a/tests/issue1865-get-context.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/usr/bin/env bash
-
-. lib
-
-rm -rf temp1 temp2
-mkdir temp1
-cd temp1
-darcs init
-touch t.t
-darcs add t.t
-darcs record -am "initial add"
-darcs tag -m tt
-echo x > x
-darcs rec -lam "x" x
-darcs changes --context > my_context
-abs_to_context="$(pwd)/my_context"
-cd ..
-darcs get temp1 --context="${abs_to_context}" temp2
-darcs changes --context --repo temp2 > repo2_context
-diff -u "${abs_to_context}" repo2_context
diff --git a/tests/issue1871-record-dot.sh b/tests/issue1871-record-dot.sh
deleted file mode 100644
--- a/tests/issue1871-record-dot.sh
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/usr/bin/env bash
-## Test for issue1871 - darcs record . should work for tracked changes
-## in a subdirectory even if the subdirectory itself is not known yet.
-##
-## Copyright (C) 2010 Eric Kow
-##
-## Permission is hereby granted, free of charge, to any person
-## obtaining a copy of this software and associated documentation
-## files (the "Software"), to deal in the Software without
-## restriction, including without limitation the rights to use, copy,
-## modify, merge, publish, distribute, sublicense, and/or sell copies
-## of the Software, and to permit persons to whom the Software is
-## furnished to do so, subject to the following conditions:
-##
-## The above copyright notice and this permission notice shall be
-## included in all copies or substantial portions of the Software.
-##
-## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-## EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-## MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-## NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-## BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-## ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-## CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-## SOFTWARE.
-
-
-. lib                           # Load some portability helpers.
-rm -rf R                        # Another script may have left a mess.
-darcs init      --repo R        # Create our test repos.
-
-cd R
-mkdir d                         # Change the working tree.
-echo 'Example content.' > d/f
-darcs add d/f
-echo ny | darcs record
-echo ny | darcs record . > log
-not grep "None of the files" log
-cd ..
diff --git a/tests/issue1873-apply-failed-to-read-patch.sh b/tests/issue1873-apply-failed-to-read-patch.sh
deleted file mode 100644
--- a/tests/issue1873-apply-failed-to-read-patch.sh
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/usr/bin/env bash
-## Test for issue1873 - apply should complain about the right
-## patches if it says some are missing
-##
-## Copyright (C) 2010 Petr Rockai
-##
-## Permission is hereby granted, free of charge, to any person
-## obtaining a copy of this software and associated documentation
-## files (the "Software"), to deal in the Software without
-## restriction, including without limitation the rights to use, copy,
-## modify, merge, publish, distribute, sublicense, and/or sell copies
-## of the Software, and to permit persons to whom the Software is
-## furnished to do so, subject to the following conditions:
-##
-## The above copyright notice and this permission notice shall be
-## included in all copies or substantial portions of the Software.
-##
-## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-## EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-## MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-## NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-## BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-## ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-## CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-## SOFTWARE.
-
-. lib
-
-rm -rf R S
-mkdir R
-darcs init --repo R
-
-cd R
-echo a > a
-darcs rec -lam a
-echo b > a
-darcs rec -lam b
-echo x > x
-darcs rec -lam x
-echo c > a
-darcs rec -lam c
-echo y > y
-darcs rec -lam y
-echo d > a
-darcs rec -lam d
-cd ..
-
-darcs get R S
-darcs unpull -p x -a --repo R
-darcs send   --no-minimize -p x -a --repo S -o R/x.dpatch
-darcs unpull -p y -a --repo R
-not darcs apply --repo R R/x.dpatch 2>&1 | tee log
-
-not grep '^  \* d' log # does not complain about an unrelated patch
-    grep '^  \* y' log # complains about the offending one instead
diff --git a/tests/issue1921-missing-tag-in-apply-bundle.sh b/tests/issue1921-missing-tag-in-apply-bundle.sh
deleted file mode 100644
--- a/tests/issue1921-missing-tag-in-apply-bundle.sh
+++ /dev/null
@@ -1,69 +0,0 @@
-#!/usr/bin/env bash
-
-## Attempting to apply a patch which depends on a missing tag should not cause
-## darcs to die.
-##
-## Copyright (C) 2012 Owen Stephens
-##
-## Permission is hereby granted, free of charge, to any person
-## obtaining a copy of this software and associated documentation
-## files (the "Software"), to deal in the Software without
-## restriction, including without limitation the rights to use, copy,
-## modify, merge, publish, distribute, sublicense, and/or sell copies
-## of the Software, and to permit persons to whom the Software is
-## furnished to do so, subject to the following conditions:
-##
-## The above copyright notice and this permission notice shall be
-## included in all copies or substantial portions of the Software.
-##
-## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-## EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-## MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-## NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-## BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-## ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-## CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-## SOFTWARE.
-
-. lib
-
-rm -rf R S T patch.dpatch
-
-darcs init --repo R
-
-cd R
-
-# Setup a repo with a tagged patch, and another patch ontop, so we have a split
-# inventory
-touch file1
-darcs rec -alm 'Add file1'
-darcs tag -m 'file1 tag'
-touch file2
-darcs rec -alm 'Add file2'
-
-# Take a copy of the repo at this point
-darcs get . ../S
-
-# Add the tag which we will fail on
-darcs tag -m 'file2 tag'
-
-# Take a copy with the tag
-darcs get . ../T
-
-# Add our patch which will depend only on the last tag.
-echo 'file1' > file1
-darcs rec -am 'file1 content'
-
-# Create a patch bundle with the new patch (by sending against the repo we
-# copied, with the last tag)
-darcs send ../T -a -o ../patch.dpatch --no-edit-description
-
-cd ../S
-
-# Try to apply to the patch which depends on the missing tag (we expect darcs
-# to fail gracefully here)
-not darcs apply ../patch.dpatch &> apply_output.txt
-
-# A best-attempt at ensuring darcs warns about the missing tag:
-grep "tagged file2 tag" apply_output.txt
-grep "FATAL: Cannot apply this bundle. We are missing the above patches." apply_output.txt
diff --git a/tests/issue1977-darcs-repair.sh b/tests/issue1977-darcs-repair.sh
deleted file mode 100644
--- a/tests/issue1977-darcs-repair.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/usr/bin/env bash
-
-# Issue1977 darcs repair complains when there is no pristine.hashed directory
-. ./lib
-mkdir temp1
-cd temp1
-darcs init
-echo "a" > a
-darcs add a
-darcs rec -am a
-rm -rf _darcs/pristine.hashed/
-darcs repair
diff --git a/tests/issue2017-missing-tag.sh b/tests/issue2017-missing-tag.sh
deleted file mode 100644
--- a/tests/issue2017-missing-tag.sh
+++ /dev/null
@@ -1,85 +0,0 @@
-#!/usr/bin/env bash
-## Test for issue2017 - apply should gracefully handle tag missing
-## from context (complain, not crash)
-##
-## Copyright (C) 2010 Eric Kow
-##
-## Permission is hereby granted, free of charge, to any person
-## obtaining a copy of this software and associated documentation
-## files (the "Software"), to deal in the Software without
-## restriction, including without limitation the rights to use, copy,
-## modify, merge, publish, distribute, sublicense, and/or sell copies
-## of the Software, and to permit persons to whom the Software is
-## furnished to do so, subject to the following conditions:
-##
-## The above copyright notice and this permission notice shall be
-## included in all copies or substantial portions of the Software.
-##
-## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-## EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-## MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-## NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-## BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-## ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-## CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-## SOFTWARE.
-
-. lib                           # Load some portability helpers.
-darcs init      --repo R        # Create our test repos.
-
-cd R
-echo 'Example content.' > f
-darcs record -lam 'Add f'
-cd ..
-
-# variant 0 - this passes trivially
-darcs get R R0
-darcs get R0 S0
-darcs tag 's' --repo S0
-darcs get S0 T0
-cd T0
-echo 'More content.' > f
-darcs record -lam 'Modify f'
-darcs send -o foo.dpatch -a
-cd ..
-not darcs apply --repo R0 T0/foo.dpatch > log 2>&1
-not grep bug log
-grep missing log
-
-# variant 1 - tag in shared context
-darcs get R R1
-darcs tag '1' --repo R1
-darcs get R1 S1
-darcs tag 's1' --repo S1
-darcs get S1 T1
-cd T1
-echo 'More content.' > f
-darcs record -lam 'Modify f'
-darcs send -o foo.dpatch -a
-cd ..
-# sanity check: should be able to cherry pick
-darcs get R1 R1b
-cd R1b
-[ `darcs changes --count` -eq 2 ]
-darcs pull ../T1 --match 'touch f' --all
-[ `darcs changes --count` -eq 3 ]
-cd ..
-# the test: can't apply this due to incorrect context
-not darcs apply --repo R1 T1/foo.dpatch > log 2>&1
-not grep 'bug' log
-grep missing log
-
-# variant 2 - tag created after the fact
-darcs get R  R2
-darcs get R2 S2
-darcs tag 's2' --repo S2
-darcs get S2 T2
-cd T2
-echo 'More content.' > f
-darcs record -lam 'Modify f'
-darcs send -o foo.dpatch -a
-cd ..
-darcs tag '2'  --repo R2  # only tag after
-not darcs apply --repo R2 T2/foo.dpatch > log 2>&1
-not grep 'bug' log
-grep missing log
diff --git a/tests/issue2052-default-unified-diff.sh b/tests/issue2052-default-unified-diff.sh
deleted file mode 100644
--- a/tests/issue2052-default-unified-diff.sh
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/usr/bin/env bash
-## Test for issue2052 - Ensure we use unified Diff by default.
-##
-## Copyright (C) 2011  Owen Stephens
-##
-## Permission is hereby granted, free of charge, to any person
-## obtaining a copy of this software and associated documentation
-## files (the "Software"), to deal in the Software without
-## restriction, including without limitation the rights to use, copy,
-## modify, merge, publish, distribute, sublicense, and/or sell copies
-## of the Software, and to permit persons to whom the Software is
-## furnished to do so, subject to the following conditions:
-##
-## The above copyright notice and this permission notice shall be
-## included in all copies or substantial portions of the Software.
-##
-## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-## EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-## MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-## NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-## BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-## ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-## CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-## SOFTWARE.
-
-. ./lib
-. lib                           # Load some portability helpers.
-
-rm -rf R
-darcs init --repo R
-cd R
-touch a
-darcs add a
-darcs record -am 'Add a'
-
-echo testing > a
-
-test `darcs diff | grep -c "diff -rN -u"` -eq 1
-test `darcs diff --no-unified | grep -c "diff -rN -u"` -eq 0
-test `darcs diff --no-unified | grep -c "diff -rN"` -eq 1
diff --git a/tests/issue2067-diff-blanklines.sh b/tests/issue2067-diff-blanklines.sh
deleted file mode 100644
--- a/tests/issue2067-diff-blanklines.sh
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/usr/bin/env bash
-## Test for 2067: inexistant files result in empty lines in darcs
-##diff
-##
-## Copyright (C) YEAR  AUTHOR
-##
-## Permission is hereby granted, free of charge, to any person
-## obtaining a copy of this software and associated documentation
-## files (the "Software"), to deal in the Software without
-## restriction, including without limitation the rights to use, copy,
-## modify, merge, publish, distribute, sublicense, and/or sell copies
-## of the Software, and to permit persons to whom the Software is
-## furnished to do so, subject to the following conditions:
-##
-## The above copyright notice and this permission notice shall be
-## included in all copies or substantial portions of the Software.
-##
-## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-## EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-## MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-## NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-## BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-## ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-## CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-## SOFTWARE.
-
-. lib                           # Load some portability helpers.
-darcs init      --repo R        # Create our test repos.
-cd R
-darcs diff a b c d 2> /dev/null | wc -l | grep "^ *0$"
diff --git a/tests/issue2179-diff-with-dir-path.sh b/tests/issue2179-diff-with-dir-path.sh
deleted file mode 100644
--- a/tests/issue2179-diff-with-dir-path.sh
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/usr/bin/env bash
-## Test for issue2179 - darcs diff on a dir should diff everything in and below
-## that directory.
-## needed to be forced.
-##
-## Copyright (C) 2012 Owen Stephens
-##
-## Permission is hereby granted, free of charge, to any person
-## obtaining a copy of this software and associated documentation
-## files (the "Software"), to deal in the Software without
-## restriction, including without limitation the rights to use, copy,
-## modify, merge, publish, distribute, sublicense, and/or sell copies
-## of the Software, and to permit persons to whom the Software is
-## furnished to do so, subject to the following conditions:
-##
-## The above copyright notice and this permission notice shall be
-## included in all copies or substantial portions of the Software.
-##
-## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-## EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-## MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-## NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-## BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-## ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-## CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-## SOFTWARE.
-
-. lib
-
-rm -rf R
-darcs init --repo R
-
-cd R
-mkdir dir
-touch dir/file
-darcs rec -alm 'Add dir/file'
-
-echo testing > dir/file
-
-darcs wh | grep testing
-
-darcs diff | grep testing
-
-darcs diff dir/file | grep testing
-
-darcs diff dir | grep testing
diff --git a/tests/issue2193-apply-runs-test-twice.sh b/tests/issue2193-apply-runs-test-twice.sh
deleted file mode 100644
--- a/tests/issue2193-apply-runs-test-twice.sh
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/usr/bin/env bash
-## Test for issue2193 - "darcs apply --test runs the test twice.
-##
-## Copyright (C) 2012 Ilya Perminov
-##
-## Permission is hereby granted, free of charge, to any person
-## obtaining a copy of this software and associated documentation
-## files (the "Software"), to deal in the Software without
-## restriction, including without limitation the rights to use, copy,
-## modify, merge, publish, distribute, sublicense, and/or sell copies
-## of the Software, and to permit persons to whom the Software is
-## furnished to do so, subject to the following conditions:
-##
-## The above copyright notice and this permission notice shall be
-## included in all copies or substantial portions of the Software.
-##
-## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-## EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-## MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-## NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-## BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-## ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-## CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-## SOFTWARE.
-
-. lib
-
-darcs init --repo R
-darcs get R S
-
-# Create a patch bundle
-cd R
-echo 'Example content.' >file1
-darcs add file1
-darcs rec -a --name patch1
-darcs send --dont-edit-description --output=./patch1 -a ../S
-
-# Setup a test that prints a unique string, apply the patch set, check that the unique 
-# string occurs in the output once.
-cd ../S 
-darcs setpref test 'echo 2a427e65f322be754dce67c829e5f8a3'
-darcs apply --test ../R/patch1 > log 2>&1
-[ `fgrep -c 2a427e65f322be754dce67c829e5f8a3 log` -eq 1 ]
diff --git a/tests/issue2199-get-dirty-tag.sh b/tests/issue2199-get-dirty-tag.sh
deleted file mode 100644
--- a/tests/issue2199-get-dirty-tag.sh
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/usr/bin/env bash
-## Test for issue2199 - "darcs get --tag" gets too much if the tag is dirty.
-##
-## Copyright (C) 2012 Ganesh Sittampalam
-##
-## Permission is hereby granted, free of charge, to any person
-## obtaining a copy of this software and associated documentation
-## files (the "Software"), to deal in the Software without
-## restriction, including without limitation the rights to use, copy,
-## modify, merge, publish, distribute, sublicense, and/or sell copies
-## of the Software, and to permit persons to whom the Software is
-## furnished to do so, subject to the following conditions:
-##
-## The above copyright notice and this permission notice shall be
-## included in all copies or substantial portions of the Software.
-##
-## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-## EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-## MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-## NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-## BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-## ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-## CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-## SOFTWARE.
-
-. lib
-
-darcs init --repo R
-
-cd R
-echo 'wibble' > file
-darcs rec -lam 'wibble'
-echo 'wobble' > file
-darcs rec -lam 'wobble'
-cd ..
-
-darcs get R R-temp
-
-cd R-temp
-darcs unpull --patch 'wobble' -a
-darcs tag 'wibble'
-cd ..
-
-cd R
-darcs pull ../R-temp -a
-cd ..
-
-darcs get --tag wibble R R-tag
-cd R-tag
-darcs changes | not grep wobble
diff --git a/tests/issue2207-annotate-directory.sh b/tests/issue2207-annotate-directory.sh
deleted file mode 100644
--- a/tests/issue2207-annotate-directory.sh
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/usr/bin/env bash
-## Test for issue2207 - <SYNOPSIS: simple test for annotate
-## on directories.>
-##
-## Copyright (C) 2012  BSRK Aditya
-##
-## Permission is hereby granted, free of charge, to any person
-## obtaining a copy of this software and associated documentation
-## files (the "Software"), to deal in the Software without
-## restriction, including without limitation the rights to use, copy,
-## modify, merge, publish, distribute, sublicense, and/or sell copies
-## of the Software, and to permit persons to whom the Software is
-## furnished to do so, subject to the following conditions:
-##
-## The above copyright notice and this permission notice shall be
-## included in all copies or substantial portions of the Software.
-##
-## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-## EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-## MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-## NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-## BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-## ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-## CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-## SOFTWARE.
-
-. lib                           # Load some portability helpers.
-
-rm -rf R
-darcs init --repo R
-
-cd R
-
-mkdir d
-touch d/f
-
-darcs record -lam 'p1'
-
-darcs annotate d | grep 'p1'
diff --git a/tests/issue2230-invalid-context-too-late.sh b/tests/issue2230-invalid-context-too-late.sh
deleted file mode 100644
--- a/tests/issue2230-invalid-context-too-late.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env bash
-## Test for issue2230 - darcs get --context checks the validity of the context
-## file too late.
-##
-## Copyright (C) 2012 Owen Stephens
-##
-## Permission is hereby granted, free of charge, to any person
-## obtaining a copy of this software and associated documentation
-## files (the "Software"), to deal in the Software without
-## restriction, including without limitation the rights to use, copy,
-## modify, merge, publish, distribute, sublicense, and/or sell copies
-## of the Software, and to permit persons to whom the Software is
-## furnished to do so, subject to the following conditions:
-##
-## The above copyright notice and this permission notice shall be
-## included in all copies or substantial portions of the Software.
-##
-## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-## EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-## MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-## NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-## BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-## ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-## CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-## SOFTWARE.
-
-. lib
-
-darcs init --repo R
-
-touch fake_context.txt
-
-not darcs get --context fake_context.txt R S
-
-# The get should fail, so we shouldn't have an S repo
-[[ ! -e S ]]
diff --git a/tests/issue2242-rollback-mv.sh b/tests/issue2242-rollback-mv.sh
deleted file mode 100644
--- a/tests/issue2242-rollback-mv.sh
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/usr/bin/env bash
-## Test for issue2242 - rollback of a mv patch generates bogus changes
-##
-## Copyright (C) 2012 Owen Stephens
-##
-## Permission is hereby granted, free of charge, to any person
-## obtaining a copy of this software and associated documentation
-## files (the "Software"), to deal in the Software without
-## restriction, including without limitation the rights to use, copy,
-## modify, merge, publish, distribute, sublicense, and/or sell copies
-## of the Software, and to permit persons to whom the Software is
-## furnished to do so, subject to the following conditions:
-##
-## The above copyright notice and this permission notice shall be
-## included in all copies or substantial portions of the Software.
-##
-## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-## EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-## MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-## NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-## BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-## ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-## CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-## SOFTWARE.
-
-. lib
-
-rm -rf R
-darcs init --repo R
-cd R
-
-# Setup dir with empty file in it
-mkdir A
-touch A/foo
-darcs rec -alm 'Add A'
-
-# Mv dir and add content to file
-darcs mv A B
-echo -e 'line1\nline2' > B/foo
-darcs rec -alm 'Move A -> B and change foo'
-
-# Rollback everything in the move/change patch
-echo ynya | darcs roll
-
-# We shouldn't see any rm'd dirs/files (just a move and line removal hunk)
-darcs wh | not grep rm
diff --git a/tests/issue2244-dup-tag-warning.sh b/tests/issue2244-dup-tag-warning.sh
deleted file mode 100644
--- a/tests/issue2244-dup-tag-warning.sh
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/usr/bin/env bash
-. lib                           # Load some portability helpers.
-
-t=`(dd if=/dev/urandom count=1 | tr -cd "a-zA-Z0-9" | head -c 10)` # Create de tag name.
-darcs init --repo R        # Create our test repos.
-
-# Test about issue 2244: darcs tag should warn about duplicate tags.
-
-cd R
-darcs tag "$t"
-darcs show tag | grep "$t"
-darcs tag "$t" | grep 'WARNING'
-cd ..
diff --git a/tests/issue2253-make-patch-index-oldfashioned.sh b/tests/issue2253-make-patch-index-oldfashioned.sh
deleted file mode 100644
--- a/tests/issue2253-make-patch-index-oldfashioned.sh
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/usr/bin/env bash
-## Test for issue2253 - darcs changes FILE tries (and fails) to build a patch index
-## on an oldfashioned repo
-##
-## Copyright (C) 2012 Owen Stephens
-##
-## Permission is hereby granted, free of charge, to any person
-## obtaining a copy of this software and associated documentation
-## files (the "Software"), to deal in the Software without
-## restriction, including without limitation the rights to use, copy,
-## modify, merge, publish, distribute, sublicense, and/or sell copies
-## of the Software, and to permit persons to whom the Software is
-## furnished to do so, subject to the following conditions:
-##
-## The above copyright notice and this permission notice shall be
-## included in all copies or substantial portions of the Software.
-##
-## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-## EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-## MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-## NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-## BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-## ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-## CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-## SOFTWARE.
-
-. lib
-
-gunzip -c $TESTDATA/oldfashioned.tgz | tar xf -
-
-cd oldfashioned
-darcs changes x
diff --git a/tests/issue2447-show-content-of-removed-file.sh b/tests/issue2447-show-content-of-removed-file.sh
deleted file mode 100644
--- a/tests/issue2447-show-content-of-removed-file.sh
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/usr/bin/env bash
-## Test for issue2447 - get contents of deleted file 
-##
-## Copyright (C) 2015  Ben Franksen
-##
-## Permission is hereby granted, free of charge, to any person
-## obtaining a copy of this software and associated documentation
-## files (the "Software"), to deal in the Software without
-## restriction, including without limitation the rights to use, copy,
-## modify, merge, publish, distribute, sublicense, and/or sell copies
-## of the Software, and to permit persons to whom the Software is
-## furnished to do so, subject to the following conditions:
-##
-## The above copyright notice and this permission notice shall be
-## included in all copies or substantial portions of the Software.
-##
-## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-## EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-## MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-## NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-## BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-## ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-## CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-## SOFTWARE.
-
-. lib                           # Load some portability helpers.
-darcs init      --repo R        # Create our test repos.
-
-cd R
-
-echo 'example content' > f
-darcs add f
-darcs record -am 'add f'
-hash1=$(darcs log --last=1 | grep '^patch' | cut -d ' ' -f 2)
-rm f
-darcs record -am 'removed f'
-darcs show contents --hash $hash1 f | grep 'example content'
-
-mkdir d
-echo 'example content' > d/f
-darcs add d/f
-darcs record -am 'add d/f'
-hash2=$(darcs log --last=1 | grep '^patch' | cut -d ' ' -f 2)
-rm d/f
-darcs record -am 'removed d/f'
-darcs show contents --hash $hash2 d/f | grep 'example content'
-
-darcs obliterate -a --last=1
-
-rm -rf d
-darcs record -am 'removed d and d/f'
-darcs show contents --hash $hash2 d/f | grep 'example content'
diff --git a/tests/issue2496-output-of-whatsnew-with-file-arguments.sh b/tests/issue2496-output-of-whatsnew-with-file-arguments.sh
new file mode 100644
--- /dev/null
+++ b/tests/issue2496-output-of-whatsnew-with-file-arguments.sh
@@ -0,0 +1,72 @@
+#!/usr/bin/env bash
+
+# Load some portability helpers
+. lib
+
+echo added          >> ../all_paths
+echo not-added      >> ../all_paths
+echo recorded       >> ../all_paths
+echo removed        >> ../all_paths
+echo not-existing   >> ../all_paths
+echo /not-repo-path >> ../all_paths
+
+check_report() {
+  yes="$1"
+  log="$2"
+  pre="$3"
+  shift
+  shift
+  shift
+  paths="$@"
+  for arg in "$@"; do
+    grep $yes "$pre.\+$arg" "$log"
+  done
+}
+
+check_report_yes() {
+  check_report '' "$@"
+}
+
+check_report_no() {
+  check_report '-v' "$@"
+}
+
+# Create and populate test repo
+darcs init --repo R
+cd R
+touch recorded removed
+darcs add recorded removed
+darcs record -am'two files'
+touch added not-added
+rm removed
+darcs add added
+
+# Now do the tests
+darcs whatsnew added not-added recorded removed not-existing /not-repo-path > ../whatsnew.out 2>&1
+
+check_report_yes ../whatsnew.out 'non-repository' /not-repo-path
+check_report_no ../whatsnew.out 'non-repository' added not-added recorded removed not-existing
+
+check_report_yes ../whatsnew.out 'non-existing' not-added not-existing
+check_report_no ../whatsnew.out 'non-existing' added recorded removed /not-repo-path
+
+check_report_yes ../whatsnew.out "What's new" added recorded removed
+check_report_no ../whatsnew.out "What's new" not-added not-existing /not-repo-path
+
+darcs whatsnew -l added not-added recorded removed not-existing /not-repo-path > ../whatsnew-l.out 2>&1
+
+check_report_yes ../whatsnew-l.out 'non-repository' /not-repo-path
+check_report_no ../whatsnew-l.out 'non-repository' added not-added recorded removed not-existing
+
+check_report_yes ../whatsnew-l.out 'non-existing' not-existing
+check_report_no ../whatsnew-l.out 'non-existing' added not-added recorded removed /not-repo-path
+
+check_report_no ../whatsnew-l.out 'not.\+in.\+repository' added not-added recorded removed not-existing /not-repo-path
+
+check_report_yes ../whatsnew-l.out "What's new" added not-added recorded removed
+check_report_no ../whatsnew-l.out "What's new" not-existing /not-repo-path
+
+darcs whatsnew -l -q added not-added recorded removed not-existing /not-repo-path > ../whatsnew-l-q.stdout
+
+not grep 'paths' ../whatsnew-l-q.stdout
+check_report_no ../whatsnew-l-q.stdout "What's new" added not-added recorded removed not-existing /not-repo-path
diff --git a/tests/issue885_get_to_match.sh b/tests/issue885_get_to_match.sh
deleted file mode 100644
--- a/tests/issue885_get_to_match.sh
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/bin/sh
-
-# Issue885: Regression: "darcs get --to-match" does not work anymore under 2.0
-
-
-. lib
-
-rm -rf temp1
-mkdir temp1
-cd temp1
-darcs init
-echo first > a
-darcs add a
-darcs record -am 'first'
-firsthash=`darcs changes --xml | grep 'hash=' | sed -e "s/.*hash='//" -e "s/'>//"`
-echo second > b
-darcs add b
-darcs record -am 'second'
-
-# Pulling that patch works ok
-cd ..
-rm -rf temp2
-mkdir temp2
-cd temp2
-darcs init
-echo darcs pull -v -a --match "hash $firsthash" ../temp1
-darcs pull -v -a --match "hash $firsthash" ../temp1
-
-# Getting up-to that patch does not
-cd ..
-rm -rf temp3
-echo darcs get -v --to-match "hash $firsthash" temp1 temp3
-darcs get -v --to-match "hash $firsthash" temp1 temp3
-
diff --git a/tests/issue966_diff.sh b/tests/issue966_diff.sh
deleted file mode 100644
--- a/tests/issue966_diff.sh
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/usr/bin/env bash
-. ./lib
-
-rm -rf temp
-mkdir temp; cd temp
-darcs init
-echo "aaa diff" > file
-darcs add file
-darcs record -a -m "aaa"
-echo "bbb diff" >> file
-darcs record -a -m "bbb"
-
-darcs diff --patch "aaa" | grep "aaa diff"
-darcs diff --patch "bbb" | grep "bbb diff"
-
-darcs tag release-1
-darcs optimize clean
-
-echo "ccc diff" >> file
-darcs record -a -m "ccc"
-darcs diff --patch "ccc" | grep "ccc diff"
-
-# here is where we have a problem
-darcs diff --patch "aaa" | grep "aaa diff"
-darcs diff --patch "bbb" | grep "bbb diff"
diff --git a/tests/justrm.sh b/tests/justrm.sh
deleted file mode 100644
--- a/tests/justrm.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/usr/bin/env bash
-. ./lib
-
-rm -rf temp1
-mkdir temp1
-cd temp1
-darcs init
-touch foo
-darcs add foo
-darcs record -a -m add_foo -A x
-rm foo
-darcs whatsnew
-cd ..
-rm -rf temp1
-
diff --git a/tests/nfs-failure.sh b/tests/nfs-failure.sh
deleted file mode 100644
--- a/tests/nfs-failure.sh
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/bin/sh
-
-. ./lib
-
-rm -rf temp1 temp2
-mkdir temp1
-cd temp1
-darcs init
-echo first > a
-darcs add a
-darcs record --pipe --all --name=first <<EOF
-Thu Sep 18 22:37:06 MSD 2008
-author
-EOF
-
-echo first > b
-darcs add b
-darcs record --pipe --all --name=first <<EOF
-Thu Sep 18 22:37:06 MSD 2008
-author
-EOF
-
-# it seems that somehow the following occasionally fails on an nfs
-# filesystem when darcs is compiled with ghc 6.6.
-
-darcs get . ../temp2
-
-# it fails with something like:
-
-# darcs: ./_darcs/patches/20080918223706-f64cd-6b512400a8108808b7ba7057f0eac2adf473b3ae.gz: copyFile: resource busy (file is locked)
-
-
-cd ..
-
-rm -rf temp1 temp2
diff --git a/tests/oldfashioned.sh b/tests/oldfashioned.sh
new file mode 100644
--- /dev/null
+++ b/tests/oldfashioned.sh
@@ -0,0 +1,103 @@
+#!/usr/bin/env bash
+
+## Test that darcs refuses to work on old-fashioned repositories
+## for certain commands.
+##
+## Copyright (C) 2011 Guillaume Hoffmann
+##
+## Permission is hereby granted, free of charge, to any person
+## obtaining a copy of this software and associated documentation
+## files (the "Software"), to deal in the Software without
+## restriction, including without limitation the rights to use, copy,
+## modify, merge, publish, distribute, sublicense, and/or sell copies
+## of the Software, and to permit persons to whom the Software is
+## furnished to do so, subject to the following conditions:
+##
+## The above copyright notice and this permission notice shall be
+## included in all copies or substantial portions of the Software.
+##
+## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+## EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+## MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+## NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+## BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+## ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+## CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+## SOFTWARE.
+
+. lib                  # Load some portability helpers.
+
+rm -rf old hashed
+gunzip -c $TESTDATA/many-files--old-fashioned-inventory.tgz | tar xf -
+mv many-files--old-fashioned-inventory old
+
+cd old
+not darcs add
+not darcs amend
+not darcs annotate
+not darcs apply
+not darcs diff
+not darcs dist
+not darcs mark
+not darcs move
+not darcs pull
+not darcs push
+not darcs record
+not darcs remove
+not darcs repair
+not darcs replace
+not darcs revert
+not darcs rollback
+not darcs send
+not darcs setpref
+not darcs tag
+not darcs test
+not darcs unrecord
+not darcs unrevert
+cd ..
+
+## test that darcs can clone, pull and send (from, to) a remote
+## old-fashioned repository.
+
+darcs clone old hashed
+cd hashed
+
+test -e _darcs/hashed_inventory # issue1110: clone hashed
+rm -rf temp1 temp2
+
+echo "yyyd" | darcs unpull
+
+darcs pull -a
+
+touch tralala
+darcs add tralala
+darcs rec -am "patch to be sent"
+darcs send -aO
+
+cd ..
+
+# issue2253 - darcs log FILE should build patch index in an OF repo
+cd old
+darcs log x
+
+# issue1584 - darcs optimize --upgrade
+
+echo x > foo # Unrecorded change
+darcs optimize upgrade
+darcs check
+grep hashed _darcs/format
+not grep darcs-2 _darcs/format
+darcs whatsnew | grep 'hunk ./foo 1'
+cd ..
+
+rm -rf old hashed
+
+## issue1248 - darcs doesn't handle darcs 1 repos with compressed
+## inventories
+
+gunzip -c  $TESTDATA/oldfashioned-compressed.tgz | tar xf -
+cd oldfashioned-compressed
+darcs optimize upgrade
+darcs check
+cd ..
+rm -rf oldfashioned-compressed
diff --git a/tests/oldfashioned_refusal.sh b/tests/oldfashioned_refusal.sh
deleted file mode 100644
--- a/tests/oldfashioned_refusal.sh
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/usr/bin/env bash
-
-## Test that darcs refuses to work on old-fashioned repositories
-## for certain commands.
-##
-## Copyright (C) 2011 Guillaume Hoffmann
-##
-## Permission is hereby granted, free of charge, to any person
-## obtaining a copy of this software and associated documentation
-## files (the "Software"), to deal in the Software without
-## restriction, including without limitation the rights to use, copy,
-## modify, merge, publish, distribute, sublicense, and/or sell copies
-## of the Software, and to permit persons to whom the Software is
-## furnished to do so, subject to the following conditions:
-##
-## The above copyright notice and this permission notice shall be
-## included in all copies or substantial portions of the Software.
-##
-## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-## EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-## MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-## NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-## BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-## ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-## CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-## SOFTWARE.
-
-. lib                  # Load some portability helpers.
-
-rm -rf old
-gunzip -c $TESTDATA/many-files--old-fashioned-inventory.tgz | tar xf -
-mv many-files--old-fashioned-inventory old
-
-cd old
-not darcs add
-not darcs amend
-not darcs annotate
-not darcs apply
-not darcs diff
-not darcs dist
-not darcs mark
-not darcs move
-not darcs pull
-not darcs push
-not darcs record
-not darcs remove
-not darcs repair
-not darcs replace
-not darcs revert
-not darcs rollback
-not darcs send
-not darcs setpref
-not darcs tag
-not darcs test
-not darcs unrecord
-not darcs unrevert
diff --git a/tests/oldfashioned_support.sh b/tests/oldfashioned_support.sh
deleted file mode 100644
--- a/tests/oldfashioned_support.sh
+++ /dev/null
@@ -1,44 +0,0 @@
-#!/usr/bin/env bash
-
-## Test that darcs can get, pull and send (from, to) a remote
-## old-fashioned repository.
-##
-## Copyright (C) 2011 Guillaume Hoffmann
-##
-## Permission is hereby granted, free of charge, to any person
-## obtaining a copy of this software and associated documentation
-## files (the "Software"), to deal in the Software without
-## restriction, including without limitation the rights to use, copy,
-## modify, merge, publish, distribute, sublicense, and/or sell copies
-## of the Software, and to permit persons to whom the Software is
-## furnished to do so, subject to the following conditions:
-##
-## The above copyright notice and this permission notice shall be
-## included in all copies or substantial portions of the Software.
-##
-## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-## EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-## MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-## NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-## BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-## ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-## CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-## SOFTWARE.
-
-. lib                  # Load some portability helpers.
-
-rm -rf old hashed
-gunzip -c $TESTDATA/many-files--old-fashioned-inventory.tgz | tar xf -
-mv many-files--old-fashioned-inventory old
-
-darcs get old hashed
-cd hashed
-
-echo "yyyd" | darcs unpull
-
-darcs pull -a
-
-touch tralala
-darcs add tralala
-darcs rec -am "patch to be sent"
-darcs send -aO
diff --git a/tests/record.sh b/tests/record.sh
--- a/tests/record.sh
+++ b/tests/record.sh
@@ -209,3 +209,26 @@
 not grep "None of the files" log
 cd ..
 rm -rf temp1
+
+# issue1472 - "darcs record ./foo" shouldn't even TRY to read ./bar
+
+darcs init temp1
+mkdir temp1/d/
+echo 'Example content.' >temp1/f
+echo 'Similar content.' >temp1/d/f
+chmod 0 temp1/f # Make temp1/f unreadable
+darcs record    --repo temp1 -lam 'Only changes to temp1/d/.' d
+rm -rf temp1
+
+# issue1871 - `darcs record .` should work for tracked changes
+# in a subdirectory even if the subdirectory itself is not known yet.
+darcs init temp1
+cd temp1
+mkdir d
+echo 'Example content.' > d/f
+darcs add d/f
+echo ny | darcs record
+echo ny | darcs record . > log
+not grep "None of the files" log
+cd ..
+rm -rf temp1
diff --git a/tests/repair-clean.sh b/tests/repair-clean.sh
deleted file mode 100644
--- a/tests/repair-clean.sh
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/usr/bin/env bash
-. ./lib
-
-rm -rf temp1
-mkdir temp1
-cd temp1
-
-darcs init
-touch baz
-darcs add baz
-darcs record -m moo -a
-
-cat _darcs/patches/pending
-
-darcs changes -v
-
-darcs check
-
-# check that repair doesn't do anything to a clean repository
-darcs repair > out
-cat out
-grep 'already consistent' out
-
-cd ..
-rm -rf temp1
diff --git a/tests/repair-corrupt-add.sh b/tests/repair-corrupt-add.sh
deleted file mode 100644
--- a/tests/repair-corrupt-add.sh
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/usr/bin/env bash
-## Test that we can repair incorrect adds
-##
-## Copyright (C) 2012 Ganesh Sittampalam
-##
-## Permission is hereby granted, free of charge, to any person
-## obtaining a copy of this software and associated documentation
-## files (the "Software"), to deal in the Software without
-## restriction, including without limitation the rights to use, copy,
-## modify, merge, publish, distribute, sublicense, and/or sell copies
-## of the Software, and to permit persons to whom the Software is
-## furnished to do so, subject to the following conditions:
-##
-## The above copyright notice and this permission notice shall be
-## included in all copies or substantial portions of the Software.
-##
-## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-## EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-## MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-## NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-## BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-## ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-## CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-## SOFTWARE.
-
-. lib
-
-rm -rf bad
-mkdir bad
-cd bad
-darcs init --no-patch-index
-
-echo foo > file
-darcs add file
-mkdir dir
-darcs add dir
-
-darcs rec -a -m 'initial'
-
-darcs changes --verbose --patches 'initial'
-
-# produce a corrupt addfile patch
-echo 'addfile ./file' > _darcs/patches/pending
-echo 'yny' | darcs rec -m 're-add file'
-
-not darcs check
-darcs repair
-darcs check
-
-# produce a corrupt adddir patch
-echo 'adddir ./dir' > _darcs/patches/pending
-echo 'yy' | darcs rec -m 're-add dir'
-
-not darcs check
-darcs repair
-darcs check
diff --git a/tests/repair-corrupt.sh b/tests/repair-corrupt.sh
deleted file mode 100644
--- a/tests/repair-corrupt.sh
+++ /dev/null
@@ -1,68 +0,0 @@
-. lib
-
-rm -rf bad
-mkdir bad
-cd bad
-darcs init --no-patch-index
-
-echo foo > bar
-darcs add bar
-darcs rec -a -m 'foo'
-
-echo hey > foo
-darcs add foo
-darcs rec -a -m 'more foo'
-
-hashed=false
-test -e _darcs/hashed_inventory && hashed=true
-cp -R _darcs _clean_darcs
-
-# produce a corrupt patch
-echo 'rmfile foo' > _darcs/patches/pending
-$hashed || echo -n > _darcs/pristine/foo
-darcs rec -a -m 'remove foo'
-
-not darcs check # unapplicable patch!
-cp -R _darcs/ _backup_darcs
-darcs repair # repairs the patch
-darcs check
-rm -rf _darcs
-mv _backup_darcs _darcs # get the bad patch back
-
-# stash away contents of _darcs
-cp -R _darcs/ _backup_darcs
-
-echo here > bar
-darcs rec -a -m 'here'
-
-# corrupt pristine content
-corrupt_pristine() {
-    $hashed && inv=`grep ^pristine _darcs/hashed_inventory`
-    cp _backup_darcs/patches/* _darcs/patches/
-    cp _backup_darcs/*inventory* _darcs/
-    if $hashed; then
-        cp _darcs/hashed_inventory hashed.tmp
-        sed -e "s,^pristine:.*$,$inv," < hashed.tmp > _darcs/hashed_inventory
-        rm hashed.tmp
-    fi
-}
-
-corrupt_pristine
-not darcs check # just a little paranoia
-
-darcs repair # repair succeeds
-darcs check # and the resulting repo is consistent
-
-# *AND* it contains what we expect...
-darcs show contents bar > foobar
-echo foo > foobar1
-diff foobar foobar1
-
-rm -rf _backup_darcs
-mv _clean_darcs _backup_darcs
-corrupt_pristine # without the unapplicable patch
-not darcs check
-darcs repair
-darcs check
-
-cd ..
diff --git a/tests/repair.sh b/tests/repair.sh
--- a/tests/repair.sh
+++ b/tests/repair.sh
@@ -2,21 +2,17 @@
 . ./lib
 
 rm -rf temp1
-mkdir temp1
+darcs init temp1
 cd temp1
-darcs initialize
 echo ALL ignore-times >> _darcs/prefs/defaults
 echo A1 > foo
 mkdir d
 echo A2 > d/bar
-darcs add foo
-darcs add d
-darcs add d/bar
-darcs record -a -m AA -A x
+darcs record -lam AA
 echo B > foo
-darcs record -a -m BB -A x
+darcs record -lam BB
 echo C > foo
-darcs record -a -m CC -A x
+darcs record -lam CC
 
 for i in _darcs/pristine*; do
   echo Empty the pristine directory: $i
@@ -26,5 +22,133 @@
 
 darcs repair
 
+cd ..
+rm -rf temp1
+
+# issue1977: repair complains when there is no pristine.hashed directory
+
+darcs init temp1
+cd temp1
+echo "a" > a
+darcs rec -lam a
+rm -rf _darcs/pristine.hashed/
+darcs repair
+cd ..
+rm -rf temp1
+
+# check that repair doesn't do anything to a clean repository
+darcs init temp1
+cd temp1
+touch baz
+darcs record -lam moo
+darcs repair | grep 'already consistent'
+cd ..
+rm -rf temp1
+
+# test that we can repair incorrect adds
+
+darcs init temp1
+cd temp1
+
+echo foo > file
+mkdir dir
+darcs rec -lam 'initial'
+
+# produce a corrupt addfile patch
+echo 'addfile ./file' > _darcs/patches/pending
+echo 'yny' | darcs rec -m 're-add file'
+
+not darcs check
+darcs repair
+darcs check
+
+# produce a corrupt adddir patch
+echo 'adddir ./dir' > _darcs/patches/pending
+echo 'yy' | darcs rec -m 're-add dir'
+
+not darcs check
+darcs repair
+darcs check
+cd ..
+rm -rf temp1
+
+# test for repair of a corrupt repository 
+darcs init temp1
+cd temp1
+
+echo foo > bar
+darcs rec -lam 'foo'
+
+echo hey > foo
+darcs rec -lam 'more foo'
+
+hashed=false
+test -e _darcs/hashed_inventory && hashed=true
+cp -R _darcs _clean_darcs
+
+# produce a corrupt patch
+echo 'rmfile foo' > _darcs/patches/pending
+$hashed || echo -n > _darcs/pristine/foo
+darcs rec -a -m 'remove foo'
+
+not darcs check # unapplicable patch!
+cp -R _darcs/ _backup_darcs
+darcs repair # repairs the patch
+darcs check
+rm -rf _darcs
+mv _backup_darcs _darcs # get the bad patch back
+
+# stash away contents of _darcs
+cp -R _darcs/ _backup_darcs
+
+echo here > bar
+darcs rec -a -m 'here'
+
+# corrupt pristine content
+corrupt_pristine() {
+    $hashed && inv=`grep ^pristine _darcs/hashed_inventory`
+    cp _backup_darcs/patches/* _darcs/patches/
+    cp _backup_darcs/*inventory* _darcs/
+    if $hashed; then
+        cp _darcs/hashed_inventory hashed.tmp
+        sed -e "s,^pristine:.*$,$inv," < hashed.tmp > _darcs/hashed_inventory
+        rm hashed.tmp
+    fi
+}
+
+corrupt_pristine
+not darcs check # just a little paranoia
+
+darcs repair # repair succeeds
+darcs check # and the resulting repo is consistent
+
+# *AND* it contains what we expect...
+darcs show contents bar > foobar
+echo foo > foobar1
+diff foobar foobar1
+
+rm -rf _backup_darcs
+mv _clean_darcs _backup_darcs
+corrupt_pristine # without the unapplicable patch
+not darcs check
+darcs repair
+darcs check
+cd ..
+
+rm -rf temp1
+
+# issue2001: check (alias for repair --dry-run) is not read-only 
+
+darcs init temp1
+cd temp1
+mkdir d e
+echo 'Example content.' > d/f
+darcs record -lam 'Add d/f and e.'
+darcs mv d/f e/
+darcs record -am 'Move d/f to e/f.'
+rm _darcs/pristine.hashed/*     # Make the repository bogus
+cp -r _darcs archive
+not darcs check
+diff -r _darcs archive
 cd ..
 rm -rf temp1
diff --git a/tests/rmdir-formerly-pl.sh b/tests/rmdir-formerly-pl.sh
deleted file mode 100644
--- a/tests/rmdir-formerly-pl.sh
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/usr/bin/env bash
-
-. lib
-
-rm -rf temp1
-mkdir temp1
-cd temp1
-darcs init
-mkdir foo
-echo hello world > foo/bar
-echo hello world > foo/baz
-mkdir foo/dir
-darcs add foo foo/bar foo/dir foo/baz
-darcs record -a -m add
-rm -rf  foo
-darcs show files --no-pending --no-dir > log
-grep 'foo/baz' log
-grep 'foo/bar' log
-darcs show files --no-pending --no-fil > log
-grep 'foo/dir' log
-grep 'foo$'    log
-# now without...
-darcs record -a -m del
-darcs show files --no-pending --no-dir > log
-not grep 'foo/baz' log
-not grep 'foo/bar' log
-darcs show files --no-pending --no-fil > log
-not grep 'foo/dir' log
-not grep 'foo$'    log
-cd ..
-
-rm -rf temp1
diff --git a/tests/rmdir.sh b/tests/rmdir.sh
--- a/tests/rmdir.sh
+++ b/tests/rmdir.sh
@@ -63,3 +63,18 @@
 test ! -s pullresult
 
 rm -rf temp1 temp2 temp3
+
+
+# issue1749 - darcs remove <dir> corrupts the patch sequence
+darcs init temp1
+cd temp1
+mkdir dir
+touch dir/file
+darcs rec -lam "add dir and file"
+not darcs remove dir
+# removed dir but not file - should be nothing to add
+not darcs rec -a -m"remove dir"
+darcs obliterate -a --patch "remove dir" | grep 'No patches selected!'
+darcs check
+cd ..
+rm -rf temp1
diff --git a/tests/rollback-nothing.sh b/tests/rollback-nothing.sh
deleted file mode 100644
--- a/tests/rollback-nothing.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/usr/bin/env bash
-
-. ./lib
-
-rm -rf temp
-mkdir temp
-cd temp
-darcs init
-date > file1
-darcs add file1
-darcs record -am "test"
-rm file1
-darcs record -am "rm"
-echo yYd | tr [A-Z] [a-z] | darcs rollback --last=1 | grep 'No changes selected'
-cd ..
-rm -rf temp
diff --git a/tests/rollback.sh b/tests/rollback.sh
new file mode 100644
--- /dev/null
+++ b/tests/rollback.sh
@@ -0,0 +1,51 @@
+#!/usr/bin/env bash
+
+. ./lib
+
+# rollback nothing
+
+rm -rf temp1
+darcs init temp1
+cd temp1
+date > file1
+darcs record -lam "test"
+rm file1
+darcs record -am "rm"
+echo yYd | tr [A-Z] [a-z] | darcs rollback --last=1 | grep 'No changes selected'
+cd ..
+rm -rf temp1
+
+# issue1848 - interactive selection of primitive patches
+# should still work with rollback -p
+
+darcs init temp1
+cd temp1
+echo 'f' > f
+echo 'g' > g
+darcs record -lam 'Add f and g'
+echo ynq | darcs rollback -p 'f and g'
+cd ..
+rm -rf temp1
+
+# issue2242 - rollback of a mv patch generates bogus changes
+
+darcs init temp1
+cd temp1
+
+# Setup dir with empty file in it
+mkdir A
+touch A/foo
+darcs rec -alm 'Add A'
+
+# Mv dir and add content to file
+darcs mv A B
+echo -e 'line1\nline2' > B/foo
+darcs rec -alm 'Move A -> B and change foo'
+
+# Rollback everything in the move/change patch
+echo ynya | darcs roll
+
+# We shouldn't see any rm'd dirs/files (just a move and line removal hunk)
+darcs wh | not grep rm
+cd ..
+rm -rf temp1
diff --git a/tests/show_contents.sh b/tests/show_contents.sh
--- a/tests/show_contents.sh
+++ b/tests/show_contents.sh
@@ -27,3 +27,41 @@
 cd ..
 
 rm -rf temp1
+
+## issue1705 - darcs show contents --index=1 => darcs failed:  Pattern not specified in get_nonrange_match
+
+darcs init temp1
+cd temp1
+echo 111 > 1
+darcs record -lam 'add file 1'
+darcs show contents --index=1 1
+cd ..
+rm -rf temp1
+
+## issue2447 - get contents of deleted file 
+
+darcs init temp1
+cd temp1
+
+echo 'example content' > f
+darcs record -lam 'add f'
+hash1=$(darcs log --last=1 | grep '^patch' | cut -d ' ' -f 2)
+rm f
+darcs record -am 'removed f'
+darcs show contents --hash $hash1 f | grep 'example content'
+
+mkdir d
+echo 'example content' > d/f
+darcs record -lam 'add d/f'
+hash2=$(darcs log --last=1 | grep '^patch' | cut -d ' ' -f 2)
+rm d/f
+darcs record -am 'removed d/f'
+darcs show contents --hash $hash2 d/f | grep 'example content'
+
+darcs obliterate -a --last=1
+
+rm -rf d
+darcs record -am 'removed d and d/f'
+darcs show contents --hash $hash2 d/f | grep 'example content'
+cd ..
+rm -rf temp1
diff --git a/tests/tag.sh b/tests/tag.sh
--- a/tests/tag.sh
+++ b/tests/tag.sh
@@ -17,3 +17,12 @@
 grep tagged log
 cd ..
 rm -rf temp1 log
+
+# issue2244: warn about duplicate tags
+
+darcs init temp1
+cd temp1
+darcs tag shouldbeunique
+darcs tag shouldbeunique | grep 'WARNING'
+cd ..
+rm -rf temp1
