[darcs-users] darcs patch: Resolve issue1455: implement "darcs help... (and 4 more)

Eric Kow kowey at darcs.net
Wed May 13 02:52:29 UTC 2009


On Wed, May 13, 2009 at 12:21:46 +1000, Trent W.Buck wrote:
> Stylistically this is also a bit of a bodge (for example,
> configuring_darcs.tex puts the environment variables into three
> subsections, and I'd like to do this in the manpage, too).  Similarly,
> bloating out Darcs.Commands.Help feels pretty ugly.  I'd like to get
> the basic idea published (and maybe even applied) and worry about
> niceties later, because experience has shown that if I "sit on" stuff
> for too long, I end up with nightmarish merging problems.

I'm willing to be less conservative on things like these, which don't
break darcs.  I've had a quick glance and it seems good.  Applied,
thanks!
 
> Sat May  9 17:25:46 EST 2009  Trent W. Buck <trentbuck at gmail.com>
>   * Resolve issue1455: implement "darcs help environment".
> 
> Sat May  9 17:56:11 EST 2009  Trent W. Buck <trentbuck at gmail.com>
>   * Move Darcs.Manpage into Darcs.Commands.Help.
> 
>   To add an ENVIRONMENT section to the manpage, environmentHelp needs to
>   be visible to manpageLines.  But manpageLines needs to be visible to
>   the help command in Darcs.Commands.Help!  The simplest way for me to
>   break this impending cyclic import is to just move the few definitions
>   in Manpage into Help.
> 
> Sat May  9 18:06:41 EST 2009  Trent W. Buck <trentbuck at gmail.com>
>   * Add ENVIRONMENT section to manpage.
>   Look how easy it is to include the same information in the manpage and
>   the interactive help!  Hooray!
> 
> Mon May 11 11:29:41 EST 2009  Trent W. Buck <trentbuck at gmail.com>
>   * Migrate environment variable documentation.
> 
> Wed May 13 11:24:50 EST 2009  Trent W. Buck <trentbuck at gmail.com>
>   * Remove stale import.

Resolve issue1455: implement "darcs help environment".
------------------------------------------------------
> Trent W. Buck <trentbuck at gmail.com>**20090509072546
>  Ignore-this: 4db59cb774cfc06af64c0d7095b8923b
> ] hunk ./src/Darcs/Commands/Help.lhs 68
>  help_cmd :: [DarcsFlag] -> [String] -> IO ()
>  help_cmd _ ["manpage"] = putStr manpage
>  help_cmd _ ["patterns"] = viewDoc $ text $ helpOnMatchers
> +help_cmd _ ["environment"] = viewDoc $ text $ helpOnEnvironment
>  help_cmd _ [] = viewDoc $ text $ usage command_control_list
>  
>  help_cmd _ (cmd:args) =
> hunk ./src/Darcs/Commands/Help.lhs 105
>  command_control_list :: [CommandControl] 
>  command_control_list =
>    Command_data help : TheCommands.command_control_list
> -\end{code}
>  
> hunk ./src/Darcs/Commands/Help.lhs 106
> +-- | Help on each environment variable in which Darcs is interested.
> +environmentHelp :: [([String], [String])]
> +environmentHelp = [
> + (["DARCS_EMAIL", "EMAIL"],
> +  ["Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do",
> +   "eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut",
> +   "enim ad minim veniam, quis nostrud exercitation ullamco laboris",
> +   "nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in",
> +   "reprehenderit in voluptate velit esse cillum dolore eu fugiat",
> +   "nulla pariatur. Excepteur sint occaecat cupidatat non proident,",
> +   "sunt in culpa qui officia deserunt mollit anim id est laborum."]),
> + (["DARCS_DONT_ESCAPE_ANYTHING"],
> +  ["Ladqy ubegy paxad euf myqf, oazeqofqfgd mpubueuouzs qxuf, eqp pa",
> +   "qugeyap fqybad uzoupupgzf gf xmnadq qf paxadq ymszm mxucgm. Uf",
> +   "qzuy mp yuzuy hqzumy, cgue zaefdgp qjqdoufmfuaz gxxmyoa xmnadue",
> +   "zueu gf mxucgub qj qm oayyapa oazeqcgmf. Dgue mgfq udgdq paxad uz",
> +   "dqbdqtqzpqduf uz haxgbfmfq hqxuf qeeq ouxxgy paxadq qg rgsumf",
> +   "zgxxm bmdumfgd. Ejoqbfqgd euzf aoomqomf ogbupmfmf zaz bdaupqzf,",
> +   "egzf uz ogxbm cgu arruoum pqeqdgzf yaxxuf mzuy up qef xmnadgy."])]
> +
> +-- | The rendered form of the data in 'environment_help'.
> +helpOnEnvironment :: String
> +helpOnEnvironment =
> +    "Environment Variables\n" ++
> +    "=====================\n\n" ++
> +    unlines [unwords ks ++ ":\n" ++
> +                     (unlines $ map ("  " ++) ds)
> +                     | (ks, ds) <- environmentHelp]
> +
> +\end{code}

