[prev in list] [next in list] [prev in thread] [next in thread] 

List:       darcs-devel
Subject:    [darcs-devel] [patch1052] Mark issue1105 as failing again (and 1 more)
From:       Florent Becker <bugs () darcs ! net>
Date:       2013-02-21 20:42:20
Message-ID: E1U8cxv-00009y-3r () tamarin ! plop ! org
[Download RAW message or body]

Florent Becker <florent.becker@ens-lyon.org> added the comment:

2 patches for repository http://darcs.net:

Thu Feb 21 14:58:41 CET 2013  Florent Becker <florent.becker@ens-lyon.org>
  * Mark issue1105 as failing again
  
  With changes anyNonExistentOption in defaults, darcs cha -a works, whereas it should not

Thu Feb 21 21:41:09 CET 2013  Florent Becker <florent.becker@ens-lyon.org>
  * Fix issue1105 even in the presence of command-line optinos

----------
title: Mark issue1105 as failing again -> Mark issue1105 as failing again (and 1 more)

__________________________________
Darcs bug tracker <bugs@darcs.net>
<http://bugs.darcs.net/patch1052>
__________________________________
["patch-preview.txt" (text/x-darcs-patch)]


[Mark issue1105 as failing again
Florent Becker <florent.becker@ens-lyon.org>**20130221135841
 Ignore-this: 96a98bd8d267ea81b48dae686d09f1f6
 
 With changes anyNonExistentOption in defaults, darcs cha -a works, whereas it should not
] move ./tests/issue1105.sh ./tests/failing-issue1105.sh
hunk ./tests/failing-issue1105.sh 31
 
 echo changes author me > _darcs/prefs/defaults
 not darcs changes
+echo changes author me > _darcs/prefs/defaults
+not darcs changes -a
 echo ALL author me > _darcs/prefs/defaults
 darcs changes
 echo ALL unknown > _darcs/prefs/defaults
[Fix issue1105 even in the presence of command-line optinos
Florent Becker <florent.becker@ens-lyon.org>**20130221204109
 Ignore-this: 1bc5362ca365250d4c3c2ef86ee45824
] move ./tests/failing-issue1105.sh ./tests/issue1105.sh
hunk ./src/Darcs/UI/ArgumentDefaults.hs 45
     options_for com_defs com_opts com_opts ++
     options_for all_defs com_opts all_opts
     where com_defs = filter (\ (c,_,_) -> c == com) defs
- -          all_defs = filter (\ (c,_,_) -> c == "ALL") defs
+          all_defs = [(com,f,d) |(c,f,d) <- defs, c == "ALL"]
           options_for d o ao = concatMap (findOption o ao already) d
           all_opts = concatMap get_opts commandControlList
           get_opts (CommandData c) = let (o1, o2) = commandAlloptions c
hunk ./src/Darcs/UI/ArgumentDefaults.hs 52
                                       in o1 ++ o2
           get_opts _                = []
 
+data FindFlag = NotFound
+              | Superseded
+              | Found DarcsFlag
+              deriving Eq
+
 findOption :: [DarcsOption] -> [DarcsOption] -> [DarcsFlag] -> (String,String,String) -> [DarcsFlag]
 findOption opts all_opts already (c, f, d) =
hunk ./src/Darcs/UI/ArgumentDefaults.hs 59
- -    if null $ mapMaybe choose_option all_opts
+    if all (== NotFound) $ map choose_option all_opts
     then error $ "Bad default option: command '"++c++"' has no option '"++f++"'."
hunk ./src/Darcs/UI/ArgumentDefaults.hs 61
- -    else concat $ mapMaybe choose_option opts
- -    where choose_atomic_option (DarcsNoArgOption _ fls o _)
+    else [f | Found f <- map choose_option opts]
+    where choose_atomic_option :: DarcsAtomicOption -> Maybe DarcsFlag
+          choose_atomic_option (DarcsNoArgOption _ fls o _)
               | f `elem` fls = if null d
hunk ./src/Darcs/UI/ArgumentDefaults.hs 65
- -                               then Just [o]
+                               then (Just o)
                                else error $ "Bad default option: '"++f
                                         ++"' takes no argument, but '"++d
                                         ++"' argument given."
hunk ./src/Darcs/UI/ArgumentDefaults.hs 74
                                then error $ "Bad default option: '"++f
                                         ++"' requires an argument, but no "
                                         ++"argument given."
- -                               else Just [o d]
+                               else (Just (o d))
           choose_atomic_option _ = Nothing
hunk ./src/Darcs/UI/ArgumentDefaults.hs 76
+
+          choose_option :: DarcsOption ->  FindFlag
           choose_option o
hunk ./src/Darcs/UI/ArgumentDefaults.hs 79
- -              | o `arein` already = Just []
- -              | otherwise = listToMaybe $ mapMaybe choose_atomic_option $ atomicOptions o
+              | o `arein` already =
+                case mapMaybe choose_atomic_option $ atomicOptions o of
+                  [] -> NotFound
+                  a:_ -> Superseded
+              | otherwise = case mapMaybe choose_atomic_option $ atomicOptions o of
+                  [] -> NotFound
+                  a:_ -> Found a
 
 defaultContent :: IO [String] -> IO [(String,String,String)]
 defaultContent = fmap (mapMaybe (doline . words))
hunk ./src/Darcs/UI/Arguments.hs 161
     , usePacks
     , amendUnrecord
     , optionsMarkdown
+    , optionListMarkdown
     , patchIndex
     ) where
 


["mark-issue1105-as-failing-again.dpatch" (application/x-darcs-patch)]
["unnamed" (application/octet-stream)]

_______________________________________________
darcs-devel mailing list
darcs-devel@darcs.net
http://lists.osuosl.org/mailman/listinfo/darcs-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic