Forgot to record new files!
This commit is contained in:
parent
974eabf27d
commit
5e2ac28c30
2 changed files with 108 additions and 0 deletions
63
src/Vervis/Patch.hs
Normal file
63
src/Vervis/Patch.hs
Normal file
|
@ -0,0 +1,63 @@
|
|||
{- This file is part of Vervis.
|
||||
-
|
||||
- Written in 2018 by fr33domlover <fr33domlover@riseup.net>.
|
||||
-
|
||||
- ♡ Copying is an act of love. Please copy, reuse and share.
|
||||
-
|
||||
- The author(s) have dedicated all copyright and related and neighboring
|
||||
- rights to this software to the public domain worldwide. This software is
|
||||
- distributed without any warranty.
|
||||
-
|
||||
- You should have received a copy of the CC0 Public Domain Dedication along
|
||||
- with this software. If not, see
|
||||
- <http://creativecommons.org/publicdomain/zero/1.0/>.
|
||||
-}
|
||||
|
||||
-- | Representation of commit in a repo for viewing.
|
||||
--
|
||||
-- Each version control system has its own specific details of how repository
|
||||
-- changes are represented and encoded and stored internally. This module is
|
||||
-- merely a model for displaying a commit to a human viewer.
|
||||
module Vervis.Patch
|
||||
( Hunk (..)
|
||||
, Edit (..)
|
||||
, Patch (..)
|
||||
)
|
||||
where
|
||||
|
||||
import Prelude
|
||||
|
||||
import Data.Int (Int64)
|
||||
import Data.Text (Text)
|
||||
import Data.Time.Clock (UTCTime)
|
||||
import Data.Word (Word32)
|
||||
import Text.Email.Validate (EmailAddress)
|
||||
|
||||
data Hunk = Hunk
|
||||
{ hunkContextBefore :: [Text]
|
||||
, hunkLineNumber :: Int
|
||||
, hunkOldLines :: [Text]
|
||||
, hunkNewLines :: [Text]
|
||||
, hunkContextAfter :: [Text]
|
||||
}
|
||||
|
||||
data Edit
|
||||
= AddTextFile FilePath Word32 [Text]
|
||||
| AddBinaryFile FilePath Word32 Int64
|
||||
| RemoveTextFile FilePath Word32 [Text]
|
||||
| RemoveBinaryFile FilePath Word32 Int64
|
||||
| MoveFile FilePath Word32 FilePath Word32
|
||||
| ChmodFile FilePath Word32 Word32
|
||||
| EditTextFile FilePath [Hunk] Word32 Word32
|
||||
| EditBinaryFile FilePath Int64 Word32 Int64 Word32
|
||||
| TextToBinary FilePath [Text] Word32 Int64 Word32
|
||||
| BinaryToText FilePath Int64 Word32 [Text] Word32
|
||||
|
||||
data Patch = Patch
|
||||
{ patchAuthorName :: Text
|
||||
, patchAuthorEmail :: EmailAddress
|
||||
, patchTime :: UTCTime
|
||||
, patchTitle :: Text
|
||||
, patchDescription :: Text
|
||||
, patchDiff :: [Edit]
|
||||
}
|
45
templates/repo/patch.hamlet
Normal file
45
templates/repo/patch.hamlet
Normal file
|
@ -0,0 +1,45 @@
|
|||
$# This file is part of Vervis.
|
||||
$#
|
||||
$# Written in 2018 by fr33domlover <fr33domlover@riseup.net>.
|
||||
$#
|
||||
$# ♡ Copying is an act of love. Please copy, reuse and share.
|
||||
$#
|
||||
$# The author(s) have dedicated all copyright and related and neighboring
|
||||
$# rights to this software to the public domain worldwide. This software is
|
||||
$# distributed without any warranty.
|
||||
$#
|
||||
$# You should have received a copy of the CC0 Public Domain Dedication along
|
||||
$# with this software. If not, see
|
||||
$# <http://creativecommons.org/publicdomain/zero/1.0/>.
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>By
|
||||
<td>
|
||||
$maybe sharer <- msharer
|
||||
^{personLinkW sharer}
|
||||
$nothing
|
||||
#{patchAuthorName patch}
|
||||
<tr>
|
||||
<td>At
|
||||
<td>#{showDate $ patchTime patch}
|
||||
<tr>
|
||||
<td>Title
|
||||
<td>{#patchTitle patch}
|
||||
<tr>
|
||||
<td>Description
|
||||
<td>
|
||||
<p>#{patchDescription patch}
|
||||
|
||||
$if null parents
|
||||
<p>TODO display patch diff here
|
||||
$else
|
||||
<p>
|
||||
This commit has multiple parents, and to be honest, I'm unsure how exactly
|
||||
to decide against which one to run the diff. Do I just pick the first
|
||||
parent? Or otherwise somehow detect which one is the right one? Advice is
|
||||
very welcome. For now, to help me find and observe such cases, I'm just
|
||||
listing here the parents of the commit:
|
||||
<ol>
|
||||
$forall parent <- parents
|
||||
<li>#{parent}
|
Loading…
Reference in a new issue