tools: fix up the releasestats make rule
This commit is contained in:
		
							parent
							
								
									f0890a9281
								
							
						
					
					
						commit
						d0efde5429
					
				
							
								
								
									
										56
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										56
									
								
								Makefile
									
									
									
									
									
								
							| @ -727,12 +727,26 @@ pushbinary: | |||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| # show project stats useful for release notes
 | # show project stats useful for release notes
 | ||||||
| stats: showlastreleasedate showreleaseauthors showloc showcov showunpushedchanges showunreleasedchanges #simplebench #showerrors
 | releasestats: \ | ||||||
|  | 	showreleasedays \
 | ||||||
|  | 	showunreleasedchangecount \
 | ||||||
|  | 	showloc \
 | ||||||
|  | 	showtestcount \
 | ||||||
|  | 	showunittestcoverage \
 | ||||||
|  | 	showreleaseauthors \
 | ||||||
|  | 	showunreleasedcodechanges \
 | ||||||
|  | 	showunpushedchanges | ||||||
|  | #	simplebench
 | ||||||
|  | #	showerrors
 | ||||||
| 
 | 
 | ||||||
| # ghci> let (d1,d2) = ("2010/12/06","2011/04/17") in diffDays (parsedate d2) (parsedate d1)
 | showreleasedays: | ||||||
| showlastreleasedate: | 	@echo Days since last release: | ||||||
| 	@echo Last release date: | 	@tools/dayssincerelease.hs | head -1 | cut -d' ' -f-1 | ||||||
| 	@darcs changes --from-tag . | tail -2 | 	@echo | ||||||
|  | 
 | ||||||
|  | showunreleasedchangecount: | ||||||
|  | 	@echo Commits since last release: | ||||||
|  | 	@darcs changes --from-tag . --count | ||||||
| 	@echo | 	@echo | ||||||
| 
 | 
 | ||||||
| showreleaseauthors: | showreleaseauthors: | ||||||
| @ -741,32 +755,40 @@ showreleaseauthors: | |||||||
| 	@echo | 	@echo | ||||||
| 
 | 
 | ||||||
| showloc: | showloc: | ||||||
| 	@echo Lines of code including tests: | 	@echo Current lines of code including tests: | ||||||
| 	@sloccount `ls $(SOURCEFILES)` | grep haskell: | 	@sloccount `ls $(SOURCEFILES)` | grep haskell: | ||||||
| 	@echo | 	@echo | ||||||
| 
 | 
 | ||||||
| showcov: hledgercov | showtestcount: | ||||||
| 	@echo Test coverage: | 	@echo "Unit tests:" | ||||||
| 	@tools/coverage report test | 	@hledger test 2>&1 | cut -d' ' -f2 | ||||||
|  | 	@echo "Functional tests:" | ||||||
|  | 	@make --no-print functest | egrep '^ Total' | awk '{print $$2}' | ||||||
|  | 	@echo | ||||||
|  | 
 | ||||||
|  | showunittestcoverage: | ||||||
|  | 	@echo Unit test coverage: | ||||||
|  | 	@make --no-print quickcoverage | grep 'expressions' | ||||||
|  | 	@echo | ||||||
| 
 | 
 | ||||||
| # showerrors:
 | # showerrors:
 | ||||||
| # 	@echo Known errors:
 | # 	@echo Known errors:
 | ||||||
| # 	@awk '/^** errors/, /^** / && !/^** errors/' NOTES | grep '^\*\*\* ' | tail +1
 | # 	@awk '/^** errors/, /^** / && !/^** errors/' NOTES | grep '^\*\*\* ' | tail +1
 | ||||||
| # 	@echo
 | # 	@echo
 | ||||||
| 
 | 
 | ||||||
| showunpushedchanges: | showunpushedchanges unpushed: | ||||||
| 	@echo Local changes: | 	@echo "Changes not yet pushed upstream (to `darcs show repo | grep 'Default Remote' | cut -c 17-`):" | ||||||
| 	@-darcs push simon@joyful.com:/repos/hledger --dry-run | grep '*' | tac | 	@-darcs push simon@joyful.com:/repos/hledger --dry-run | grep '*' | tac | ||||||
| 	@echo | 	@echo | ||||||
| 
 | 
 | ||||||
| showcodechanges: | showunreleasedcodechanges unreleased: | ||||||
| 	@echo Code changes: | 	@echo "hledger code changes since last release:" | ||||||
| 	@darcs changes --matches "not (name docs: or name site: or name tools:)" | egrep '^ +(\*|tagged)' | 	@darcs changes --from-tag . --matches "not (name docs: or name doc: or name site: or name tools:)" | grep '*' | ||||||
| 	@echo | 	@echo | ||||||
| 
 | 
 | ||||||
| showunreleasedchanges: | showcodechanges: | ||||||
| 	@echo "Feature/bugfix changes since last release: ("`darcs changes --from-tag . --count`")" | 	@echo "hledger code changes:" | ||||||
| 	@darcs changes --from-tag . --matches "not (name docs: or name doc: or name site: or name tools:)" | grep '*' | 	@darcs changes --matches "not (name docs: or name site: or name tools:)" | egrep '^ +(\*|tagged)' | ||||||
| 	@echo | 	@echo | ||||||
| 
 | 
 | ||||||
| ######################################################################
 | ######################################################################
 | ||||||
|  | |||||||
							
								
								
									
										21
									
								
								tools/dayssincerelease.hs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								tools/dayssincerelease.hs
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,21 @@ | |||||||
|  | #!/usr/bin/env runhaskell | ||||||
|  | {- | ||||||
|  | Display the current darcs repository's last tag and the number of days since. | ||||||
|  | Similar to: | ||||||
|  | $ darcs changes --to-tag . --from-tag .|head -n 1 |cut -d' ' -f-7 |xargs -I {} date -d "{}" +%s |xargs -I {} expr \( $(date +%s) - {} \) / 60 / 60 / 24 | ||||||
|  | -} | ||||||
|  | import Data.Time | ||||||
|  | import System.Locale | ||||||
|  | import System.Process | ||||||
|  | 
 | ||||||
|  | main = do | ||||||
|  |   s <- readProcess "darcs" ["changes","--from-tag",".","--to-tag","."] "" | ||||||
|  |   let datestr = unwords $ take 6 $ words $ head $ lines s | ||||||
|  |       date = readTime defaultTimeLocale "%a %b %e %H:%M:%S %Z %Y" datestr :: Day | ||||||
|  |   today <- getCurrentDay | ||||||
|  |   putStrLn $ show (diffDays today date) ++ " days since the last tag:\n" | ||||||
|  |   putStr s | ||||||
|  | 
 | ||||||
|  | getCurrentDay = do | ||||||
|  |     t <- getZonedTime | ||||||
|  |     return $ localDay (zonedTimeToLocalTime t) | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user