Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- guessChangeLog :: FilePath -> FilePath -> IO GuessedChangeLog
- data GuessedChangeLog
Documentation
guessChangeLog :: FilePath -> FilePath -> IO GuessedChangeLog Source #
Automatically guess the differences between to releases of a package by looking at the change log file provided by upstream. The function as arguments the paths of two directories that contain the extracted release tarballs. The first arguments ought to point to the older release, the second paths ought to point to the updated version.
The function uses the following algorithm to detect the relevant changes:
- Scan both directories for files that look like they might be change logs.
- If both directories contain the same candidate file, e.g.
ChangeLog
, then use that. - Compute the differences between the change log files and check that all modifications are additions at the top of the file.
- Return those additions as
Text
.
data GuessedChangeLog Source #
GuessedChangeLog FilePath Text | Both releases contained the given change log file, and these files differed so that the given text was added at the top of the new one. The text undergoes some amount of cleanup, i.e. we'll trim leading empty lines at the top, trailing whitespace, and trailing empty lines at the end. |
NoChangeLogFiles | Neither release contains a change log file. |
UndocumentedUpdate FilePath | A change log file exists (and its name is returned), but it's identical in both releases. In other words, upstream probably forgot to document the release. |
NoCommonChangeLogFiles (Set FilePath) (Set FilePath) | Both releases contain a set of files that look like they might be a change log, but their intersection is empty! This happens, for example, when upstream has renamed the file. |
MoreThanOneChangeLogFile (Set FilePath) | Multiple change log files exists in both directories. Now, it would probably work out okay if we'd just look at the diffs of both of them, respectively, but it felt like a good idea to err on the side of caution. This case is rare anyways. |
UnmodifiedTopIsTooLarge FilePath Word |
|
NotJustTopAdditions FilePath | This happens when upstream edits the file in ways other than just adding at the top. Sometimes people re-format old entries or rewrite URLs or fix typos, and in such a case it feels to risky to trust the diff. |
Instances
Show GuessedChangeLog Source # | |
Defined in OpenSuse.GuessChangeLog showsPrec :: Int -> GuessedChangeLog -> ShowS # show :: GuessedChangeLog -> String # showList :: [GuessedChangeLog] -> ShowS # |