New submission from Joachim Breitner <m...@joachim-breitner.de>: Hi,
1 patch for repository http://darcs.net/releases/branch-2.5: this is another patch that has on effect on the user interface of darcs, but makes the DarcsLib API more useful. Again, Iâd be grateful if this would make it into 2.5, or at least one of the point releases following 2.5. Thanks, Joachim PS: I took the liberty to import DarcsCommand(..) everywhere, even when before the field accessors were named explicitly. The (..)-variant was far more common, so this is more consistent. Thu Sep 16 20:06:43 CEST 2010 Joachim Breitner <m...@joachim-breitner.de> * Add commandProgramName field to DarcsCommand In order to make the command handling more generic, the name of the program (the executable) is now a field of DarcsCommand. It is used by the functions which generate the help output. ---------- files: add-commandprogramname-field-to-darcscommand.dpatch, unnamed messages: 12574 nosy: nomeata status: needs-screening title: Add commandProgramName field to DarcsCommand __________________________________ Darcs bug tracker <b...@darcs.net> <http://bugs.darcs.net/patch400> __________________________________
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 New patches: [Add commandProgramName field to DarcsCommand Joachim Breitner <m...@joachim-breitner.de>**20100916180643 Ignore-this: 1200c9b51be2aa638b486f0f339521fe In order to make the command handling more generic, the name of the program (the executable) is now a field of DarcsCommand. It is used by the functions which generate the help output. ] hunk ./src/Darcs/Commands.lhs 20 \begin{code} module Darcs.Commands ( CommandControl( CommandData, HiddenCommand, GroupName ), - - DarcsCommand( DarcsCommand, commandName, + DarcsCommand( DarcsCommand, commandProgramName, commandName, commandHelp, commandDescription, commandBasicOptions, commandAdvancedOptions, commandCommand, hunk ./src/Darcs/Commands.lhs 131 | GroupName String data DarcsCommand = - - DarcsCommand {commandName, commandHelp, commandDescription :: String, + DarcsCommand {commandProgramName, commandName, commandHelp, commandDescription :: String, commandExtraArgs :: Int, commandExtraArgHelp :: [String], commandCommand :: [DarcsFlag] -> [String] -> IO (), hunk ./src/Darcs/Commands.lhs 140 commandArgdefaults :: [DarcsFlag] -> AbsolutePath -> [String] -> IO [String], commandBasicOptions :: [DarcsOption], commandAdvancedOptions :: [DarcsOption]} - - | SuperCommand {commandName, commandHelp, commandDescription :: String, + | SuperCommand {commandProgramName, commandName, commandHelp, commandDescription :: String, commandPrereq :: [DarcsFlag] -> IO (Either String ()), commandSubCommands :: [CommandControl]} hunk ./src/Darcs/Commands.lhs 174 commandAlias :: String -> Maybe DarcsCommand -> DarcsCommand -> DarcsCommand commandAlias n msuper c = c { commandName = n - - , commandDescription = "Alias for `darcs " ++ cmdName ++ "'." - - , commandHelp = "The `darcs " ++ n ++ "' command is an alias for " ++ - - "`darcs " ++ cmdName ++ "'.\n" ++ + , commandDescription = "Alias for `" ++ commandProgramName c ++ " " ++ cmdName ++ "'." + , commandHelp = "The `" ++ commandProgramName c ++ " " ++ n ++ "' command is an alias for " ++ + "`" ++ commandProgramName c ++ " " ++ cmdName ++ "'.\n" ++ commandHelp c } where hunk ./src/Darcs/Commands.lhs 204 subusage :: DarcsCommand -> String subusage super = (usageInfo - - ("Usage: darcs "++commandName super++" SUBCOMMAND ... " ++ + ("Usage: " ++ commandProgramName super ++ " "++commandName super++" SUBCOMMAND ... " ++ "\n\n"++ commandDescription super++ "\n\nSubcommands:\n" ++ usageHelper (getSubcommands super) ++ "\nOptions:") (optionFromDarcsOption rootDirectory help)) hunk ./src/Darcs/Commands.lhs 231 getCommandMiniHelp :: Maybe DarcsCommand -> DarcsCommand -> String getCommandMiniHelp msuper cmd = getCommandHelpCore msuper cmd ++ - - "\n\nSee darcs help " + "\n\nSee " ++ commandProgramName cmd ++ " help " ++ (maybe "" (\c -> commandName c ++ " ") msuper) ++ commandName cmd ++ " for details." hunk ./src/Darcs/Commands.lhs 259 getCommandHelpCore :: Maybe DarcsCommand -> DarcsCommand -> String getCommandHelpCore msuper cmd = - - "Usage: darcs "++superName msuper++commandName cmd++ + "Usage: " ++ commandProgramName cmd ++ " "++superName msuper++commandName cmd++ " [OPTION]... " ++ unwords args_help ++ "\n"++ commandDescription cmd where args_help = case cmd of hunk ./src/Darcs/Commands.lhs 263 - - (DarcsCommand _ _ _ _ _ _ _ _ _ _ _) -> + (DarcsCommand {}) -> commandExtraArgHelp cmd _ -> [] hunk ./src/Darcs/Commands/Add.lhs 72 "Adding symbolic links (symlinks) is not supported.\n\n" add :: DarcsCommand - -add = DarcsCommand {commandName = "add", +add = DarcsCommand {commandProgramName = "darcs", + commandName = "add", commandHelp = addHelp ++ addHelp' ++ addHelp'', commandDescription = addDescription, commandExtraArgs = -1, hunk ./src/Darcs/Commands/AmendRecord.lhs 106 "On Windows use C:/Documents And Settings/user/Application Data/darcs/defaults\n" amendrecord :: DarcsCommand - -amendrecord = DarcsCommand {commandName = "amend-record", +amendrecord = DarcsCommand {commandProgramName = "darcs", + commandName = "amend-record", commandHelp = amendrecordHelp, commandDescription = amendrecordDescription, commandExtraArgs = -1, hunk ./src/Darcs/Commands/Annotate.lhs 86 "option can be used to generate output for machine postprocessing.\n" annotate :: DarcsCommand - -annotate = DarcsCommand {commandName = "annotate", +annotate = DarcsCommand {commandProgramName = "darcs", + commandName = "annotate", commandHelp = annotateHelp, commandDescription = annotateDescription, commandExtraArgs = -1, hunk ./src/Darcs/Commands/Apply.lhs 125 stdindefault _ [] = return ["-"] stdindefault _ x = return x apply :: DarcsCommand - -apply = DarcsCommand {commandName = "apply", +apply = DarcsCommand {commandProgramName = "darcs", + commandName = "apply", commandHelp = applyHelp ++ "\n" ++ applyHelp', commandDescription = applyDescription, commandExtraArgs = 1, hunk ./src/Darcs/Commands/Changes.lhs 88 "\n" ++ changesHelp'' changes :: DarcsCommand - -changes = DarcsCommand {commandName = "changes", +changes = DarcsCommand {commandProgramName = "darcs", + commandName = "changes", commandHelp = changesHelp, commandDescription = changesDescription, commandExtraArgs = -1, hunk ./src/Darcs/Commands/Check.lhs 65 "by `darcs check'. Use the --no-test option to disable this.\n" check :: DarcsCommand - -check = DarcsCommand {commandName = "check", +check = DarcsCommand {commandProgramName = "darcs", + commandName = "check", commandHelp = checkHelp, commandDescription = checkDescription, commandExtraArgs = 0, hunk ./src/Darcs/Commands/Convert.lhs 119 "than once.)\n" convert :: DarcsCommand - -convert = DarcsCommand {commandName = "convert", +convert = DarcsCommand {commandProgramName = "darcs", + commandName = "convert", commandHelp = convertHelp, commandDescription = convertDescription, commandExtraArgs = -1, hunk ./src/Darcs/Commands/Diff.lhs 78 "formatted as the output of a diff command\n" diffCommand :: DarcsCommand - -diffCommand = DarcsCommand {commandName = "diff", +diffCommand = DarcsCommand {commandProgramName = "darcs", + commandName = "diff", commandHelp = diffHelp, commandDescription = diffDescription, commandExtraArgs = -1, hunk ./src/Darcs/Commands/Dist.lhs 34 import Prelude hiding ( writeFile ) import Data.ByteString.Lazy ( writeFile ) - -import Darcs.Commands ( DarcsCommand(DarcsCommand, commandName, commandHelp, - - commandDescription, commandExtraArgs, - - commandExtraArgHelp, commandCommand, - - commandPrereq, commandGetArgPossibilities, - - commandArgdefaults, - - commandAdvancedOptions, commandBasicOptions), +import Darcs.Commands ( DarcsCommand(..), nodefaults ) import Darcs.Arguments ( DarcsFlag(Verbose, DistName), distnameOption, workingRepoDir, matchOne, storeInMemory, hunk ./src/Darcs/Commands/Dist.lhs 83 -} dist :: DarcsCommand - -dist = DarcsCommand {commandName = "dist", +dist = DarcsCommand {commandProgramName = "darcs", + commandName = "dist", commandHelp = distHelp, commandDescription = distDescription, commandExtraArgs = 0, hunk ./src/Darcs/Commands/GZCRCs.lhs 122 when verbose $ hPutStrLn stderr $ unlines ("The following corrupt files were found:":files) gzcrcs :: DarcsCommand - -gzcrcs = DarcsCommand {commandName = "gzcrcs", +gzcrcs = DarcsCommand {commandProgramName = "darcs", + commandName = "gzcrcs", commandHelp = gzcrcsHelp, commandDescription = gzcrcsDescription, commandExtraArgs = 0, hunk ./src/Darcs/Commands/Get.lhs 120 "is required.\n" get :: DarcsCommand - -get = DarcsCommand {commandName = "get", +get = DarcsCommand {commandProgramName = "darcs", + commandName = "get", commandHelp = getHelp, commandDescription = getDescription, commandExtraArgs = -1, hunk ./src/Darcs/Commands/Help.lhs 56 "`darcs help foo' prints detailed help about the darcs command foo.\n" help :: DarcsCommand - -help = DarcsCommand {commandName = "help", +help = DarcsCommand {commandProgramName = "darcs", + commandName = "help", commandHelp = helpHelp, commandDescription = helpDescription, commandExtraArgs = -1, hunk ./src/Darcs/Commands/Init.lhs 73 "Initialize is commonly abbreviated to `init'.\n" initialize :: DarcsCommand - -initialize = DarcsCommand {commandName = "initialize", +initialize = DarcsCommand {commandProgramName = "darcs", + commandName = "initialize", commandHelp = initializeHelp, commandDescription = initializeDescription, commandExtraArgs = 0, hunk ./src/Darcs/Commands/MarkConflicts.lhs 67 "alias still exists for backwards-compatibility.\n" markconflicts :: DarcsCommand - -markconflicts = DarcsCommand {commandName = "mark-conflicts", +markconflicts = DarcsCommand {commandProgramName = "darcs", + commandName = "mark-conflicts", commandHelp = markconflictsHelp, commandDescription = markconflictsDescription, commandExtraArgs = 0, hunk ./src/Darcs/Commands/Move.lhs 77 "unusable on those systems!\n" move :: DarcsCommand - -move = DarcsCommand {commandName = "move", +move = DarcsCommand {commandProgramName = "darcs", + commandName = "move", commandHelp = moveHelp, commandDescription = moveDescription, commandExtraArgs = -1, hunk ./src/Darcs/Commands/Optimize.lhs 125 "unversioned files in _darcs/prefs/ (such as _darcs/prefs/author).\n" optimize :: DarcsCommand - -optimize = DarcsCommand {commandName = "optimize", +optimize = DarcsCommand {commandProgramName = "darcs", + commandName = "optimize", commandHelp = optimizeHelp, commandDescription = optimizeDescription, commandExtraArgs = 0, hunk ./src/Darcs/Commands/Pull.lhs 114 fetch :: DarcsCommand fetch = DarcsCommand { - - commandName = "fetch", + commandProgramName = "darcs", + commandName = "fetch", commandHelp = fetchHelp, commandDescription = fetchDescription, commandExtraArgs = -1, hunk ./src/Darcs/Commands/Pull.lhs 138 allowUnrelatedRepos]} pull :: DarcsCommand - -pull = DarcsCommand {commandName = "pull", +pull = DarcsCommand {commandProgramName = "darcs", + commandName = "pull", commandHelp = pullHelp, commandDescription = pullDescription, commandExtraArgs = -1, hunk ./src/Darcs/Commands/Push.lhs 78 "current repository into another repository.\n" push :: DarcsCommand - -push = DarcsCommand {commandName = "push", +push = DarcsCommand {commandProgramName = "darcs", + commandName = "push", commandHelp = pushHelp, commandDescription = pushDescription, commandExtraArgs = 1, hunk ./src/Darcs/Commands/Put.lhs 58 "appropriate. See those commands for an explanation of each option.\n" put ::DarcsCommand - -put = DarcsCommand {commandName = "put", +put = DarcsCommand {commandProgramName = "darcs", + commandName = "put", commandHelp = putHelp, commandDescription = putDescription, commandExtraArgs = 1, hunk ./src/Darcs/Commands/Record.lhs 94 "\n" ++ recordHelp'' record :: DarcsCommand - -record = DarcsCommand {commandName = "record", +record = DarcsCommand {commandProgramName = "darcs", + commandName = "record", commandHelp = recordHelp, commandDescription = recordDescription, commandExtraArgs = -1, hunk ./src/Darcs/Commands/Remove.lhs 68 "the patch) will ALWAYS affect the working tree of that repository.\n" remove :: DarcsCommand - -remove = DarcsCommand {commandName = "remove", +remove = DarcsCommand {commandProgramName = "darcs", + commandName = "remove", commandHelp = removeHelp, commandDescription = removeDescription, commandExtraArgs = -1, hunk ./src/Darcs/Commands/Repair.lhs 43 "which is where most corruption occurs.\n" repair :: DarcsCommand - -repair = DarcsCommand {commandName = "repair", +repair = DarcsCommand {commandProgramName = "darcs", + commandName = "repair", commandHelp = repairHelp, commandDescription = repairDescription, commandExtraArgs = 0, hunk ./src/Darcs/Commands/Replace.lhs 29 import Control.Monad ( unless, filterM ) import Control.Applicative( (<$>) ) - -import Darcs.Commands ( DarcsCommand(DarcsCommand, commandName, commandHelp, - - commandDescription, commandExtraArgs, - - commandExtraArgHelp, commandCommand, commandPrereq, - - commandGetArgPossibilities, commandArgdefaults, - - commandAdvancedOptions, commandBasicOptions), +import Darcs.Commands ( DarcsCommand(..), nodefaults ) import Darcs.Arguments ( DarcsFlag(ForceReplace, Toks), listRegisteredFiles, ignoretimes, umaskOption, tokens, forceReplace, hunk ./src/Darcs/Commands/Replace.lhs 145 \begin{code} replace :: DarcsCommand - -replace = DarcsCommand {commandName = "replace", +replace = DarcsCommand {commandProgramName = "darcs", + commandName = "replace", commandHelp = replaceHelp, commandDescription = replaceDescription, commandExtraArgs = -1, hunk ./src/Darcs/Commands/Revert.lhs 68 "revert' ran.\n" revert :: DarcsCommand - -revert = DarcsCommand {commandName = "revert", +revert = DarcsCommand {commandProgramName = "darcs", + commandName = "revert", commandHelp = revertHelp, commandDescription = revertDescription, commandExtraArgs = -1, hunk ./src/Darcs/Commands/Rollback.lhs 82 "of its changes.\n" rollback :: DarcsCommand - -rollback = DarcsCommand {commandName = "rollback", +rollback = DarcsCommand {commandProgramName = "darcs", + commandName = "rollback", commandHelp = rollbackHelp, commandDescription = rollbackDescription, commandExtraArgs = -1, hunk ./src/Darcs/Commands/Send.lhs 118 \begin{code} send :: DarcsCommand - -send = DarcsCommand {commandName = "send", +send = DarcsCommand {commandProgramName = "darcs", + commandName = "send", commandHelp = sendHelp, commandDescription = sendDescription, commandExtraArgs = 1, hunk ./src/Darcs/Commands/SetPref.lhs 76 "low-priority bug, because preferences are seldom set.\n" setpref :: DarcsCommand - -setpref = DarcsCommand {commandName = "setpref", +setpref = DarcsCommand {commandProgramName = "darcs", + commandName = "setpref", commandHelp = setprefHelp, commandDescription = setprefDescription, commandExtraArgs = 2, hunk ./src/Darcs/Commands/Show.lhs 46 "Currently this is a deprecated alias.\n" showCommand :: DarcsCommand - -showCommand = SuperCommand {commandName = "show", +showCommand = SuperCommand {commandProgramName = "darcs", + commandName = "show", commandHelp = showHelp, commandDescription = showDescription, commandPrereq = amInRepository, hunk ./src/Darcs/Commands/ShowAuthors.lhs 92 showAuthors :: DarcsCommand showAuthors = DarcsCommand { + commandProgramName = "darcs", commandName = "authors", commandHelp = showAuthorsHelp, commandDescription = showAuthorsDescription, hunk ./src/Darcs/Commands/ShowBug.lhs 39 ++"a bug in darcs.\n" showBug :: DarcsCommand - -showBug = DarcsCommand {commandName = "bug", +showBug = DarcsCommand {commandProgramName = "darcs", + commandName = "bug", commandHelp = showBugHelp, commandDescription = showBugDescription, commandExtraArgs = 0, hunk ./src/Darcs/Commands/ShowContents.lhs 51 "version of the file(s).\n" showContents :: DarcsCommand - -showContents = DarcsCommand {commandName = "contents", +showContents = DarcsCommand {commandProgramName = "darcs", + commandName = "contents", commandHelp = showContentsHelp, commandDescription = showContentsDescription, commandExtraArgs = -1, hunk ./src/Darcs/Commands/ShowFiles.lhs 70 showFiles :: DarcsCommand showFiles = DarcsCommand { + commandProgramName = "darcs", commandName = "files", commandHelp = showFilesHelp, commandDescription = showFilesDescription, hunk ./src/Darcs/Commands/ShowIndex.lhs 47 showIndex :: DarcsCommand showIndex = DarcsCommand { + commandProgramName = "darcs", commandName = "index", commandDescription = "Dump contents of working tree index.", commandHelp = hunk ./src/Darcs/Commands/ShowRepo.lhs 59 showRepoDescription = "Show repository summary information" showRepo :: DarcsCommand - -showRepo = DarcsCommand { commandName = "repo", +showRepo = DarcsCommand { commandProgramName = "darcs", + commandName = "repo", commandHelp = showRepoHelp, commandDescription = showRepoDescription, commandExtraArgs = 0, hunk ./src/Darcs/Commands/ShowTags.lhs 45 showTags :: DarcsCommand showTags = DarcsCommand { + commandProgramName = "darcs", commandName = "tags", commandHelp = showTagsHelp, commandDescription = showTagsDescription, hunk ./src/Darcs/Commands/Tag.lhs 24 import System.Directory ( removeFile ) import Control.Monad ( when ) - -import Darcs.Commands ( DarcsCommand(DarcsCommand, commandName, commandHelp, - - commandDescription, commandExtraArgs, - - commandExtraArgHelp, commandCommand, commandPrereq, - - commandGetArgPossibilities, commandArgdefaults, - - commandAdvancedOptions, commandBasicOptions), - - nodefaults ) +import Darcs.Commands ( DarcsCommand(..), nodefaults ) import Darcs.Arguments ( nocompress, umaskOption, patchnameOption, author, pipeInteractive, askLongComment, workingRepoDir, getAuthor ) hunk ./src/Darcs/Commands/Tag.lhs 69 "described in `darcs record'.\n" tag :: DarcsCommand - -tag = DarcsCommand {commandName = "tag", +tag = DarcsCommand {commandProgramName = "darcs", + commandName = "tag", commandHelp = tagHelp, commandDescription = tagDescription, commandExtraArgs = -1, hunk ./src/Darcs/Commands/TrackDown.lhs 63 "found at random." trackdown :: DarcsCommand - -trackdown = DarcsCommand {commandName = "trackdown", +trackdown = DarcsCommand {commandProgramName = "darcs", + commandName = "trackdown", commandHelp = trackdownHelp, commandDescription = trackdownDescription, commandExtraArgs = -1, hunk ./src/Darcs/Commands/TransferMode.lhs 55 "hundreds of times!\n" transferMode :: DarcsCommand - -transferMode = DarcsCommand {commandName = "transfer-mode", +transferMode = DarcsCommand {commandProgramName = "darcs", + commandName = "transfer-mode", commandHelp = transferModeHelp, commandDescription = transferModeDescription, commandExtraArgs = 0, hunk ./src/Darcs/Commands/Unrecord.lhs 150 "another user may have already pulled the patch.\n" unrecord :: DarcsCommand - -unrecord = DarcsCommand {commandName = "unrecord", +unrecord = DarcsCommand {commandProgramName = "darcs", + commandName = "unrecord", commandHelp = unrecordHelp, commandDescription = unrecordDescription, commandExtraArgs = 0, hunk ./src/Darcs/Commands/Unrecord.lhs 276 \begin{code} obliterate :: DarcsCommand - -obliterate = DarcsCommand {commandName = "obliterate", +obliterate = DarcsCommand {commandProgramName = "darcs", + commandName = "obliterate", commandHelp = obliterateHelp, commandDescription = obliterateDescription, commandExtraArgs = 0, hunk ./src/Darcs/Commands/Unrevert.lhs 74 "interactive command that will DEFINITELY prevent unreversion.\n" unrevert :: DarcsCommand - -unrevert = DarcsCommand {commandName = "unrevert", +unrevert = DarcsCommand {commandProgramName = "darcs", + commandName = "unrevert", commandHelp = unrevertHelp, commandDescription = unrevertDescription, commandExtraArgs = 0, hunk ./src/Darcs/Commands/WhatsNew.lhs 94 "there are no unrecorded changes.\n" whatsnew :: DarcsCommand - -whatsnew = DarcsCommand {commandName = "whatsnew", +whatsnew = DarcsCommand {commandProgramName = "darcs", + commandName = "whatsnew", commandHelp = whatsnewHelp, commandDescription = whatsnewDescription, commandExtraArgs = -1, Context: [Accept issue1951: add outside of current repository. Eric Kow <ko...@darcs.net>**20100908095448 Ignore-this: 5085d7647e9408ea7b5282e1cb0d1079 Regression between darcs 2.4 and 2.4.98.5. ] [TAG 2.4.98.5 Reinier Lamers <tux_roc...@reinier.de>**20100905170906 Ignore-this: 848f746fa6a939cef069abe6722d4206 ] Patch bundle hash: 3574c6c896a5510c854c608c514ee922cd62f3ff -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iEYEARECAAYFAkySXgYACgkQ9ijrk0dDIGx3uACfTrwL2QC+5HBgT9LJm4ry4H9F Ki4An2QYGGmRSDWqZtjhW1ChRCmeYd3E =ytaQ -----END PGP SIGNATURE-----
unnamed
Description: Binary data
_______________________________________________ darcs-users mailing list darcs-users@darcs.net http://lists.osuosl.org/mailman/listinfo/darcs-users