mirror of
https://github.com/simonmichael/hledger.git
synced 2024-12-26 20:02:27 +03:00
;shake changelogs: make it more robust; add a newline
This commit is contained in:
parent
1a924f3a16
commit
25d76a7795
15
Shake.hs
15
Shake.hs
@ -553,7 +553,7 @@ main = do
|
|||||||
|
|
||||||
-- git log formats suitable for changelogs/release notes
|
-- git log formats suitable for changelogs/release notes
|
||||||
-- %s=subject, %an=author name, %n=newline if needed, %w=width/indent1/indent2, %b=body, %h=hash
|
-- %s=subject, %an=author name, %n=newline if needed, %w=width/indent1/indent2, %b=body, %h=hash
|
||||||
changelogGitFormat = "--pretty=format:'- %s (%an)%n%w(0,2,2)%b'"
|
changelogGitFormat = "--pretty=format:'- %s (%an)%n%w(0,2,2)%b\n'"
|
||||||
-- changelogVerboseGitFormat = "--pretty=format:'- %s (%an)%n%w(0,2,2)%b%h' --stat"
|
-- changelogVerboseGitFormat = "--pretty=format:'- %s (%an)%n%w(0,2,2)%b%h' --stat"
|
||||||
|
|
||||||
-- Format a git log message, with one of the formats above, as a changelog item
|
-- Format a git log message, with one of the formats above, as a changelog item
|
||||||
@ -605,7 +605,7 @@ main = do
|
|||||||
-- the package version looks like a release version, otherwise
|
-- the package version looks like a release version, otherwise
|
||||||
-- a dev heading with the current HEAD revision.
|
-- a dev heading with the current HEAD revision.
|
||||||
--
|
--
|
||||||
-- With --dry-run, print new content to stdout instead of
|
-- With -n/--dry-run, print new content to stdout instead of
|
||||||
-- updating the changelog.
|
-- updating the changelog.
|
||||||
--
|
--
|
||||||
phonys (\out -> if
|
phonys (\out -> if
|
||||||
@ -624,10 +624,13 @@ main = do
|
|||||||
err = error $ "could not parse a version in "++versionfile
|
err = error $ "could not parse a version in "++versionfile
|
||||||
in (liftIO $ headDef err . words <$> readFileStrictly versionfile)
|
in (liftIO $ headDef err . words <$> readFileStrictly versionfile)
|
||||||
let
|
let
|
||||||
pkg | dir=="." = Nothing
|
mpkg | dir=="." = Nothing
|
||||||
| otherwise = Just dir
|
| otherwise = Just dir
|
||||||
gitlogpaths = fromMaybe projectChangelogExcludeDirs pkg
|
gitlogpaths = fromMaybe projectChangelogExcludeDirs mpkg
|
||||||
lastrev = changelogversion
|
maybeTagName versionorhash
|
||||||
|
| isReleaseVersion versionorhash = maybe versionorhash (++("-"++versionorhash)) mpkg
|
||||||
|
| otherwise = versionorhash
|
||||||
|
lastrev = maybeTagName changelogversion
|
||||||
headrev <- unwords . words . fromStdout <$>
|
headrev <- unwords . words . fromStdout <$>
|
||||||
(cmd Shell gitlog "-1 --pretty=%h -- " gitlogpaths :: Action (Stdout String))
|
(cmd Shell gitlog "-1 --pretty=%h -- " gitlogpaths :: Action (Stdout String))
|
||||||
let excludeboring = "--invert-grep --grep '^;'" -- ignore commits beginning with ;
|
let excludeboring = "--invert-grep --grep '^;'" -- ignore commits beginning with ;
|
||||||
@ -638,7 +641,7 @@ main = do
|
|||||||
|
|
||||||
let
|
let
|
||||||
(newrev, newheading)
|
(newrev, newheading)
|
||||||
| isReleaseVersion packageversion = (packageversion, unwords [packageversion, show date])
|
| isReleaseVersion packageversion = (maybeTagName packageversion, unwords [packageversion, show date])
|
||||||
| otherwise = (headrev, headrev)
|
| otherwise = (headrev, headrev)
|
||||||
newcontent = "# "++newheading++"\n\n" ++ newitems
|
newcontent = "# "++newheading++"\n\n" ++ newitems
|
||||||
newchangelog = unlines $ concat [
|
newchangelog = unlines $ concat [
|
||||||
|
Loading…
Reference in New Issue
Block a user