Mon Sep 22 15:43:04 BST 2008  Eric Kow <[EMAIL PROTECTED]>
  * Refactor file checking in add command.

New patches:

[Refactor file checking in add command.
Eric Kow <[EMAIL PROTECTED]>**20080922144304] hunk ./src/Darcs/Commands/Add.lhs 176
  where
   addp' :: Slurpy -> FilePath -> IO (Slurpy, Maybe (FL Prim), Maybe FilePath)
   addp' cur f =
-    if (if gotAllowCaseOnly
-        then slurp_has f cur
-        else slurp_has_anycase f cur)
-    then do return (cur, Nothing, Just f)
-    else do
-      isdir <- doesDirectoryReallyExist f
-      if isdir
-         then trypatch $ myadddir f
-         else do isfile <- doesFileReallyExist f
-                 if isfile
-                    then trypatch $ myaddfile f
-                    else do islink <- isFileReallySymlink f
-                            if islink then
-                               putInfo $ "Sorry, file " ++ f ++ " is a symbolic link, which is unsupported by darcs."
-                               else putInfo $ "File "++ f ++" does not exist!"
-                            return (cur, Nothing, Nothing)
-      where trypatch p =
+    do ftype <- getFileType f
+       case ftype of
+         _ | already_has    -> return (cur, Nothing, Just f)
+         Directory   -> trypatch $ myadddir f
+         File        -> trypatch $ myaddfile f
+         SymLink     -> do putInfo $ "Sorry, file " ++ f ++ " is a symbolic link, which is unsupported by darcs."
+                           return add_failure
+         NonExistent -> do putInfo $ "File "++ f ++" does not exist!"
+                           return add_failure
+      where already_has = if gotAllowCaseOnly
+                          then slurp_has f cur
+                          else slurp_has_anycase f cur
+            add_failure = (cur, Nothing, Nothing)
+            trypatch p =
                 case apply_to_slurpy p cur of
                 Nothing -> do putInfo $ msg_skipping msgs ++ " '" ++ f ++ "' ... " ++ parent_error
                               return (cur, Nothing, Nothing)
hunk ./src/Darcs/Commands/Add.lhs 209
                           then addfile (d++"-"++date) :>:
                                move (d++"-"++date) d :>: NilFL
                           else addfile d :>: NilFL
-
   putVerbose = if Verbose `elem` opts || DryRun `elem` opts
                then putStrLn
                else \_ -> return ()
hunk ./src/Darcs/Commands/Add.lhs 216
   gotFancyMoveAdd = FancyMoveAdd `elem` opts
   gotAllowCaseOnly = AllowCaseOnly `elem` opts
 
+data FileType = Directory | File | SymLink | NonExistent
+
+getFileType :: FilePath -> IO FileType
+getFileType f =
+ do isDir <- doesDirectoryReallyExist f
+    if isDir
+       then return Directory else do
+    isFile <- doesFileReallyExist f
+    if isFile
+       then return File else do
+    isLink <- isFileReallySymlink f
+    if isLink
+       then return SymLink
+       else return NonExistent
+
 data AddMessages =
     AddMessages
     { msg_skipping  :: String

Context:

[fix  bug I introduced into issue1039 test.
David Roundy <[EMAIL PROTECTED]>**20080921213043
 Ignore-this: 5b3c6476abae6bb050be014555d05bbe
] 
[Fix hang after a user input error (for example, EOF).
Judah Jacobson <[EMAIL PROTECTED]>**20080918163017] 
[replace consRLSealed with a more  general mapFlipped.
David Roundy <[EMAIL PROTECTED]>**20080921185241
 Ignore-this: c28f73f165254582cba6a14ba6ce93
] 
[make issue1039 fix allow small dissimilar  repositories.
David Roundy <[EMAIL PROTECTED]>**20080921184515
 Ignore-this: 918a09df18ef48c649c1bfaa866d6176
] 
[revert refactor that breaks type witnesses.
David Roundy <[EMAIL PROTECTED]>**20080921182331
 Ignore-this: dd692cffc1a238d6726448bacfe9cacc
] 
[Add '--ignore-unrelated-repos' option to disable unrelated repositories check.
Dmitry Kurochkin <[EMAIL PROTECTED]>**20080919152631] 
[Resolve issue1039: detect seemingly unrelated repositories when doing push, pull and send.
Dmitry Kurochkin <[EMAIL PROTECTED]>**20080919144553] 
[Refactor in pull_cmd.
Dmitry Kurochkin <[EMAIL PROTECTED]>**20080919135349
 Ignore-this: e26a489a7a53aeaba544ae5ad0006700
] 
[Test for issue1039.
Dmitry Kurochkin <[EMAIL PROTECTED]>**20080919153011] 
[manual: add an example of record --pipe prompts similar to tag --pipe docs
Simon Michael <[EMAIL PROTECTED]>**20080918205353] 
[user manual corrections regarding what record and tag --pipe prompt for
Simon Michael <[EMAIL PROTECTED]>**20080918204500] 
[clarify the short help for --pipe
Simon Michael <[EMAIL PROTECTED]>**20080918193717] 
[Use gmakeisms for prettier output.
Trent W. Buck <[EMAIL PROTECTED]>**20080919071358] 
[Spaces in Darcs.Arguments.
Dmitry Kurochkin <[EMAIL PROTECTED]>**20080919150440] 
[Spaces in Darcs.Commands.Send.
Dmitry Kurochkin <[EMAIL PROTECTED]>**20080919150139] 
[Spaces in Darcs.Commands.Pull.
Dmitry Kurochkin <[EMAIL PROTECTED]>**20080919145812] 
[Spaces in Darcs.Commands.Push.
Dmitry Kurochkin <[EMAIL PROTECTED]>**20080919145553] 
[Print "We have the following patches to send:" only when we really have somthing to send.
Dmitry Kurochkin <[EMAIL PROTECTED]>**20080919114229] 
[fix changes.pl test (translating to bash)
David Roundy <[EMAIL PROTECTED]>**20080917182432
 Ignore-this: 5f8bc7e1f9eadc073402a935142281c4
 This test made assumptions such as that darcs wouldn't ever add a long
 comment to its internal representation of changes, which are now
 broken.
] 
[hokey fix to allow unit tests to generate random input.
David Roundy <[EMAIL PROTECTED]>**20080917170913
 Ignore-this: 31e847e82eef741f4c6cc857fd79a245
 A nicer fix would be to move namepatch and patchinfo into some sort of
 random-number monad rather than leaving them in IO and using
 unsafePerformIO in the example-generation scripts.
] 
[resolve issue27: add junk to patch identifiers.
David Roundy <[EMAIL PROTECTED]>**20080917154657
 Ignore-this: b91ab6f6e05e0fda25488fa51653b741
] 
[TAG 2.0.3pre1
Eric Kow <[EMAIL PROTECTED]>**20080918023645] 
Patch bundle hash:
ef109fa600cd901819e08dbf7c3b52edcb1f0dfc
_______________________________________________
darcs-users mailing list
[email protected]
http://lists.osuosl.org/mailman/listinfo/darcs-users

Reply via email to