Move Darcs.Manpage into Darcs.Commands.Help.
--------------------------------------------
> Trent W. Buck <trentbuck at gmail.com>**20090509075611
>  Ignore-this: e26e259ce02062eb66e40a6e9431b7cc
>  
>  To add an ENVIRONMENT section to the manpage, environmentHelp needs to
>  be visible to manpageLines.  But manpageLines needs to be visible to
>  the help command in Darcs.Commands.Help!  The simplest way for me to
>  break this impending cyclic import is to just move the few definitions
>  in Manpage into Help.
> ] hunk ./darcs.cabal 215
>                      Darcs.IO
>                      Darcs.Lock
>                      Darcs.Match
> -                    Darcs.Manpage
>                      Darcs.Ordered
>                      Darcs.Patch
>                      Darcs.Patch.Apply
> hunk ./src/Darcs/Commands/Help.lhs 22
>  \label{help}
>  \darcsCommand{help}
>  \begin{code}
> -module Darcs.Commands.Help ( help_cmd, command_control_list, print_version,
> -                             list_available_commands
> -                           ) where
> -import System.Exit ( ExitCode(..), exitWith )
> +module Darcs.Commands.Help (
> + help_cmd,
> + command_control_list,
> + print_version,
> + list_available_commands ) where
>  
> hunk ./src/Darcs/Commands/Help.lhs 28
> -import ThisVersion ( darcs_version )
> -import Darcs.Commands ( CommandControl(Command_data), DarcsCommand(..),
> -                        disambiguate_commands, CommandArgs(..),
> -                        get_command_help, extract_commands,
> -                       nodefaults, 
> -                       usage )
>  import Darcs.Arguments ( DarcsFlag(..) )
> hunk ./src/Darcs/Commands/Help.lhs 29
> +import Darcs.Commands (
> + CommandArgs(..), CommandControl(..), DarcsCommand(..),
> + disambiguate_commands, extract_commands, get_command_help, nodefaults, usage )
>  import Darcs.External ( viewDoc )
> hunk ./src/Darcs/Commands/Help.lhs 33
> -import Darcs.Manpage ( manpage )
>  import Darcs.Patch.Match ( helpOnMatchers )
> hunk ./src/Darcs/Commands/Help.lhs 34
> +import Darcs.Repository.Prefs (binaries_file_help)
>  import Darcs.Utils ( withCurrentDirectory )
> hunk ./src/Darcs/Commands/Help.lhs 36
> +import Data.Char ( isAlphaNum, toLower )
> +import Data.List (groupBy)
>  import Printer ( text )
> hunk ./src/Darcs/Commands/Help.lhs 39
> +import System.Exit ( ExitCode(..), exitWith )
> +import ThisVersion ( darcs_version )
>  import Workaround ( getCurrentDirectory )
>  
>  import qualified Darcs.TheCommands as TheCommands
> hunk ./src/Darcs/Commands/Help.lhs 68
>                       command_basic_options = []}
>  
>  help_cmd :: [DarcsFlag] -> [String] -> IO ()
> -help_cmd _ ["manpage"] = putStr manpage
> +help_cmd _ ["manpage"] = putStr $ unlines manpageLines
>  help_cmd _ ["patterns"] = viewDoc $ text $ helpOnMatchers
>  help_cmd _ ["environment"] = viewDoc $ text $ helpOnEnvironment
>  help_cmd _ [] = viewDoc $ text $ usage command_control_list
> hunk ./src/Darcs/Commands/Help.lhs 137
>                       (unlines $ map ("  " ++) ds)
>                       | (ks, ds) <- environmentHelp]
>  
> +-- | This module is responsible for emitting a darcs "man-page", a
> +-- reference document used widely on Unix-like systems.  Manpages are
> +-- primarily used as a quick reference, or "memory jogger", so the
> +-- output should be terser than the user manual.
> +--
> +-- Before modifying the output, please be sure to read the man(7) and
> +-- man-pages(7) manpages, as these respectively describe the relevant
> +-- syntax and conventions.
> +
> +-- | The lines of the manpage to be printed.
> +manpageLines :: [String]
> +manpageLines = [
> + ".TH DARCS 1 \"" ++ darcs_version ++ "\"",
> + ".SH NAME",
> + "darcs \\- an advanced revision control system",
> + ".SH SYNOPSIS",
> + ".B darcs", ".I command", ".RI < arguments |[ options ]>...",
> + "",
> + "Where the", ".I commands", "and their respective", ".I arguments", "are",
> + "",
> + unlines synopsis,
> + ".SH DESCRIPTION",
> + -- FIXME: this is copy-and-pasted from darcs.cabal, so
> + -- it'll get out of date as people forget to maintain
> + -- both in sync.
> + "Darcs is a free, open source revision control",
> + "system. It is:",
> + ".TP 3", "\\(bu",
> + "Distributed: Every user has access to the full",
> + "command set, removing boundaries between server and",
> + "client or committer and non-committers.",
> + ".TP", "\\(bu",
> + "Interactive: Darcs is easy to learn and efficient to",
> + "use because it asks you questions in response to",
> + "simple commands, giving you choices in your work",
> + "flow. You can choose to record one change in a file,",
> + "while ignoring another. As you update from upstream,",
> + "you can review each patch name, even the full `diff'",
> + "for interesting patches.",
> + ".TP", "\\(bu",
> + "Smart: Originally developed by physicist David",
> + "Roundy, darcs is based on a unique algebra of",
> + "patches.",
> + "This smartness lets you respond to changing demands",
> + "in ways that would otherwise not be possible. Learn",
> + "more about spontaneous branches with darcs.",
> + ".SH OPTIONS",
> + "Different options are accepted by different Darcs commands.",
> + "Each command's most important options are listed in the",
> + ".B COMMANDS",
> + "section.  For a full list of all options accepted by",
> + "a particular command, run `darcs", ".I command", "--help'.",
> + ".SS " ++ helpOnMatchers, -- FIXME: this is a kludge.
> + ".SH COMMANDS",
> + unlines commands,
> + ".SH FILES",
> + ".SS \"_darcs/prefs/binaries\"",
> + unlines binaries_file_help,
> + ".SH BUGS",
> + "At http://bugs.darcs.net/ you can find a list of known",
> + "bugs in Darcs.  Unknown bugs can be reported at that",
> + "site (after creating an account) or by emailing the",
> + "report to bugs at darcs.net.",
> + -- ".SH EXAMPLE",
> + -- FIXME:
> + -- new project: init, rec -la;
> + -- track upstream project: get, pull -a;
> + -- contribute to project: add, rec, push/send.
> + ".SH SEE ALSO",
> + "A user manual is included with Darcs, in PDF and HTML",
> + "form.  It can also be found at http://darcs.net/manual/."]
> +    where
> +      -- | A synopsis line for each command.  Uses 'foldl' because it is
> +      -- necessary to avoid blank lines from Hidden_commands, as groff
> +      -- translates them into annoying vertical padding (unlike TeX).
> +      synopsis :: [String]
> +      synopsis = foldl iter [] command_control_list
> +          where iter :: [String] -> CommandControl -> [String]
> +                iter acc (Group_name _) = acc
> +                iter acc (Hidden_command _) = acc
> +                iter acc (Command_data c at SuperCommand {}) =
> +                    acc ++ (concatMap
> +                            (render ((command_name c) ++ " "))
> +                            (extract_commands (command_sub_commands c)))
> +                iter acc (Command_data c) = acc ++ (render "" c)
> +                render :: String -> DarcsCommand -> [String]
> +                render prefix c =
> +                    [".B darcs " ++ prefix ++ command_name c] ++
> +                    (map mangle_args $ command_extra_arg_help c) ++
> +                    -- In the output, we want each command to be on its own
> +                    -- line, but we don't want blank lines between them.
> +                    -- AFAICT this can only be achieved with the .br
> +                    -- directive, which is probably a GNUism.
> +                    [".br"]
> +
> +      -- | As 'synopsis', but make each group a subsection (.SS), and
> +      -- include the help text for each command.
> +      commands :: [String]
> +      commands = foldl iter [] command_control_list
> +          where iter :: [String] -> CommandControl -> [String]
> +                iter acc (Group_name x) = acc ++ [".SS \"" ++ x ++ "\""]
> +                iter acc (Hidden_command _) = acc
> +                iter acc (Command_data c at SuperCommand {}) =
> +                    acc ++ (concatMap
> +                            (render ((command_name c) ++ " "))
> +                            (extract_commands (command_sub_commands c)))
> +                iter acc (Command_data c) = acc ++ (render "" c)
> +                render :: String -> DarcsCommand -> [String]
> +                render prefix c =
> +                    [".B darcs " ++ prefix ++ command_name c] ++
> +                    (map mangle_args $ command_extra_arg_help c) ++
> +                    [".RS 4", command_help c, ".RE"]
> +
> +      -- | Now I'm showing off: mangle the extra arguments of Darcs commands
> +      -- so as to use the ideal format for manpages, italic words and roman
> +      -- punctuation.
> +      mangle_args :: String -> String
> +      mangle_args s =
> +          ".RI " ++ (unwords $ map show (groupBy cmp $ map toLower $ gank s))
> +              where cmp x y = not $ xor (isAlphaNum x) (isAlphaNum y)
> +                    xor x y = (x && not y) || (y && not x)
> +                    gank (' ':'o':'r':' ':xs) = '|' : (gank xs)
> +                    gank (x:xs) = x : (gank xs)
> +                    gank [] = []
> +
>  \end{code}
> hunk ./src/Darcs/Manpage.hs 1
> --- Copyright (C) 2003 David Roundy
> --- Copyright (C) 2008 Trent W. Buck
> ---
> --- This program is free software; you can redistribute it and/or modify
> --- it under the terms of the GNU General Public License as published by
> --- the Free Software Foundation; either version 2, or (at your option)
> --- any later version.
> ---
> --- This program is distributed in the hope that it will be useful,
> --- but WITHOUT ANY WARRANTY; without even the implied warranty of
> --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> --- GNU General Public License for more details.
> ---
> --- You should have received a copy of the GNU General Public License
> --- along with this program; if not, write to the Free Software Foundation,
> --- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
> -
> --- | This module is responsible for emitting a darcs "man-page", a
> --- reference document used widely on Unix-like systems.  Manpages are
> --- primarily used as a quick reference, or "memory jogger", so the
> --- output should be terser than the user manual.
> ---
> --- Before modifying the output, please be sure to read the man(7) and
> --- man-pages(7) manpages, as these respectively describe the relevant
> --- syntax and conventions.
> -module Darcs.Manpage (manpage) where
> -
> -import Darcs.Commands
> -import Darcs.Patch.Match (helpOnMatchers)
> -import Darcs.TheCommands
> -import Data.Char (toLower, isAlphaNum)
> -import Data.List (groupBy)
> -import ThisVersion (darcs_version)
> -import Darcs.Repository.Prefs (binaries_file_help)
> -
> -manpage :: String
> -manpage = unlines ls
> -
> --- | The lines of the manpage to be printed.
> -ls :: [String]
> -ls = [".TH DARCS 1 \"" ++ darcs_version ++ "\"",
> -      ".SH NAME",
> -      "darcs \\- an advanced revision control system",
> -      ".SH SYNOPSIS",
> -      ".B darcs", ".I command", ".RI < arguments |[ options ]>...",
> -      "",
> -      "Where the", ".I commands", "and their respective", ".I arguments", "are",
> -      ""] ++
> -     synopsis ++
> -     [".SH DESCRIPTION",
> -      -- FIXME: this is copy-and-pasted from darcs.cabal, so
> -      -- it'll get out of date as people forget to maintain
> -      -- both in sync.
> -      "Darcs is a free, open source revision control",
> -      "system. It is:",
> -      ".TP 3", "\\(bu",
> -      "Distributed: Every user has access to the full",
> -      "command set, removing boundaries between server and",
> -      "client or committer and non-committers.",
> -      ".TP", "\\(bu",
> -      "Interactive: Darcs is easy to learn and efficient to",
> -      "use because it asks you questions in response to",
> -      "simple commands, giving you choices in your work",
> -      "flow. You can choose to record one change in a file,",
> -      "while ignoring another. As you update from upstream,",
> -      "you can review each patch name, even the full `diff'",
> -      "for interesting patches.",
> -      ".TP", "\\(bu",
> -      "Smart: Originally developed by physicist David",
> -      "Roundy, darcs is based on a unique algebra of",
> -      "patches.",
> -      "This smartness lets you respond to changing demands",
> -      "in ways that would otherwise not be possible. Learn",
> -      "more about spontaneous branches with darcs.",
> -      ".SH OPTIONS",
> -      "Different options are accepted by different Darcs commands.",
> -      "Each command's most important options are listed in the",
> -      ".B COMMANDS",
> -      "section.  For a full list of all options accepted by",
> -      "a particular command, run `darcs", ".I command", "--help'.",
> -      ".SS " ++ helpOnMatchers, -- FIXME: this is a kludge.
> -      ".SH COMMANDS"] ++
> -     commands ++
> -     [".SH FILES",
> -      ".SS \"_darcs/prefs/binaries\""] ++
> -     binaries_file_help ++
> -     [".SH BUGS",
> -      "At http://bugs.darcs.net/ you can find a list of known",
> -      "bugs in Darcs.  Unknown bugs can be reported at that",
> -      "site (after creating an account) or by emailing the",
> -      "report to bugs at darcs.net.",
> -      -- ".SH EXAMPLE",
> -      -- FIXME:
> -      -- new project: init, rec -la;
> -      -- track upstream project: get, pull -a;
> -      -- contribute to project: add, rec, push/send.
> -      ".SH SEE ALSO",
> -      "A user manual is included with Darcs, in PDF and HTML",
> -      "form.  It can also be found at http://darcs.net/manual/."]
> -
> --- | A synopsis line for each command.  Uses 'foldl' because it is
> --- necessary to avoid blank lines from Hidden_commands, as groff
> --- translates them into annoying vertical padding (unlike TeX).
> -synopsis :: [String]
> -synopsis = foldl iter [] command_control_list
> -    where iter :: [String] -> CommandControl -> [String]
> -          iter acc (Group_name _) = acc
> -          iter acc (Hidden_command _) = acc
> -          iter acc (Command_data c at SuperCommand {}) =
> -              acc ++ (concatMap
> -                      (render ((command_name c) ++ " "))
> -                      (extract_commands (command_sub_commands c)))
> -          iter acc (Command_data c) = acc ++ (render "" c)
> -          render :: String -> DarcsCommand -> [String]
> -          render prefix c =
> -              [".B darcs " ++ prefix ++ command_name c] ++
> -              (map mangle_args $ command_extra_arg_help c) ++
> -              -- In the output, we want each command to be on its own
> -              -- line, but we don't want blank lines between them.
> -              -- AFAICT this can only be achieved with the .br
> -              -- directive, which is probably a GNUism.
> -              [".br"]
> -
> --- | As 'synopsis', but make each group a subsection (.SS), and
> --- include the help text for each command.
> -commands :: [String]
> -commands = foldl iter [] command_control_list
> -    where iter :: [String] -> CommandControl -> [String]
> -          iter acc (Group_name x) = acc ++ [".SS \"" ++ x ++ "\""]
> -          iter acc (Hidden_command _) = acc
> -          iter acc (Command_data c at SuperCommand {}) =
> -              acc ++ (concatMap
> -                      (render ((command_name c) ++ " "))
> -                      (extract_commands (command_sub_commands c)))
> -          iter acc (Command_data c) = acc ++ (render "" c)
> -          render :: String -> DarcsCommand -> [String]
> -          render prefix c =
> -              [".B darcs " ++ prefix ++ command_name c] ++
> -              (map mangle_args $ command_extra_arg_help c) ++
> -              [".RS 4", command_help c, ".RE"]
> -
> --- | Now I'm showing off: mangle the extra arguments of Darcs commands
> --- so as to use the ideal format for manpages, italic words and roman
> --- punctuation.
> -mangle_args :: String -> String
> -mangle_args s =
> -    ".RI " ++ (unwords $ map show (groupBy cmp $ map toLower $ gank s))
> -        where cmp x y = not $ xor (isAlphaNum x) (isAlphaNum y)
> -              xor x y = (x && not y) || (y && not x)
> -              gank (' ':'o':'r':' ':xs) = '|' : (gank xs)
> -              gank (x:xs) = x : (gank xs)
> -              gank [] = []
> rmfile ./src/Darcs/Manpage.hs

