I'm sick of this sitting on my hard disk, and I want it applied to trunk. So I resolved conflicts with trunk and am sending it.
Mon Feb 2 13:41:46 EST 2009 Trent W. Buck <[email protected]> * Resolve issue1093: warn about ugly patch names. Mon Feb 2 13:51:14 EST 2009 Trent W. Buck <[email protected]> * Test issue1093: warn about ugly patch names.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 New patches: [Resolve issue1093: warn about ugly patch names. Trent W. Buck <[email protected]>**20090202024146 Ignore-this: feafa901131c8f1822ffac23cd2cae8a ] hunk ./src/Darcs/Commands/Record.lhs 30 import Control.Monad ( filterM, when ) import System.IO ( hGetContents, stdin ) import Data.List ( sort, isPrefixOf ) - -import System.Exit ( exitFailure, ExitCode(..) ) +import System.Exit ( ExitCode(..) ) import System.IO ( hPutStrLn ) import System.Directory ( doesFileExist, doesDirectoryExist, removeFile ) import Data.Maybe ( isJust ) hunk ./src/Darcs/Commands/Record.lhs 34 +import Data.Char ( isLower, isPunctuation ) import Darcs.Lock ( readBinFile, writeBinFile, world_readable_temp, appendToFile, removeFileMayNotExist ) import Darcs.Hopefully ( info, n2pia ) hunk ./src/Darcs/Commands/Record.lhs 136 record_cmd :: [DarcsFlag] -> [String] -> IO () record_cmd opts args = do - - check_name_is_not_option opts + check_name_is_not_ugly opts let (logMessage,_, _) = loggers opts withRepoLock (testByDefault opts) $- \repository -> do rec <- if null args then return empty_slurpy hunk ./src/Darcs/Commands/Record.lhs 167 | otherwise = Nothing allow_empty_with_askdeps p = Just p - - -- check that what we treat as the patch name is not accidentally a command - - -- line flag - -check_name_is_not_option :: [DarcsFlag] -> IO () - -check_name_is_not_option opts = do - - let (logMessage, _, _) = loggers opts - - patchNames = [n | PatchName n <- opts] - - when (length patchNames == 1) $ do - - let n = head patchNames - - oneLetterName = length n == 1 || (length n == 2 && head n == '-') - - if (oneLetterName && not (elem All opts)) - - then do - - let keepAsking = do - - yorn <- promptYorn ("You specified " ++ show n ++ " as the patch name. Is that really what you want?") - - case yorn of - - 'y' -> return () - - 'n' -> do - - logMessage "Okay, aborting the record." - - exitFailure - - _ -> keepAsking - - keepAsking - - else return () - - +-- | Perform style checks on the patch name, and warn about the first +-- style concern found, if any. +-- FIXME: should print *all* matching style warnings. +-- FIXME: should prompt to amend the name, unless --all is used. +-- FIXME: should also apply when the patch is named interactively. +-- FIXME: should also perform (most) checks against the long description. +-- FIXME: the code is very repetetive and ugly. +check_name_is_not_ugly :: [DarcsFlag] -> IO () +check_name_is_not_ugly opts = when (length patchNames == 1) $ do diagnose (head patchNames) + where patchNames = [n | PatchName n <- opts] + diagnose :: String -> IO () + diagnose n@('-':_) = + putStrLn ("WARNING: the patch name \"" ++ n ++ "\" looks like an option.") >> + putStrLn "This is discouraged because it may confuse command-line utilities." >> + amend + diagnose n | length n < 10 = -- this number is totally arbitrary + putStrLn "WARNING: the patch name is very short." >> + putStrLn "Does it convey an adequate summary to other contributors?" >> + amend + | length n > 70 = -- this number is totally arbitrary + putStrLn "WARNING: the patch name is very long." >> + putStrLn "Consider moving details into the long description." >> + amend + -- Note that we use isLower here instead of not + -- . isUpper because some languages are caseless. + | isLower $ head n = + putStrLn "WARNING: the patch name doesn't start with an uppercase letter." >> + putStrLn "Using a whole sentence for each patch name is recommended." >> + amend + | not $ isPunctuation $ last n = + putStrLn "WARNING: the patch name doesn't end with punctuation." >> + putStrLn "Using a whole sentence for each patch name is recommended." >> + amend + diagnose _ = return () + amend = putStrLn "Use \"darcs amend --edit\" to rename this patch." do_record :: RepoPatch p => Repository p -> [DarcsFlag] -> [SubPath] -> FL Prim -> IO () do_record repository opts files ps = do [Test issue1093: warn about ugly patch names. Trent W. Buck <[email protected]>**20090202025114 Ignore-this: e33c9503d3f444f4ad58f78d9f0d5987 ] addfile ./tests/issue1093_ugly_names.sh hunk ./tests/issue1093_ugly_names.sh 1 +#!/usr/bin/env bash +## Test for issue1093 - Darcs should warn user about really long patch +## names, and other stylistic gaffes in their patch names. +## +## Copyright (C) 2009 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 of the License, 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. + +. lib + +rm -rf temp1 # clean up when previous run crashed +darcs init --repodir temp1 +touch temp1/{a,b,c,d} +darcs record --repodir temp1 -lam 'Disable friendly fire by default.' a >out 2>&1 +not grep -i WARNING out +darcs record --repodir temp1 -lam "Long example: $(printf %0100d 0)." b >out 2>&1 +grep -i WARNING out +darcs record --repodir temp1 -lam "begins with a lowercase letter." c >out 2>&1 +grep -i WARNING out +darcs record --repodir temp1 -lam "Doesn't end in punctuation" d >out 2>&1 +grep -i WARNING out +rm -rf temp1 out Context: [Relax regex and parsec dependencies in darcs.cabal. Petr Rockai <[email protected]>**20090128151230 Ignore-this: b8e46f9551c0dac608ba3584ccb725bc ] [Cabal: Look around for diff and sendmail properly. Petr Rockai <[email protected]>**20090128141151 Ignore-this: fd299a492c38fca04c791884226e63d9 ] [Update push-formerly-pl.sh test for issue1333 Eric Kow <[email protected]>**20090128145030 Ignore-this: a4d765ab6b212e4bbedb14093a680054 ] [Canonize Don Stewart, Petr Rockai, Benedikt Schmidt and Spencer Janssen Eric Kow <[email protected]>**20090128142742 Ignore-this: 94e76427b82465a7ddfea79b39b54c33 ] [Resolve issue1333: Improve "cannot push to current repository" warning. Petr Rockai <[email protected]>**20090128094353 Ignore-this: 1cc9fe3631f323a9a66639f5a1cee8ce ] [autoconf: Fix definition of SENDMAIL macro when sendmail is not found Eric Kow <[email protected]>**20090127155329 Ignore-this: 9799e7838d1a1843f562ad14c08aa337 ] [autoconf: Define BIGENDIAN instead of setting it. Eric Kow <[email protected]>**20090127140114 Ignore-this: 65855789f62b42c4cc84b14f714ff086 The new Autoconf.hs just checks if BIGENDIAN is defined, not its value. ] [Relax a few version constraints in darcs.cabal. Petr Rockai <[email protected]>**20090126154834 Ignore-this: d3c7c92513dfffe14fc501d8e84c679d These should be reasonably safe, as they only cover part of what has been previously accepted by configure. ] [Add missing doublequotes to multiple tests. Petr Rockai <[email protected]>**20090126151705 Ignore-this: eb8553ec6ea036f49fee4b9bc20d8f04 ] [Accept issue1266: warn on init inside a repo. Trent W. Buck <[email protected]>**20090126011404 Ignore-this: abf7526335f0975340a9a6d06df63470 ] [Have autoconf forget about .hs.in. Trent W. Buck <[email protected]>**20090126125644 Ignore-this: 4fa6a3ce806c726dcaec5771d3059c8b ] [Drop autogeneration of Autoconf.hs, use CPP instead. Petr Rockai <[email protected]>**20090125175413 Ignore-this: 5ba936527bad6d85bedf125b01f884d5 ] [Produce -DPACKAGE_VERSION="..." programatically in Setup.lhs. Petr Rockai <[email protected]>**20090124215200 Ignore-this: 6c3b0010d7de2397a7d81056523399dd ] [Replace ThisVersion.hs generation within Setup with some simple CPP. Petr Rockai <[email protected]>**20090124215149 Ignore-this: 4a6a9baf2e0d016616d98ee9774c01f4 ] [Add -fglasgow-exts to Darcs.Patch.Show Eric Kow <[email protected]>**20090125221422 Ignore-this: 38fa728c6dd08d8be30712b79b56f634 This probably broke when we moved it from the cabal file to Darcs.Show ] [Remove stale import from Darcs.Commands.ShowRepo Eric Kow <[email protected]>**20090125215507 Ignore-this: 85cc913ca9532b3aec3c6ce616b896d1 ] [Flip the repo test over to Cabal. Petr Rockai <[email protected]>**20090124223836 Ignore-this: fc99853532cadcc9a9a77a2e26e2b077 ] [A grand unified pwd hack. Petr Rockai <[email protected]>**20090125182013 Ignore-this: edfd791d6780e3b01e5158895e7903a1 I have replaced all pwd occurances with a call to hspwd, and I am using runghc to do so. This might be slow-ish, but should be reasonably portable. Moreover, I am experimentally removing the IFS='' hack and adding missing doublequotes to some places (and to some where they are not needed by POSIX but who knows). I believe IFS='' is equivalent to adding proper quoting to expansions (ie $DIR -> "$DIR"). ] [Refactor version machinery in Setup.lhs. Petr Rockai <[email protected]>**20090124211015 Ignore-this: 590b4c7825cd858dfc2faa60d9440697 Sanctify the notion that 97, 98 and 99 are special in a darcs version number. Assign fancy names to them, for prettier darcs --version. ] [Resolve issue1310: create merged \darcsCommand{add}. Trent W. Buck <[email protected]>**20090124144058 Ignore-this: 945f45d0671c1e5a613ebfb3c4f90f59 This replaces inconsistent use of \haskell{add_description}, \options{add} and \haskell{add_help}. ] [Resolve issue1313: Clickable ToC and xrefs in PDF user manual. Trent W. Buck <[email protected]>**20090125091034 Ignore-this: 29bde3a5a170f5965d10d6c160b2099e ] [Test for strace first. Trent W. Buck <[email protected]>**20090125062905 Ignore-this: 76cbe2cb451d226cfa5cf0b39f43722 This just results in more accurate "it didn't work because ..." output from "cabal test bugs". ] [(cabal build) build 'witnesses' only with -ftype-witnesses Bertram Felgenhauer <[email protected]>**20090122224907 Ignore-this: 6d627163a3d4258baf22f34e304bd767 ] [(cabal build) add two missing modules to darcs library Bertram Felgenhauer <[email protected]>**20090122224608 Ignore-this: 6164fef661fa5f31cae007e523012e68 ] [Tell the configure script to require haskeline>=0.6.0. Judah Jacobson <[email protected]>**20090122214543 Ignore-this: 13e0549a6a2c75eb22f3b75a915908e7 ] [use forM_ from the standard library Florent Becker <[email protected]>**20090122125344 Ignore-this: 4d9c0e4b98f9f43a0b519584806ddd1a ] [Remove LANGUAGE GADTs pragma in Darcs.Show (GHC 6.6 compatibility) Eric Kow <[email protected]>**20090122102846 Ignore-this: 488aa7c372f5deee415ae2bae0c578ac ] [Remove duplication in fields in the .cabal file Duncan Coutts <[email protected]>**20090122021052 Looks like it was a copy and paste error. ] [Remove unused ghc -threaded flag in library section Duncan Coutts <[email protected]>**20090122021038 The -threaded flag applies only to linking programs. Despte this, ghc regects the combinaton of using the -threaded and profiling flags, even for building a library. New Cabal versions will ignore the -threaded flag when building programs but not for libs because that combination is senseless. So there is a positive benefit to dropping it from the darcs library as it will let people build a profiling darcs with ghc-6.8 without having to modify the .cabal file to drop the -threaded flag. ] [Clean up after shell harness. Trent W. Buck <[email protected]>**20090122050123 We were only cleaning .o and .hi files within src. Doing "make test" results in some .o and .hi files elsewhere. We should add these directories to the "find src" calls above, but this hack is easier to understand and should suffice until we finish switching to Cabal. ] [Syntax highlighting for new-style NEWS entries. Trent W. Buck <[email protected]>**20090122064107] [NEWS for Darcs 2.2.0. Trent W. Buck <[email protected]>**20090122064014] [Use conventional name "NEWS" for "new in $version" notes. Trent W. Buck <[email protected]>**20090122063959] [Resolve issue1292: re-encode line input from the Haskeline backend. Judah Jacobson <[email protected]>**20090121172422 Ignore-this: e6c94db8cbef0f8fa3f3d0011c6ef88f This patch bumps dependencies to haskeline-0.6.* (which provides the required functionality) and terminfo-0.3.* (which is required by that version of Haskeline). Haskeline is also enabled by default now that non-ASCII line input works correctly. ] [mv -fglasgow-exts to Darcs.Show [email protected]**20090120150052 Ignore-this: 21000375294de932f303baadba815b8b ] [Remove obsolete import. Trent W. Buck <[email protected]>**20090118014801 Ignore-this: d6bd196c7d088b7e7121637d7c1b1323 ] [Refactor initial argument dispatcher. Trent W. Buck <[email protected]>**20090117081533 Ignore-this: fe101e61cc7b46a8c6b4415f08c737b ] [Simplify some of my own code. Trent W. Buck <[email protected]>**20090117015505 Ignore-this: 42a7df5c21ae0416441572380490e127 ] [Haddocks for HashedIO [email protected]**20090116170955 Ignore-this: 1c54191a243bd11d6d22d74600251587 ] [Haddocks for Cache [email protected]**20090116170931 Ignore-this: 3aa035bd5f805929113a616df9faefb6 ] [Haddock for Darcs.External.fetchFile [email protected]**20090116170742 Ignore-this: 96041231ca2800c3fcde4f56ec49e267 ] [Refactor: use more guards. Trent W. Buck <[email protected]>**20090115072617 Ignore-this: b41bb970198ed1f42aebdfc63c90e115 ] [Resolve issue1311: Use time zones from GNU coreutils; improve doc. Dave Love <[email protected]>**20090112135012 Ignore-this: 883bc4ccdb1d27fde14ec9c76a4d2a45 ] [omit empty line at the end of output in darcs diff Christian Kellermann <[email protected]>**20090114110607 Ignore-this: d71a3d5460fbe21244c4eba77dc47885 ] [Clean up when previous test crashed. Trent W. Buck <[email protected]>**20090113001345] [Make "make clean" remove microbench. Trent W. Buck <[email protected]>**20090111152130 Put the clean target directly below the build target, so it's harder to get them out of sync in future. ] [Fix test optimize_relink.sh when no hard linking available Thorkil Naur <[email protected]>**20090113223335 The semicolon in the echo command causes the test to fail with the message > optimize_relink.sh: line 37: assuming: command not found when no hard linking is available. ] [Consistently use sh (not csh) prompts in user manual. Trent W. Buck <[email protected]>**20090111114801 The sh prompt ($) was already used elsewhere in the manual, and I choose to standardize on it instead of csh (%) because sh (especially bash) seems more widespread and recognizable as the user shell prompt. ] [resolve issue1270: don't show the motd when --xml-output is given [email protected]**20090109090726 Ignore-this: e1dae49ceb510668a1358e2103268cc3 ] [Get setpref description in manual. Dave Love <[email protected]>**20090111151941 Ignore-this: 89b0d00a82582d03fdf51cd9822dba65 ] [Example for issue1284. Trent W. Buck <[email protected]>**20090111051101] [resolve issue1235: added --summary to obliterate Rob Hoelz <[email protected]>**20090110032907] [Haddock for Darcs.Repository.Format Florent Becker <[email protected]>**20090108160035 Ignore-this: f88f0223ebbbe5694845dd1060e6f978 ] [Remove stale comment (we now require GHC 6.6) Eric Kow <[email protected]>**20081231080929 Ignore-this: b19da9fabc8d2e38bccafc84a77fa278 ] [do not use concatenation in src/Context.hs Florent Becker <[email protected]>**20090107135552 Ignore-this: 9e86505a445730b7653e75f08e8ff81e ] [Print malicious paths and optional way around them when they cause a failure. David Caldwell <[email protected]>**20090105101628 Ignore-this: cdb706087869e19e046bc0dd424ca38d ] [Fix typo in --dont-restrict-paths documentation. David Caldwell <[email protected]>**20090105024208 Ignore-this: 16197eeef34dedddeda036b47747f234 ] [Add --restrict-paths (and --dont-restrict-paths) to "darcs apply". David Caldwell <[email protected]>**20090102101737 Ignore-this: f6ab937573bf0d5397361ddefed902c9 ] [Add --restrict-paths (and --dont-restrict-paths) to "darcs pull". David Caldwell <[email protected]>**20090102101726 Ignore-this: dd3bc04632d341be16709e0aee6753ec ] [Revert --restrict-paths removal. David Caldwell <[email protected]>**20090102101705 Ignore-this: 1fba1f9a589aaabb1fa27a268f7c972e ] [Resolve issue1302: set closed bugs to resolved (not resolved-in-unstable). Trent W. Buck <[email protected]>**20090105001351] [make stringify cut the string [email protected]**20090104102125 Ignore-this: e1a0cd83fce5085f60b812d894ca26e7 This avoids choking utilities such as grep (or emacs' internal grep) which parse haskell files line-by-line. ] [make unit's return value depend on all tests Florent Becker <[email protected]>**20090102184930 Ignore-this: fce3636c70bcb4a80413823c88e3ac6a ] [Resolve issue1285: remove "cabal test" intermediaries. Trent W. Buck <[email protected]>**20090103095347] [Resolve issue1206: Countable Nouns. Trent W. Buck <[email protected]>**20090101062452 Use the conventional term "Countable" instead of "Numbered". ] [Improve readability of bug reporting. Trent W. Buck <[email protected]>**20081226120833 Moving "at <location>" to the first line gives the descriptive string a line all to itself. For example, darcs show bug: darcs: bug at src/Darcs/Commands/ShowBug.lhs:57 compiled Nov 4 2008 12:05:43 This is actually a fake bug in darcs. ] [Use imperative mood for primitive matcher help. Trent W. Buck <[email protected]>**20081228114434] [Check GADT witnesses when doing Cabal-based builds. Petr Rockai <[email protected]>**20081228111229] [Fix haddock error Eric Kow <[email protected]>**20081227204218 Ignore-this: 60f05d20e5f37312f6b477067114fac7 ] [Haddock for primitiveMatchers (untested). Trent W. Buck <[email protected]>**20081227141921] [Rewrite primitive matcher examples. Trent W. Buck <[email protected]>**20081227141845] [Rewrite "darcs help --match" output. Trent W. Buck <[email protected]>**20081227141819 Add an introductory paragraph, and put all the examples into a single code block, since one-line paragraphs are kind hard to read. ] [Delete superfluous "Introduction" headings. Trent W. Buck <[email protected]>**20081227034129 I don't think it's useful to grant a subsection heading to the single introductory paragraph of a section. ] [Refactor error text for readability. Trent W. Buck <[email protected]>**20081109144007] [Tweak user manual's title page. Trent W. Buck <[email protected]>**20081227011031 It annoyed me that the user manual was just called "Darcs", not "Darcs User Manual". ] [Improve readability of bug reporting. Trent W. Buck <[email protected]>**20081226104243 Moving "at <location>" to the first line gives the descriptive string a line all to itself. For example, darcs show bug: darcs: bug at src/Darcs/Commands/ShowBug.lhs:57 compiled Nov 4 2008 12:05:43 This is actually a fake bug in darcs. ] [Haddockize developer comment. Trent W. Buck <[email protected]>**20081214041902] [Darcs.ColorPrinter: factor out getPolicy call [email protected]**20081222180227 Ignore-this: aee5b5415ee8bbfe1dac06e240b90080 Less redundancy. 'getPolicy' is being called with the same args, and it's not like the environmental variables are going to change in between each call. ] [Make it possible to run just specific tests from cabal commandline. Petr Rockai <[email protected]>**20081223083742 All of `cabal test repair-corrupt bugs/newlines bugs/issue27.sh` should work as expected. The implementation is not very efficient, but seems to work fine. ] [Neatify "cabal test" option munging in Setup.lhs. Petr Rockai <[email protected]>**20081223080811] [Sort the list of tests that are run by cabal. Petr Rockai <[email protected]>**20081223073642] [Remove now-unused replacePristine. Petr Rockai <[email protected]>**20081210065138] [resolve issue948: rewrite darcsman. Trent W. Buck <[email protected]>**20081221081934 Significant changes are: - Avoid duplicating groups from TheCommands. - Due to growing command_helps, list commands in SYNOPSIS. - Use subsections (.SS) for groups. - Include (with fancy markup!) command arguments. - Include darcs help --match. - Copy-and-paste description from darcs.cabal. - Remove AUTHORS section as suggested by man-pages(7). - Declare my copyright. ] [Tweak punctuation in "darcs help --match". Trent W. Buck <[email protected]>**20081221080949 Manpages treat apostrophes in the first line specially. Use `TeX style' quotes instead, so this string can be included in the manpage. Also omit mention of &&, || and ! until I find time to clarify that they are aliases for the human-readable and, or and not. ] [TAG 2.2.0 Petr Rockai <[email protected]>**20090115150916] Patch bundle hash: a2ab3ceb8d4233572837e20688a4572e1aba67b0 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkmGX7AACgkQLpef9iTtxAa/6ACeNvclwd8W77DuVq1nc66/pDIF rhAAoNzll/yrLgZ8kr5aBvBLZOOH7KG8 =zIBw -----END PGP SIGNATURE-----
_______________________________________________ darcs-users mailing list [email protected] http://lists.osuosl.org/mailman/listinfo/darcs-users
