feat(sapling): add commit description field

This commit is contained in:
Jan De Dobbeleer 2023-03-05 15:07:39 +01:00 committed by Jan De Dobbeleer
parent 5ec65ab373
commit 5beac7b8fb
2 changed files with 20 additions and 16 deletions

View file

@ -40,17 +40,18 @@ func (s *SaplingStatus) add(code string) {
const ( const (
SAPLINGCOMMAND = "sl" SAPLINGCOMMAND = "sl"
SLCOMMITTEMPLATE = "no:{node}\nns:{sl_node}\nnd:{sl_date}\nun:{sl_user}\nbm:{activebookmark}" SLCOMMITTEMPLATE = "no:{node}\nns:{sl_node}\nnd:{sl_date}\nun:{sl_user}\nbm:{activebookmark}\ndn:{desc|firstline}"
) )
type Sapling struct { type Sapling struct {
scm scm
ShortHash string ShortHash string
Hash string Hash string
When string When string
Author string Author string
Bookmark string Bookmark string
Description string
Working *SaplingStatus Working *SaplingStatus
} }
@ -147,6 +148,8 @@ func (sl *Sapling) setCommitContext() {
sl.Author = line sl.Author = line
case "bm:": case "bm:":
sl.Bookmark = line sl.Bookmark = line
case "dn:":
sl.Description = line
} }
} }
} }

View file

@ -45,16 +45,17 @@ Display [sapling][sapling] information when in a sapling repository.
### Properties ### Properties
| Name | Type | Description | | Name | Type | Description |
| ------------ | --------------- | ------------------------------------- | | -------------- | --------------- | ------------------------------------------ |
| `.RepoName` | `string` | the repo folder name | | `.RepoName` | `string` | the repo folder name |
| `.Working` | `SaplingStatus` | changes in the worktree (see below) | | `.Working` | `SaplingStatus` | changes in the worktree (see below) |
| `.Author` | `string` | the author of the commit | | `.Description` | `string` | the first line of the commit's description |
| `.Hash` | `string` | the full hash of the commit | | `.Author` | `string` | the author of the commit |
| `.ShortHash` | `string` | the short hash of the commit | | `.Hash` | `string` | the full hash of the commit |
| `.When` | `string` | the commit's relative time indication | | `.ShortHash` | `string` | the short hash of the commit |
| `.Bookmark` | `string` | the commit's bookmark (if any) | | `.When` | `string` | the commit's relative time indication |
| `.Dir` | `string` | the repository's root directory | | `.Bookmark` | `string` | the commit's bookmark (if any) |
| `.Dir` | `string` | the repository's root directory |
### SaplingStatus ### SaplingStatus