Add ENVIRONMENT section to manpage.
-----------------------------------
> Trent W. Buck <trentbuck at gmail.com>**20090509080641
>  Ignore-this: e96acb4fd2f522ee4acd983febec4091
>  Look how easy it is to include the same information in the manpage and
>  the interactive help!  Hooray!
> ] hunk ./src/Darcs/Commands/Help.lhs 192
>   ".SS " ++ helpOnMatchers, -- FIXME: this is a kludge.
>   ".SH COMMANDS",
>   unlines commands,
> + unlines environment,
>   ".SH FILES",
>   ".SS \"_darcs/prefs/binaries\"",
>   unlines binaries_file_help,
> hunk ./src/Darcs/Commands/Help.lhs 263
>                      gank (x:xs) = x : (gank xs)
>                      gank [] = []
>  
> +      environment :: [String]
> +      environment = ".SH ENVIRONMENT" : concat
> +                    [(".SS \"" ++ unwords ks ++ "\"") : ds
> +                     | (ks, ds) <- environmentHelp]
> +
>  \end{code}

Migrate environment variable documentation.
-------------------------------------------
> Trent W. Buck <trentbuck at gmail.com>**20090511012941
>  Ignore-this: 7fc6c28b339a7534f12b755928858a
> ] hunk ./src/Darcs/Commands/Help.lhs 33
>   CommandArgs(..), CommandControl(..), DarcsCommand(..),
>   disambiguate_commands, extract_commands, get_command_help, nodefaults, usage )
>  import Darcs.External ( viewDoc )
> +import Darcs.Lock ( environmentHelpTmpdir, environmentHelpKeepTmpdir )
>  import Darcs.Patch.Match ( helpOnMatchers )
> hunk ./src/Darcs/Commands/Help.lhs 35
> -import Darcs.Repository.Prefs (binaries_file_help)
> -import Darcs.Utils ( withCurrentDirectory )
> +import Darcs.Repository.Prefs ( binaries_file_help, environmentHelpHome )
> +import Darcs.Utils ( withCurrentDirectory, environmentHelpPager )
>  import Data.Char ( isAlphaNum, toLower )
>  import Data.List (groupBy)
>  import Printer ( text )
> hunk ./src/Darcs/Commands/Help.lhs 43
>  import System.Exit ( ExitCode(..), exitWith )
>  import ThisVersion ( darcs_version )
>  import Workaround ( getCurrentDirectory )
> -
>  import qualified Darcs.TheCommands as TheCommands
>  
>  help_description :: String
> hunk ./src/Darcs/Commands/Help.lhs 110
>  
>  -- | Help on each environment variable in which Darcs is interested.
>  environmentHelp :: [([String], [String])]
> -environmentHelp = [
> - (["DARCS_EMAIL", "EMAIL"],
> -  ["Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do",
> -   "eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut",
> -   "enim ad minim veniam, quis nostrud exercitation ullamco laboris",
> -   "nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in",
> -   "reprehenderit in voluptate velit esse cillum dolore eu fugiat",
> -   "nulla pariatur. Excepteur sint occaecat cupidatat non proident,",
> -   "sunt in culpa qui officia deserunt mollit anim id est laborum."]),
> - (["DARCS_DONT_ESCAPE_ANYTHING"],
> -  ["Ladqy ubegy paxad euf myqf, oazeqofqfgd mpubueuouzs qxuf, eqp pa",
> -   "qugeyap fqybad uzoupupgzf gf xmnadq qf paxadq ymszm mxucgm. Uf",
> -   "qzuy mp yuzuy hqzumy, cgue zaefdgp qjqdoufmfuaz gxxmyoa xmnadue",
> -   "zueu gf mxucgub qj qm oayyapa oazeqcgmf. Dgue mgfq udgdq paxad uz",
> -   "dqbdqtqzpqduf uz haxgbfmfq hqxuf qeeq ouxxgy paxadq qg rgsumf",
> -   "zgxxm bmdumfgd. Ejoqbfqgd euzf aoomqomf ogbupmfmf zaz bdaupqzf,",
> -   "egzf uz ogxbm cgu arruoum pqeqdgzf yaxxuf mzuy up qef xmnadgy."])]
> +environmentHelp = [environmentHelpHome,
> +                   environmentHelpPager,
> +                   environmentHelpTmpdir,
> +                   environmentHelpKeepTmpdir]
>  
>  -- | The rendered form of the data in 'environment_help'.
>  helpOnEnvironment :: String
> hunk ./src/Darcs/Lock.hs 31
>                rm_recursive, removeFileMayNotExist,
>                canonFilename, maybeRelink,
>                world_readable_temp, tempdir_loc,
> +              environmentHelpTmpdir, environmentHelpKeepTmpdir
>              ) where
>  
>  import Prelude hiding ( catch )
> hunk ./src/Darcs/Lock.hs 171
>                >>= return . fromJust
>      where chkdir Nothing = return Nothing
>            chkdir (Just d) = doesDirectoryExist d >>= return . \e -> if e then Just (d++"/") else Nothing
> -                                                         
> +
> +environmentHelpTmpdir :: ([String], [String])
> +environmentHelpTmpdir = (["DARCS_TMPDIR", "TMPDIR"], [
> + "Darcs often creates temporary directories.  For example, the `darcs",
> + "diff' command creates two for the working trees to be diffed.  By",
> + "default temporary directories are created in /tmp, or if that doesn't",
> + "exist, in _darcs (within the current repo).  This can be overridden by",
> + "specifying some other directory in the file _darcs/prefs/tmpdir or the",
> + "environment variable $DARCS_TMPDIR or $TMPDIR."])
> +
>  getCurrentDirectorySansDarcs :: IO (Maybe FilePath)
>  getCurrentDirectorySansDarcs = do
>    c <- getCurrentDirectory
> hunk ./src/Darcs/Lock.hs 218
>                                _ -> throwIO e)
>            keep_tmpdir = isJust `fmap` maybeGetEnv "DARCS_KEEP_TMPDIR"
>  
> +environmentHelpKeepTmpdir :: ([String], [String])
> +environmentHelpKeepTmpdir = (["DARCS_KEEP_TMPDIR"],[
> + "If the environment variable DARCS_KEEP_TMPDIR is defined, darcs will",
> + "not remove the temporary directories it creates.  This is intended",
> + "primarily for debugging Darcs itself, but it can also be useful, for",
> + "example, to determine why your test preference (see `darcs setpref')",
> + "is failing when you run `darcs record', but working when run manually."])
> +
>  -- |'withPermDir' is like 'withTempDir', except that it doesn't
>  -- delete the directory afterwards.
>  withPermDir :: String -> (AbsolutePath -> IO a) -> IO a
> hunk ./src/Darcs/Repository/Prefs.lhs 26
>  #include "gadts.h"
>  
>  module Darcs.Repository.Prefs ( add_to_preflist, get_preflist, set_preflist,
> -                   get_global,
> +                   get_global, environmentHelpHome,
>                     defaultrepo, set_defaultrepo,
>                     get_prefval, set_prefval, change_prefval,
>                     def_prefval,
> hunk ./src/Darcs/Repository/Prefs.lhs 252
>   where userDir = (getAppUserDataDirectory "darcs" >>= return.Just)
>                     `catchall` (return Nothing)
>  
> +environmentHelpHome :: ([String], [String])
> +environmentHelpHome = (["HOME", "APPDATA"], [
> + "Per-user preferences are set in $HOME/.darcs (on Unix) or",
> + "%APPDATA%/darcs (on Windows).  This is also the default location of",
> + "the cache."])
> +
>  get_global :: String -> IO [String]
>  get_global f = do
>    dir <- global_prefs_dir
> hunk ./src/Darcs/Utils.hs 14
>                      maybeGetEnv, firstNotBlank, firstJustM, firstJustIO,
>                      isUnsupportedOperationError, isHardwareFaultError,
>                      get_viewer, edit_file, promptYorn, promptCharFancy,
> +                    environmentHelpPager,
>                      formatPath ) where
>  
>  import Prelude hiding ( catch )
> hunk ./src/Darcs/Utils.hs 207
>  get_viewer = getEnv "DARCS_PAGER" `catchall`
>               getEnv "PAGER" `catchall` return "less"
>  
> +environmentHelpPager :: ([String], [String])
> +environmentHelpPager = (["DARCS_PAGER", "PAGER"],[
> + "Darcs will sometimes invoke a pager if it deems output to be too long",
> + "to fit onscreen.  Darcs will use the pager specified by $DARCS_PAGER",
> + "or $PAGER.  If neither are set, `less' will be used."])
> +
>  promptYorn :: [Char] -> IO Char
>  promptYorn p = promptCharFancy p "yn" Nothing []
>  
> hunk ./src/configuring_darcs.tex 93
>  are defined, darcs tries \verb!vi!, \verb!emacs!, \verb!emacs -nw! and
>  \verb!nano! in that order.
>  
> -\paragraph{DARCS\_PAGER}
> -\label{env:DARCS_PAGER}
> -When using a pager for displaying a patch, darcs uses the contents of
> -DARCS\_PAGER if it is defined.  If not, it tries the contents of PAGER
> -and then \verb!less!.
> -
> -\paragraph{DARCS\_TMPDIR}
> -\label{env:DARCS_TMPDIR}
> -If the environment variable DARCS\_TMPDIR is defined, darcs will use that
> -directory for its temporaries.  Otherwise it will use TMPDIR, if that is
> -defined, and if not that then \verb!/tmp! and if \verb!/tmp! doesn't exist,
> -it'll put the temporaries in \verb!_darcs!.
> -
> -This is very helpful, for example, when recording with a test suite that
> -uses MPI, in which case using \verb!/tmp! to hold the test copy is no good,
> -as \verb!/tmp! isn't shared over NFS and thus the \verb!mpirun! call will
> -fail, since the binary isn't present on the compute nodes.
> -
> -\paragraph{DARCS\_KEEP\_TMPDIR}
> -\label{env:DARCS_KEEP_TMPDIR}
> -If the environment variable DARCS\_KEEP\_TMPDIR is defined, darcs will
> -not remove temprary directories.
> -
> -This can be useful for darcs debugging.
> -
> -\paragraph{HOME}
> -\label{env:HOME}
> -HOME is used to find the per-user prefs directory, which is located at
> -\verb!$HOME/.darcs!, on MS Windows~\ref{ms_win}.
> -
> -%$ this dollar is a comment to make my emacs leave math mode... (stupid
> -%  emacs)
> +\darcsEnv{DARCS_PAGER}
> +\darcsEnv{DARCS_TMPDIR}
> +\darcsEnv{DARCS_KEEP_TMPDIR}
> +\darcsEnv{HOME}
>  
>  \paragraph{TERM}
>  \label{env:TERM}

Remove stale import.
--------------------
> Trent W. Buck <trentbuck at gmail.com>**20090513012450
>  Ignore-this: 9e404c89dcefac780a29f4a5fa3184d7
> ] hunk ./src/preproc.hs 20
>  import System.Environment ( getArgs )
>  import System.Exit ( exitWith, ExitCode(..) )
>  import Text.Regex ( matchRegex, mkRegex )
> -import Data.Maybe ( isJust )
>  import Darcs.Commands ( DarcsCommand(SuperCommand,
>                          command_sub_commands, command_name,
>                          command_extra_arg_help, command_basic_options,
> 

-- 
Eric Kow <http://www.nltg.brighton.ac.uk/home/Eric.Kow>
PGP Key ID: 08AC04F9
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 194 bytes
Desc: not available
URL: <http://lists.osuosl.org/pipermail/darcs-users/attachments/20090512/ea0953ba/attachment-0001.pgp>


More information about the darcs-users mailing list