sugarjar 2.0.0.beta.1 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +161 -0
- data/CONTRIBUTING.md +37 -0
- data/README.md +113 -187
- data/examples/sample_config.yaml +24 -0
- data/examples/sample_repoconfig.yaml +77 -0
- data/lib/sugarjar/commands/amend.rb +17 -0
- data/lib/sugarjar/commands/bclean.rb +118 -0
- data/lib/sugarjar/commands/branch.rb +42 -0
- data/lib/sugarjar/commands/checks.rb +139 -0
- data/lib/sugarjar/commands/debuginfo.rb +16 -0
- data/lib/sugarjar/commands/feature.rb +35 -0
- data/lib/sugarjar/commands/pullsuggestions.rb +48 -0
- data/lib/sugarjar/commands/push.rb +66 -0
- data/lib/sugarjar/commands/smartclone.rb +30 -0
- data/lib/sugarjar/commands/smartpullrequest.rb +101 -0
- data/lib/sugarjar/commands/up.rb +103 -0
- data/lib/sugarjar/commands.rb +284 -5
- data/lib/sugarjar/repoconfig.rb +2 -4
- data/lib/sugarjar/util.rb +20 -309
- data/lib/sugarjar/version.rb +1 -1
- data/sugarjar.gemspec +11 -5
- metadata +26 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f79105e6ffa39ec2c1cdabd741fef41249e031ebe17d0cd5d0fbf4c3691ef4d7
|
4
|
+
data.tar.gz: 4a8fbf1f68268e9e0ffcee9dcbbd74d3e906ce3bb28aa278424f5959d377593b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b910f580bf32c0dc88ba7c5504c2e2e14954ae599b29d4e6206aee050cea16b10c881ed44e511c3c86be7b019fc28248f844214e0c8a3f0c236a0718211b7c3
|
7
|
+
data.tar.gz: 5b3d5b5bf7c12ca23dec569b7a5f9161494349412fd5eba4f1572dfd0f37cc2f6c2036a7b799b0cb5861c4b18aeb80960a059a5baa3de3bea48656a4115116b5
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,161 @@
|
|
1
|
+
# SugarJar Changelog
|
2
|
+
|
3
|
+
## 2.0.1 (2025-05-12)
|
4
|
+
|
5
|
+
* Fix gemspec to include new library files
|
6
|
+
|
7
|
+
## 2.0.0 (2025-05-11)
|
8
|
+
|
9
|
+
* Fix smartlog when on detached head
|
10
|
+
* Drop support for `hub`, and thus also `fallthru` mode
|
11
|
+
* Fix GHE handling when using `gh`
|
12
|
+
* Support `github_host` and `github_user` in repoconfig
|
13
|
+
* Replace `version` subcommand with `debuginfo` subcommand (`--version` still
|
14
|
+
exists)
|
15
|
+
* `smartclone`: set upstream for main branch to upstream remote when applicable
|
16
|
+
* Warn when deprecated options found in config file
|
17
|
+
* Fix handling of `--color` in some cornercases
|
18
|
+
* `subfeature` PRs: Fix bug where we would incorrectly deterine base branch
|
19
|
+
* Checks: Fix bug where we would lint even if repo was dirty causing confusing
|
20
|
+
output
|
21
|
+
* `feature` prefixes: Fix bug where we didn't look for the prefix on the base
|
22
|
+
branch when specified
|
23
|
+
* Better handle creating PRs to branches other than "main"
|
24
|
+
* Significantly improve unittest coverage
|
25
|
+
* Bump required Ruby to 3.2
|
26
|
+
|
27
|
+
## 1.1.3 (2025-02-20)
|
28
|
+
|
29
|
+
* smartpullrequest: When working with `gh`, bypass its attempt to push,
|
30
|
+
bypassing unnecessary prompts and branch track mangling
|
31
|
+
* smartpullrequest: Better support for autofill
|
32
|
+
* smartpullrequest: Don't attempt to stack when in forked repo
|
33
|
+
|
34
|
+
## 1.1.2 (2024-04-25)
|
35
|
+
|
36
|
+
* Add support for 'subfeatures'
|
37
|
+
* Add support for building stacked PRs based on 'subfeatures'
|
38
|
+
* smartpullrequest: only autofill in the PR when a single commit exists between
|
39
|
+
the base and us
|
40
|
+
* smartpullrequest: Add `--fill` option to let people opt-out of autofilling the
|
41
|
+
PR
|
42
|
+
* smartpullrequest: State that we're autofilling the PR when we do
|
43
|
+
* feature: Fix some corner cases where feature-prefixing didn't work
|
44
|
+
* pullsuggestions: Print the diff in the correct order
|
45
|
+
* feature/subfeature: set tracked branch for the user
|
46
|
+
* subfeature: automatically update tracked branch when previous tracked branch
|
47
|
+
disappears
|
48
|
+
|
49
|
+
## 1.1.1 (2024-02-12)
|
50
|
+
|
51
|
+
* Relax ruby requirements to allow for easier packaging
|
52
|
+
* Handle aborted rebases better
|
53
|
+
* Add bash-completion script
|
54
|
+
* Various doc updates
|
55
|
+
|
56
|
+
## 1.1.0 (2023-12-31)
|
57
|
+
|
58
|
+
* Fix include path for unittests for downstream packagers
|
59
|
+
* Bump ruby min versions
|
60
|
+
* Include Gemfile.lock for downstream packagers
|
61
|
+
|
62
|
+
## 1.0.1 (2023-12-20)
|
63
|
+
|
64
|
+
* `co` support for featureprefix
|
65
|
+
* Add `include_from` and `overwrite_from` support to repoconfig
|
66
|
+
* Support relative paths for lints/units
|
67
|
+
* `smartpr` now uses `--fill`
|
68
|
+
|
69
|
+
## 1.0.0 (2023-10-22)
|
70
|
+
|
71
|
+
* Add new "feature prefix" feature
|
72
|
+
* Implement `auto` setting for `github_cli`, default to `gh`
|
73
|
+
* Point people to Sapling
|
74
|
+
* Handle `sclone` of repos in personal orgs
|
75
|
+
* Better error when a subcommand isn't specified
|
76
|
+
* Various documentation fixes
|
77
|
+
|
78
|
+
## 0.0.11 (2022-10-06)
|
79
|
+
|
80
|
+
* Properly handle slashes in branch names (closes #101)
|
81
|
+
* Support for running a command to determine checks (linters, units) to run
|
82
|
+
* Support for using `gh` CLI instead of `hub` (experimental)
|
83
|
+
* Add new `pullsuggestions` command to pull in (accepted) suggestions from a
|
84
|
+
GitHub code review.
|
85
|
+
* Detect mismatched primary branch names to assist with projects changing from
|
86
|
+
`master` to `main`
|
87
|
+
|
88
|
+
## 0.0.10 (2021-12-06)
|
89
|
+
|
90
|
+
* Support 'main' as a default/primary branch
|
91
|
+
* Fix doc errors
|
92
|
+
* Handle rebase failures more gracefully, give users hints (closes #88)
|
93
|
+
* Handle SAML errors better (closes #95)
|
94
|
+
* Don't parse option args as subcommands (closes #89)
|
95
|
+
|
96
|
+
## 0.0.9 (2021-02-20)
|
97
|
+
|
98
|
+
* Fix smartclone not honoring `--github-host`
|
99
|
+
* Use SSH protocol by default on short repo names
|
100
|
+
* Handle anonymous auth failures gracefully
|
101
|
+
* Better support for autocorrecting linters
|
102
|
+
|
103
|
+
## 0.0.8 (2020-12-16)
|
104
|
+
|
105
|
+
* Colorize and simplify output
|
106
|
+
* New smartlog feature
|
107
|
+
* Doc fixes
|
108
|
+
|
109
|
+
## 0.0.7 (2020-11-23)
|
110
|
+
|
111
|
+
* Add new command `smartpullrequest` (or `smartpr` or `spr`) for creating
|
112
|
+
pull requests (closes #51)
|
113
|
+
* Add checks for dirty repos before `smartpush`, `forcepush`, and
|
114
|
+
`smartpullrequest`
|
115
|
+
* Add `--ignore-dirty` and `--ignore-prerun-failure` options
|
116
|
+
* Handle when git prompts for a username (closes #52)
|
117
|
+
* Always use SSH for the forked remote (closes #56)
|
118
|
+
* Better handling of various forms of repo URLs
|
119
|
+
* Fix typo of `version` in help message
|
120
|
+
* Fix typos in `README.md`
|
121
|
+
|
122
|
+
## 0.0.6 (2020-07-05)
|
123
|
+
|
124
|
+
* Add automatic commit template configuration (closes #38)
|
125
|
+
* bcleanall: Return to reasonable branch (fixes #37)
|
126
|
+
* Handle case where `hub` has no auth token (fixes #39)
|
127
|
+
* Fix crash in `smartclone`
|
128
|
+
* Improve logging
|
129
|
+
* Fix `sj unit` running lints instead of units
|
130
|
+
|
131
|
+
## 0.0.5 (2020-06-24)
|
132
|
+
|
133
|
+
* Fix global config file handling
|
134
|
+
* Better logging around lint/unit failuers
|
135
|
+
* Handle incorrect tracked branches better
|
136
|
+
|
137
|
+
## 0.0.4 (2020-06-17)
|
138
|
+
|
139
|
+
* Fix gemspec to include executables
|
140
|
+
* Add support for building omnibus releases
|
141
|
+
|
142
|
+
## 0.0.3 (2020-06-08)
|
143
|
+
|
144
|
+
* Stop rescuing NoMethodError (fixing a variety of confusing error cases)
|
145
|
+
* Fix crash when no `on_push` entry is in repo config
|
146
|
+
* Document contribution process (`CONTRIBUTING.md`)
|
147
|
+
* Document code of conduct (`CODE_OF_CONDUCT.md`)
|
148
|
+
|
149
|
+
## 0.0.2 (2020-06-06)
|
150
|
+
|
151
|
+
* Fix 'co' not accepting multiple arguments/options
|
152
|
+
* Fix README typos (#10, #11)
|
153
|
+
* Don't assume the ruby to run under
|
154
|
+
* Don't crash when no subcommands are passed in
|
155
|
+
* Don't assume paths (e.g. for hub, git)
|
156
|
+
* Fix crash for unknown method
|
157
|
+
* fix handling of empty config files
|
158
|
+
|
159
|
+
## 0.0.1 (2020-06-05)
|
160
|
+
|
161
|
+
* Initial release
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# Contributing to SugarJar
|
2
|
+
|
3
|
+
We welcome contributions! Contributions come in a variety of forms: clear bug
|
4
|
+
reports, code, or spreading the word about this project.
|
5
|
+
|
6
|
+
If you'd like to contribute code, here's how.
|
7
|
+
|
8
|
+
Simply use SugarJar to make a fork and setup your repo:
|
9
|
+
|
10
|
+
```shell
|
11
|
+
sj sclone jaymzh/sugarjar
|
12
|
+
```
|
13
|
+
|
14
|
+
Make a branch for your change:
|
15
|
+
|
16
|
+
```shell
|
17
|
+
sj feature mychange
|
18
|
+
```
|
19
|
+
|
20
|
+
Make whatever changes you want, commit with a clear commit message, and a DCO.
|
21
|
+
|
22
|
+
We require [Developer Certificate of Origin
|
23
|
+
(DCO)](https://developercertificate.org/) via a 'signed-off-by:` line in your
|
24
|
+
commit (the `git commit -s` does this for you). The Chef community has a lot of
|
25
|
+
great documentation on this which you can find
|
26
|
+
[here](https://docs.chef.io/community_contributions/#developer-certification-of-origin-dco).
|
27
|
+
|
28
|
+
```shell
|
29
|
+
git commit -as
|
30
|
+
```
|
31
|
+
|
32
|
+
Make a pull request:
|
33
|
+
|
34
|
+
```shell
|
35
|
+
sj spush
|
36
|
+
sj pull-request
|
37
|
+
```
|
data/README.md
CHANGED
@@ -18,29 +18,30 @@ If you miss Mondrian or Phabricator - this is the tool for you!
|
|
18
18
|
|
19
19
|
If you don't, there's a ton of useful stuff for everyone!
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
[
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
21
|
+
Jump to what you're most interested in:
|
22
|
+
|
23
|
+
* [Common Use-cases](#common-use-cases)
|
24
|
+
* [Auto Cleanup Squash-merged branches](#auto-cleanup-squash-merged-branches)
|
25
|
+
* [Smarter clones and remotes](#smarter-clones-and-remotes)
|
26
|
+
* [Work with stacked branches more easily](#work-with-stacked-branches-more-easily)
|
27
|
+
* [Creating Stacked PRs with subfeatures](#creating-stacked-prs-with-subfeatures)
|
28
|
+
* [Have a better lint/unittest experience!](#have-a-better-lintunittest-experience)
|
29
|
+
* [Better push defaults](#better-push-defaults)
|
30
|
+
* [Cleaning up your own history](#cleaning-up-your-own-history)
|
31
|
+
* [Better feature branches](#better-feature-branches)
|
32
|
+
* [Smartlog](#smartlog)
|
33
|
+
* [Pulling in suggestions from the web](#pulling-in-suggestions-from-the-web)
|
34
|
+
* [And more!](#and-more)
|
35
|
+
* [Installation](#installation)
|
36
|
+
* [Configuration](#configuration)
|
37
|
+
* [Repository Configuration](#repository-configuration)
|
38
|
+
* [Commit Templates](#commit-templates)
|
39
|
+
* [Enterprise GitHub](#enterprise-github)
|
40
|
+
* [FAQ](#faq)
|
41
|
+
|
42
|
+
## Common Use-cases
|
43
|
+
|
44
|
+
### Auto cleanup squash-merged branches
|
44
45
|
|
45
46
|
It is common for a PR to go back and forth with a variety of nits, lint fixes,
|
46
47
|
typos, etc. that can muddy history. So many projects will "squash and merge"
|
@@ -52,9 +53,7 @@ forces the deletion.
|
|
52
53
|
Enter `sj bclean` - it determines if the contents of your branch has been merge
|
53
54
|
and safely deletes if so.
|
54
55
|
|
55
|
-
|
56
|
-
sj bclean
|
57
|
-
```
|
56
|
+

|
58
57
|
|
59
58
|
Will delete a branch, if it has been merged, **even if it was squash-merged**.
|
60
59
|
|
@@ -64,44 +63,32 @@ You can pass it a branch if you'd like (it defaults to the branch you're on):
|
|
64
63
|
But it gets better! You can use `sj bcleanall` to remove all branches that have
|
65
64
|
been merged:
|
66
65
|
|
67
|
-
|
68
|
-
$ git branch
|
69
|
-
* argparse
|
70
|
-
master
|
71
|
-
feature
|
72
|
-
hubhost
|
73
|
-
$ git bcleanall
|
74
|
-
Skipping branch argparse - there are unmerged commits
|
75
|
-
Reaped branch feature
|
76
|
-
Reaped branch hubhost
|
77
|
-
```
|
66
|
+

|
78
67
|
|
79
|
-
|
68
|
+
### Smarter clones and remotes
|
80
69
|
|
81
70
|
There's a pattern to every new repo we want to contribute to. First we fork,
|
82
71
|
then we clone the fork, then we add a remote of the upstream repo. It's
|
83
72
|
monotonous. SugarJar does this for you:
|
84
73
|
|
85
|
-
|
86
|
-
sj smartclone jaymzh/sugarjar
|
87
|
-
```
|
74
|
+

|
88
75
|
|
89
|
-
|
76
|
+
`sj` accepts both `smartclone` and `sclone` for this command.
|
90
77
|
|
91
78
|
This will:
|
92
79
|
|
93
|
-
*
|
80
|
+
* Fork the repo to your personal org (if you don't already have a fork)
|
94
81
|
* Clone your fork
|
95
82
|
* Add the original as an 'upstream' remote
|
96
83
|
|
97
84
|
Note that it takes short names for repos. No need to specify a full URL,
|
98
85
|
just a $org/$repo.
|
99
86
|
|
100
|
-
Like `git clone`, `sj
|
87
|
+
Like `git clone`, `sj smartclone` will accept an additional argument as the
|
101
88
|
destination directory to clone to. It will also pass any other unknown options
|
102
89
|
to `git clone` under the hood.
|
103
90
|
|
104
|
-
|
91
|
+
### Work with stacked branches more easily
|
105
92
|
|
106
93
|
It's important to break changes into reviewable chunks, but working with
|
107
94
|
stacked branches can be confusing. SugarJar provides several tools to make this
|
@@ -111,122 +98,75 @@ First, and foremost, is `feature` and `subfeature`. Regardless of stacking, the
|
|
111
98
|
way to create a new feature bracnh with sugarjar is with `sj feature` (or `sj
|
112
99
|
f` for short):
|
113
100
|
|
114
|
-
|
115
|
-
$ sj feature mynewthing
|
116
|
-
Created feature branch mynewthing based on origin/main
|
117
|
-
```
|
101
|
+

|
118
102
|
|
119
|
-
A "feature" in SugarJar
|
120
|
-
from "
|
121
|
-
which remote is the "upstream", even if it's
|
122
|
-
the primary branch (
|
103
|
+
A "feature" in SugarJar parlance just means that the branch is always created
|
104
|
+
from "most main" - this is usually `upstream/main`, but SJ will figure out
|
105
|
+
which remote is the "upstream", even if it's `origin`, and then will determine
|
106
|
+
the primary branch (`main` or for older repos `master`). It's also smart enough
|
123
107
|
to fetch that remote first to make sure you're working on the latest HEAD.
|
124
108
|
|
125
|
-
When you want to create a stacked PR, you can create
|
109
|
+
When you want to create a stacked PR, you can create `subfeature`, which, at
|
126
110
|
its core is just a branch created from the current branch:
|
127
111
|
|
128
|
-
|
129
|
-
$ sj subfeature dependentnewthing
|
130
|
-
Created feature branch dependentnewthing based on mynewthing
|
131
|
-
```
|
112
|
+

|
132
113
|
|
133
114
|
If you create branches like this then sugarjar can now make several things
|
134
115
|
much easier:
|
135
116
|
|
136
117
|
* `sj up` will rebase intelligently
|
137
118
|
* After an `sj bclean` of a branch earlier in the tree, `sj up` will update
|
138
|
-
the tracked branch to "
|
119
|
+
the tracked branch to "most main"
|
139
120
|
|
140
121
|
There are two commands that will show you the state of your stacked branches:
|
141
122
|
|
142
123
|
* `sj binfo` - shows the current branch and its ancestors up to your primary branch
|
143
|
-
* `sj
|
124
|
+
* `sj smartlog` (aka `sj sl`) - shows you the whole tree.
|
144
125
|
|
145
|
-
To continue with the example above, my `
|
126
|
+
To continue with the example above, my `smartlog` might look like:
|
146
127
|
|
147
|
-
|
148
|
-
$ sj sl
|
149
|
-
* 59c0522 (HEAD -> dependentnewthing) anothertest
|
150
|
-
* 6ebaa28 (mynewthing) test
|
151
|
-
o 7a0ffd0 (tag: v1.1.2, origin/main, origin/HEAD, main) Version bump (#160)
|
152
|
-
```
|
128
|
+

|
153
129
|
|
154
|
-
|
130
|
+
As you can see, `mynewthing` is derived from `main`, and `dependentnewthing` is
|
131
|
+
derived from `mynewthing`.
|
155
132
|
|
156
|
-
|
157
|
-
$ sj feature anotherfeature
|
158
|
-
Created feature branch anotherfeature based on origin/main
|
159
|
-
# do stuff
|
160
|
-
$ sj subfeature dependent2
|
161
|
-
Created feature branch dependent2 based on anotherfeature
|
162
|
-
# do stuff
|
163
|
-
```
|
133
|
+
Now lets make a different feature stack:
|
164
134
|
|
165
|
-
|
135
|
+

|
166
136
|
|
167
|
-
|
168
|
-
$ sj sl
|
169
|
-
* af6f143 (HEAD -> dependent2) morestuff
|
170
|
-
* 028c7f4 (anotherfeature) stuff
|
171
|
-
| * 59c0522 (dependentnewthing) anothertest
|
172
|
-
| * 6ebaa28 (mynewthing) test
|
173
|
-
|/
|
174
|
-
o 7a0ffd0 (tag: v1.1.2, origin/main, origin/HEAD, main) Version bump (#160)
|
175
|
-
```
|
137
|
+
The `smartlog` will now show us this tree, and it's a bit more interesting:
|
176
138
|
|
177
|
-
|
139
|
+

|
178
140
|
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
[mynewthing d33e082] change
|
187
|
-
1 file changed, 1 insertion(+)
|
188
|
-
$ sj sl
|
189
|
-
* d33e082 (HEAD -> mynewthing) change
|
190
|
-
| * af6f143 (dependent2) morestuff
|
191
|
-
| * 028c7f4 (anotherfeature) stuff
|
192
|
-
| | * 59c0522 (dependentnewthing) anothertest
|
193
|
-
| |/
|
194
|
-
|/|
|
195
|
-
* | 6ebaa28 test
|
196
|
-
|/
|
197
|
-
o 7a0ffd0 (tag: v1.1.2, origin/main, origin/HEAD, main) Version bump (#160)
|
198
|
-
```
|
141
|
+
Here we can see from `main`, we have two branches: one going to `mynewthing`
|
142
|
+
and one going to `anotherfeature`. Each of those has their own dependent branch
|
143
|
+
on top.
|
144
|
+
|
145
|
+
Now, what happens if I make a change to `mynewthing` (the bottom of the first stack)?
|
146
|
+
|
147
|
+

|
199
148
|
|
200
149
|
We can see here now that `dependentnewthing`, is based off a commit that _used_
|
201
|
-
to be `mynewthing
|
202
|
-
|
150
|
+
to be `mynewthing` (`5086ee`), but `mynewthing` has moved. Both `mynewthing`
|
151
|
+
and `dependentnewthing` are derived from `5086ee` (the old `mynewthing`), but
|
152
|
+
`dependentnewthing` isn't (yet) based on the current `mynewthing`. But SugarJar
|
153
|
+
will handle this all correctly when we ask it to update the branch:
|
203
154
|
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
dependentnewthing rebased on mynewthing
|
212
|
-
$ sj sl
|
213
|
-
* 93ed585 (HEAD -> dependentnewthing) anothertest
|
214
|
-
* d33e082 (mynewthing) change
|
215
|
-
* 6ebaa28 test
|
216
|
-
| * af6f143 (dependent2) morestuff
|
217
|
-
| * 028c7f4 (anotherfeature) stuff
|
218
|
-
|/
|
219
|
-
o 7a0ffd0 (tag: v1.1.2, origin/main, origin/HEAD, main) Version bump (#160)
|
220
|
-
```
|
155
|
+

|
156
|
+
|
157
|
+
Here we see that SugarJar knew that `dependentnewthing` should be rebased onto
|
158
|
+
`mynewthing`, and it did the right thing - from main there's still the
|
159
|
+
`50806ee` _and_ the new additional change which are now both part of the
|
160
|
+
`mynewthing` branch, and `dependentnewthing` is based on that branch, this
|
161
|
+
including all 3 commits in the right order.
|
221
162
|
|
222
163
|
Now, lets say that `mynewthing` gets merged and we use `bclean` to clean it all
|
223
164
|
up, what happens then?
|
224
165
|
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
```
|
166
|
+

|
167
|
+
|
168
|
+
SugarJar detects that branch is gone and thus this branch should now be based
|
169
|
+
on the upstream main branch!
|
230
170
|
|
231
171
|
### Creating Stacked PRs with subfeatures
|
232
172
|
|
@@ -242,12 +182,12 @@ It looks like this is a subfeature, would you like to base this PR on mynewthing
|
|
242
182
|
...
|
243
183
|
```
|
244
184
|
|
245
|
-
|
185
|
+
### Have a better lint/unittest experience!
|
246
186
|
|
247
187
|
Ever made a PR, only to find out later that it failed tests because of some
|
248
188
|
small lint issue? Not anymore! SJ can be configured to run things before
|
249
189
|
pushing. For example,in the SugarJar repo, we have it run Rubocop (ruby lint)
|
250
|
-
and Markdownlint
|
190
|
+
and Markdownlint `on_push`. If those fail, it lets you know and doesn't push.
|
251
191
|
|
252
192
|
You can configure SugarJar to tell it how to run both lints and unittests for
|
253
193
|
a given repo and if one or both should be run prior to pushing.
|
@@ -255,31 +195,31 @@ a given repo and if one or both should be run prior to pushing.
|
|
255
195
|
The details on the config file format is below, but we provide three commands:
|
256
196
|
|
257
197
|
```shell
|
258
|
-
|
198
|
+
sj lint
|
259
199
|
```
|
260
200
|
|
261
201
|
Run all linters.
|
262
202
|
|
263
203
|
```shell
|
264
|
-
|
204
|
+
sj unit
|
265
205
|
```
|
266
206
|
|
267
207
|
Run all unittests.
|
268
208
|
|
269
209
|
```shell
|
270
|
-
|
210
|
+
sj smartpush # or spush
|
271
211
|
```
|
272
212
|
|
273
213
|
Run configured push-time actions (nothing, lint, unit, both), and do not
|
274
214
|
push if any of them fail.
|
275
215
|
|
276
|
-
|
216
|
+
### Better push defaults
|
277
217
|
|
278
218
|
In addition to running pre-push tests for you `smartpush` also picks smart
|
279
219
|
defaults for push. So if you `sj spush` with no arguments, it uses the
|
280
220
|
`origin` remote and the same branch name you're on as the remote branch.
|
281
221
|
|
282
|
-
|
222
|
+
### Cleaning up your own history
|
283
223
|
|
284
224
|
Perhaps you contribute to a project that prefers to use merge commits, so you
|
285
225
|
like to clean up your own history. This is often difficult to get right - a
|
@@ -299,7 +239,7 @@ command is a mouthful! Enter `sj fpush`. It has all the smarts of `sj
|
|
299
239
|
smartpush` (runs configured pre-push actions), but adds `--force-with-lease` to
|
300
240
|
the command!
|
301
241
|
|
302
|
-
|
242
|
+
### Better feature branches
|
303
243
|
|
304
244
|
When you want to start a new feature, you want to start developing against
|
305
245
|
latest. That's why `sj feature` defaults to creating a branch against what we
|
@@ -328,14 +268,14 @@ use branch-based workflows and branches need to be prefixed with e.g. `$USER/`.
|
|
328
268
|
For example, if your prefix was `user/`, then `sj feature foo` would create
|
329
269
|
`user/foo`, and `sj co foo` would switch to `user/foo`.
|
330
270
|
|
331
|
-
|
271
|
+
### Smartlog
|
332
272
|
|
333
273
|
Smartlog will show you a tree diagram of your branches! Simply run `sj
|
334
274
|
smartlog` or `sj sl` for short.
|
335
275
|
|
336
|
-

|
276
|
+

|
337
277
|
|
338
|
-
|
278
|
+
### Pulling in suggestions from the web
|
339
279
|
|
340
280
|
When someone 'suggests' a change in the GitHub WebUI, once you choose to commit
|
341
281
|
them, your origin and local branches are no longer in-sync. The
|
@@ -344,23 +284,42 @@ local branch. This command will show a diff and ask for confirmation before
|
|
344
284
|
attempting the merge and - if allowed to continue - will use a fast-forward
|
345
285
|
merge.
|
346
286
|
|
347
|
-
|
287
|
+
### And more!
|
348
288
|
|
349
289
|
See `sj help` for more commands!
|
350
290
|
|
291
|
+
## Installation
|
292
|
+
|
293
|
+
Sugarjar is packaged in a variety of Linux distributions - see if it's on the
|
294
|
+
list here, and if so, use your package manager (or `gem`) to install it:
|
295
|
+
|
296
|
+
[](https://repology.org/project/sugarjar/versions)
|
297
|
+
|
298
|
+
If you are using a Linux distribution version that is end-of-life'd, click the
|
299
|
+
above image, it'll take you to a page that lists unsupported distro versions
|
300
|
+
as well (they'll have older SugarJar, but they'll probably still have some
|
301
|
+
version).
|
302
|
+
|
303
|
+
Ubuntu users, Ubuntu versions prior to 24.x cannot be updated, so if you're on
|
304
|
+
an older Ubuntu please use [this
|
305
|
+
PPA](https://launchpad.net/~michel-slm/+archive/ubuntu/sugarjar) from our
|
306
|
+
Ubuntu package maintainer.
|
307
|
+
|
308
|
+
For MacOS users, we recommend using Homebrew - SugarJar is now in Homebrew Core.
|
309
|
+
|
310
|
+
Finally, if none of those work for you, you can clone this repo and run it
|
311
|
+
directly from there.
|
312
|
+
|
351
313
|
## Configuration
|
352
314
|
|
353
315
|
Sugarjar will read in both a system-level config file
|
354
316
|
(`/etc/sugarjar/config.yaml`) and a user-level config file
|
355
317
|
`~/.config/sugarjar/config.yaml`, if they exist. Anything in the user config
|
356
318
|
will override the system config, and command-line options override both. The
|
357
|
-
yaml file is a straight key-value pair of options without their '--'.
|
358
|
-
example:
|
319
|
+
yaml file is a straight key-value pair of options without their '--'.
|
359
320
|
|
360
|
-
|
361
|
-
|
362
|
-
github_user: jaymzh
|
363
|
-
```
|
321
|
+
See [examples/sample_config.yaml](examples/sample_config.yaml) for an example
|
322
|
+
configuration file.
|
364
323
|
|
365
324
|
In addition, the environment variable `SUGARJAR_LOGLEVEL` can be defined to set
|
366
325
|
a log level. This is primarily used as a way to turn debug on earlier in order to
|
@@ -378,43 +337,10 @@ ignore_deprecated_options:
|
|
378
337
|
## Repository Configuration
|
379
338
|
|
380
339
|
Sugarjar looks for a `.sugarjar.yaml` in the root of the repository to tell it
|
381
|
-
how to handle repo-specific things.
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
* `lint_list_cmd` - A command to run which will print out linters to run, one
|
386
|
-
per line. Takes precedence over `lint`. The command (and the resulting
|
387
|
-
linters) will be run from the root of the repo.
|
388
|
-
* `unit` - A list of scripts to run on `sj unit`. These should be unittest
|
389
|
-
runners like rspec or pyunit. Test will be run from the root of the repo.
|
390
|
-
* `unit_list_cmd` - A command to run which will print out the unit tests to
|
391
|
-
run, one more line. Takes precedence over `unit`. The command (and the
|
392
|
-
resulting unit tests) will be run from the root of the repo.
|
393
|
-
* `on_push` - A list of types (`lint`, `unit`) of checks to run before pushing.
|
394
|
-
It is highly recommended this is only `lint`. The goal here is to allow for
|
395
|
-
the user to get quick stylistic feedback before pushing their branch to avoid
|
396
|
-
the push-fix-push-fix loop.
|
397
|
-
* `commit_template` - A path to a commit template to set in the `commit.template`
|
398
|
-
git config for this repo. Should be either a fully-qualified path, or a path
|
399
|
-
relative to the repo root.
|
400
|
-
* `include_from` - This will read an additional repoconfig file and merge it
|
401
|
-
into the one being read. The value should be relative to the root of the
|
402
|
-
repo. This will not error if the file does not exist, it is intended for
|
403
|
-
organizations to allow users to optionally extend a default repo config.
|
404
|
-
* `overwrite_from` - Same as `include_from`, but completely overwrites the
|
405
|
-
base configuration if the file is found.
|
406
|
-
|
407
|
-
Example configuration:
|
408
|
-
|
409
|
-
```yaml
|
410
|
-
lint:
|
411
|
-
- scripts/lint
|
412
|
-
unit:
|
413
|
-
- scripts/unit
|
414
|
-
on_push:
|
415
|
-
- lint
|
416
|
-
commit_template: .commit-template.txt
|
417
|
-
```
|
340
|
+
how to handle repo-specific things. See
|
341
|
+
[examples/sample_repoconfig.yaml](examples/sample_repoconfig.yaml) for an
|
342
|
+
example configuration that walks through all valid repo configurations in
|
343
|
+
detail.
|
418
344
|
|
419
345
|
### Commit Templates
|
420
346
|
|
@@ -485,4 +411,4 @@ Sapling is a great tool and solves a variety of problems SugarJar will never be
|
|
485
411
|
able to. However, it is a significant workflow change, that won't be
|
486
412
|
appropriate for all users or use-cases. Similarly there are workflows and tools
|
487
413
|
that Sapling breaks. So worry not, SugarJar will continue to be maintained and
|
488
|
-
developed
|
414
|
+
developed.
|