Skip to content

Commit 8047b87

Browse files
ADIX7JanDeDobbeleer
authored andcommitted
feat(jujutsu): closest bookmarks
1 parent 281424a commit 8047b87

2 files changed

Lines changed: 16 additions & 5 deletions

File tree

src/segments/jujutsu.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,16 @@ func (jj *Jujutsu) CacheKey() (string, bool) {
7070
return dir.Path, true
7171
}
7272

73+
func (jj *Jujutsu) ClosestBookmarks() string {
74+
statusString, err := jj.getJujutsuCommandOutput("log", "-r", "heads(::@ & bookmarks())", "--no-graph", "-T", "bookmarks")
75+
if err != nil {
76+
return ""
77+
}
78+
79+
lines := strings.Split(statusString, "\n")
80+
return lines[0]
81+
}
82+
7383
func (jj *Jujutsu) shouldDisplay(displayStatus bool) bool {
7484
jjdir, err := jj.env.HasParentFilePath(".jj", false)
7585
if err != nil {

website/docs/segments/scm/jujutsu.mdx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,18 @@ Set `status_formats` to `true` to enable fetching additional information (and po
4646
:::note default template
4747

4848
```template
49-
jj {{.ChangeID}}{{if .Working.Changed}} \uf044 {{ .Working.String }}{{ end }}
49+
\uf1fa{{.ChangeID}}{{if .Working.Changed}} \uf044 {{ .Working.String }}{{ end }}
5050
```
5151

5252
:::
5353

5454
### Properties
5555

56-
| Name | Type | Description |
57-
| ----------- | -------- | -------------------------------------------------------------------------------------------- |
58-
| `.Working` | `Status` | changes in the working copy (see below) |
59-
| `.ChangeID` | `string` | The shortest unique prefix of the working copy change that's at least change_id_min_len long |
56+
| Name | Type | Description |
57+
| ------------------- | -------- | -------------------------------------------------------------------------------------------- |
58+
| `.Working` | `Status` | changes in the working copy (see below) |
59+
| `.ChangeID` | `string` | The shortest unique prefix of the working copy change that's at least change_id_min_len long |
60+
| `.ClosestBookmarks` | `string` | Closest bookmark(s) on ancestors |
6061

6162
### Status
6263

0 commit comments

Comments
 (0)