Mon Sep 12 19:15:50 EDT 2005  [EMAIL PROTECTED]
  * Added the ability to add long comments to tags.  By default does not 
prompt.  Use --prompt-long-comment or --edit-long-comment to enable.
New patches:

[Added the ability to add long comments to tags.  By default does not prompt.  Use --prompt-long-comment or --edit-long-comment to enable.
[EMAIL PROTECTED] {
hunk ./Tag.lhs 30
+import IO ( hGetContents, stdin )
+import List ( isPrefixOf )
+import System.IO ( openBinaryFile, IOMode(AppendMode), hClose, hPutStrLn )
+import System.Directory ( removeFile )
+import SelectChanges (  promptChar )
+import Lock ( readBinFile, withTemp )
+import Printer ( hPutDocLn, text, wrap_text, ($$) )
hunk ./Tag.lhs 71
+                                            logfile, rmlogfile,
hunk ./Tag.lhs 73
-                                            pipe_interactive, verbose]}
+                                            pipe_interactive, verbose,
+                                             ask_long_comment]}
hunk ./Tag.lhs 82
-    name <- if (not . null) args
+    firstname <- if (not . null) args
hunk ./Tag.lhs 85
-    let mypatch = namepatch date name the_author [] null_patch
-        myinfo = patchinfo date name the_author []
+    (name, my_log) <- get_log opts firstname
+    let mypatch = namepatch date name the_author my_log null_patch
+        myinfo = patchinfo date name the_author my_log
hunk ./Tag.lhs 125
+\begin{options}
+--logfile
+\end{options}
+
+If you wish, you may specify the patch name and log using the
+\verb!--logfile! flag.  If you do so, the first line of the specified file
+will be taken to be the patch name, and the remainder will be the ``long
+comment''.  This feature can be especially handy if you have a test that
+fails several times on the record (thus aborting the record), so you don't
+have to type in the long comment multiple times. The file's contents will
+override the \verb!--patch-name! option.
+
+\begin{code}
+get_log :: [DarcsFlag] -> String  -> IO (String, [String])
+get_log opts oldname = gl opts
+    where patchname_specified (PatchName _:_) = True
+          patchname_specified (_:fs) = patchname_specified fs
+          patchname_specified [] = False
+          gl (Pipe:_) = do putStrLn "What is the log?"
+                           thelog <- lines `liftM` hGetContents stdin
+                           return (oldname, thelog)
+          gl (LogFile f:fs) =
+              do append_info f
+                 when (EditLongComment `elem` fs) $ do edit_file f
+                                                       return ()
+                 answer <- read_long_comment f
+                 when (RmLogFile `elem` opts) $
+                      removeFile f `catch` \_ -> return ()
+                 return answer
+          gl (EditLongComment:_) = actually_get_log
+          gl (NoEditLongComment:_) = return (oldname, [])
+          gl (PromptLongComment:_) = 
+              if patchname_specified opts
+              then return (oldname, [])
+              else do yorn <- promptChar
+                              "Do you want to add a long comment?" "yn"
+                      if yorn == 'y' then actually_get_log
+                                     else return (oldname, [])
+          gl (_:fs) = gl fs
+          gl [] = return (oldname, [])
+          actually_get_log = withTemp $ \f ->
+                             do append_info f
+                                edit_file f
+                                read_long_comment f
+          read_long_comment :: FilePath -> IO (String, [String])
+          read_long_comment f =
+              do t <- (lines.filter (/='\r')) `liftM` readBinFile f
+                 case t of [] -> return (oldname, [])
+                           (n:ls) -> return (n, takeWhile
+                                             (not.(eod `isPrefixOf`)) ls)
+          append_info f =
+              do ls <- (lines `liftM` readBinFile f) `catch` \_ -> return []
+                 h <- openBinaryFile f AppendMode
+                 when (ls == []) $ hPutStrLn h oldname
+                 hPutDocLn h $ text eod
+                            $$ text ""
+                            $$ wrap_text 75
+                               ("Place the long patch description above the "++
+                                eod++
+                                " marker.  The first line of this file "++
+                                "will be the patch name.")
+                            $$ text ""
+                 hClose h
+eod :: String
+eod = "***END OF DESCRIPTION***"
+\end{code}
+
}

Context:

[add two new changelog entries.
David Roundy <[EMAIL PROTECTED]>**20050910110115] 
[fix bug in resolve.pl test.
David Roundy <[EMAIL PROTECTED]>**20050910103833] 
[Change an rm_rf to a cleanup in tests/disable.pl
Ian Lynagh <[EMAIL PROTECTED]>**20050902024711] 
[make gzReadFileLazily close files sooner.
David Roundy <[EMAIL PROTECTED]>**20050827211253] 
[fix "No root path(s) specified at ..." testsuite problem.
David Roundy <[EMAIL PROTECTED]>**20050830121603] 
[add test that triggers "too many open files" bug.
David Roundy <[EMAIL PROTECTED]>**20050827192215
 We just need to pull over 1024 patches at once to trigger this bug on my
 linux system.
] 
[give better output on sftp errors.
David Roundy <[EMAIL PROTECTED]>**20050908125423] 
[make darcs not generate null binary patches when diffing.
David Roundy <[EMAIL PROTECTED]>**20050907125129] 
[make darcs able to eliminate null binary and hunk patches when coalescing.
David Roundy <[EMAIL PROTECTED]>**20050907125104] 
[add test that adding and removing binary files leaves no change.
David Roundy <[EMAIL PROTECTED]>**20050907122509] 
[fix some typos in comments
Conrad Parker <[EMAIL PROTECTED]>**20050904225715] 
[Make print_dry_run_message_and_exit print summaries if All and Summary.
David Roundy <[EMAIL PROTECTED]>**20050904125434
 This is a somewhat hokey way to make --all --summary print summary
 messages.
] 
[add changelog entry for configure script checking on darcs being present.
David Roundy <[EMAIL PROTECTED]>**20050905113258] 
[fix bug where we tried to run darcs when darcs wasn't present.
David Roundy <[EMAIL PROTECTED]>**20050905112935] 
[revert accidental directory name change in Test.
David Roundy <[EMAIL PROTECTED]>**20050904123424] 
[fix bug triggered by --no-pristine-tree and running test.
David Roundy <[EMAIL PROTECTED]>**20050903132055
 The trouble was that the NoPristine version of createPristineDirectoryTree
 would fail if the directory already exists, which isn't the intended
 behavior.  I also took this opportunity to remove the "stubbornly" function
 and replace some stubborn directory creation with
 createDirectoryIfMissing.
] 
[don't create test directory if we don't want to actually run test.
David Roundy <[EMAIL PROTECTED]>**20050903130722] 
[add test script that displays --no-pristine test-related bug.
David Roundy <[EMAIL PROTECTED]>**20050903132906] 
[add changelog entry for recent pristine bugfix.
David Roundy <[EMAIL PROTECTED]>**20050903134039] 
[clean up docs on flags directly to darcs (not to a darcs command).
David Roundy <[EMAIL PROTECTED]>**20050903124050] 
[bump version to 1.0.4rc1.
David Roundy <[EMAIL PROTECTED]>**20050903114002] 
[update the web page to direct new users first to the precompiled binaries rather than first to the source
[EMAIL PROTECTED] 
[TAG 1.0.4pre4
David Roundy <[EMAIL PROTECTED]>**20050901110418] 
Patch bundle hash:
696ccc9bd642521cb5e2846524df9d9307dcf1e4
_______________________________________________
darcs-devel mailing list
[email protected]
http://www.abridgegame.org/cgi-bin/mailman/listinfo/darcs-devel

Reply via email to