Skip to content

Commit 1260ada

Browse files
committed
gh-pr-revision: new name
This commit renames the tool from `gh-revision` to `gh-pr-revision`. This is done because `pr` is a more natural namespace for the object that this tool introduces. Ideally we would like to have a CLI command `gh pr revision`. However, given that extensions cannot be put under a builtin command, we rename the tool to have something closer to the optimum. The repository will be renamed accordingly as well.
1 parent 3ec2596 commit 1260ada

File tree

8 files changed

+28
-26
lines changed

8 files changed

+28
-26
lines changed

.github/workflows/build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ jobs:
3232
- name: Build
3333
run: make build
3434
- name: Show version
35-
run: ./gh-revision --version
35+
run: ./gh-pr-revision --version

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ go.work.sum
2424
# env file
2525
.env
2626

27-
# gh-revision
28-
gh-revision
27+
# gh-pr-revision
28+
gh-pr-revision
2929
version.txt

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ build: version
1919

2020
.PHONY: clean
2121
clean:
22-
@rm -f gh-revision version.txt
22+
@rm -f gh-pr-revision version.txt

README.md

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# gh-revision
1+
# gh-pr-revision
22

33
A GitHub CLI extension for managing pull request revisions.
44

@@ -14,26 +14,26 @@ changes harder.
1414
To make incremental changes more visible and easier to track we decided to add pull
1515
request comments which summarize what was changed since the last review.
1616
To automate this process and add diff links to the previous revision the
17-
idea of `gh-revision` CLI extension was born.
17+
idea of `gh-pr-revision` CLI extension was born.
1818

1919
## Installation
2020

2121
To install the latest version of the extension use the following command:
2222

2323
```shell
24-
gh extension install hushsecurity/gh-revision
24+
gh extension install hushsecurity/gh-pr-revision
2525
```
2626

2727
## Synopsis
2828

2929
```shell
30-
gh revision --help
30+
gh pr-revision --help
3131
```
3232

3333
```text
3434
GitHub CLI extension for pull request revisions
3535
v0.0.1
36-
Usage: gh-revision <command> [<args>]
36+
Usage: gh-pr-revision <command> [<args>]
3737
3838
Options:
3939
--help, -h display this help and exit
@@ -50,21 +50,21 @@ Commands:
5050
To create a new revision make sure your pull request is `OPEN` and is not `Draft`.
5151

5252
```shell
53-
gh revision create
53+
gh pr-revision create
5454
```
5555

5656
This command assumes that the new revision is associated with the `HEAD` commit.
5757
If the pull request tip commit is not the local `HEAD` specify a commitish
5858
explicitly:
5959

6060
```shell
61-
gh revision create -c "<commitish>"
61+
gh pr-revision create -c "<commitish>"
6262
```
6363

6464
To attach a custom comment to the revision use `-e` to open your configured editor:
6565

6666
```shell
67-
gh revision create -e
67+
gh pr-revision create -e
6868
```
6969

7070
## Aliases
@@ -73,19 +73,21 @@ The name of the extension is relatively long. Therefore, it may be helpful to cr
7373
aliases as follows:
7474

7575
```shell
76-
gh alias set rvc 'revision create'
77-
gh alias set rvl 'revision list'
78-
gh alias set rvs 'revision show'
76+
gh alias set rvc 'pr-revision create'
77+
gh alias set rvl 'pr-revision list'
78+
gh alias set rvs 'pr-revision show'
7979
```
8080

8181
Now a new revision can be created with a shorter command `gh rvc -e`.
8282

8383
## Limitations
8484

85-
1. `gh-revision` stores some metadata in pull request comments. Subsequent revisions
86-
build on the metadata included in previous revisions. Hence, deletion of a *revision
87-
comment* may affect correctness of following revision comments.
85+
1. `gh-pr-revision` stores some metadata in pull request comments. Subsequent revisions
86+
build on the metadata included in previous revisions. Therefore, deletion of a
87+
revision comment may affect correctness of following revisions.
8888

89-
1. The size of a *revision comment* is limited by the max size of a
89+
1. The size of a revision comment is limited by the max size of a
9090
pull request comment allowed by GitHub. Therefore, if a pull request has a very
91-
long list of revisions creation of a new one may fail due to GitHub limitations.
91+
long list of revisions, creation of a new one may fail due to GitHub limitations.
92+
This is because every new revision contains 2 additional comparison urls that make
93+
the metadata bigger.

common.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ func addPrComment(path string) error {
8787
}
8888

8989
func editUserComment(ioStreams *iostreams.IOStreams) (string, error) {
90-
tmpFile, err := os.CreateTemp("", "gh-revision-user-comment.*.md")
90+
tmpFile, err := os.CreateTemp("", "gh-pr-revision-user-comment.*.md")
9191
if err != nil {
9292
return "", fmt.Errorf("failed to create temporary file: %v", err)
9393
}

create.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ func newPrComment(pr PullRequest, newRevision Revision, revisions []Revision) (p
142142
}
143143
fmt.Fprintf(&buf, "%s", encoded)
144144

145-
tmpFile, err := os.CreateTemp("", "gh-revision.*.md")
145+
tmpFile, err := os.CreateTemp("", "gh-pr-revision.*.md")
146146
if err != nil {
147147
return "", fmt.Errorf("failed to create temporary file: %v", err)
148148
}

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module github.com/hushsecurity/gh-revision
1+
module github.com/hushsecurity/gh-pr-revision
22

33
go 1.23.2
44

revision.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ import (
88
)
99

1010
const (
11-
mdPrefix = "[//]: # (gh-revision:"
11+
mdPrefix = "[//]: # (gh-pr-revision:"
1212
mdSuffix = ")"
13-
bodyStart = "[//]: # (gh-revision-body-start)"
14-
bodyEnd = "[//]: # (gh-revision-body-end)"
13+
bodyStart = "[//]: # (gh-pr-revision-body-start)"
14+
bodyEnd = "[//]: # (gh-pr-revision-body-end)"
1515
)
1616

1717
type Revision struct {

0 commit comments

Comments
 (0)