sugarjar 1.1.3 → 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 +142 -264
- data/bin/sj +62 -108
- 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 +94 -787
- data/lib/sugarjar/config.rb +22 -2
- data/lib/sugarjar/repoconfig.rb +2 -4
- data/lib/sugarjar/util.rb +33 -90
- data/lib/sugarjar/version.rb +1 -1
- data/sugarjar.gemspec +11 -5
- metadata +24 -5
data/README.md
CHANGED
@@ -4,17 +4,8 @@
|
|
4
4
|
[](https://github.com/jaymzh/sugarjar/actions?query=workflow%3AUnittests)
|
5
5
|
[](https://github.com/jaymzh/sugarjar/actions?query=workflow%3A%22DCO+Check%22)
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
> [Sapling](https://sapling-scm.com/), I highly recommend taking a look at that!
|
10
|
-
>
|
11
|
-
> Sapling is a great tool and solves a variety of problems SugarJar will never
|
12
|
-
> be able to. However, it is a bigger workflow change, so existing SJ users
|
13
|
-
> may choose to stick with this. Similarly some workflows may not be suitable
|
14
|
-
> for Sapling. I still plan to maintain and develop SugarJar for the time being.
|
15
|
-
|
16
|
-
Welcome to SugarJar - a git/github helper. It needs one of the GitHub CLI's:
|
17
|
-
either [gh](https://cli.github.com/) or the older [hub](https://hub.github.com/).
|
7
|
+
Welcome to SugarJar - a git/github helper. The only requirements are Ruby,
|
8
|
+
`git`, and [gh](https://cli.github.com/).
|
18
9
|
|
19
10
|
SugarJar is inspired by [arcanist](https://github.com/phacility/arcanist), and
|
20
11
|
its replacement at Facebook, JellyFish. Many of the features they provide for
|
@@ -27,39 +18,30 @@ If you miss Mondrian or Phabricator - this is the tool for you!
|
|
27
18
|
|
28
19
|
If you don't, there's a ton of useful stuff for everyone!
|
29
20
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
[
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
homebrew untap jaymzh/sugarjar
|
55
|
-
```
|
56
|
-
|
57
|
-
Then you can install the core version (`brew install sugarjar`).
|
58
|
-
|
59
|
-
Finally, if none of those work for you, you can clone this repo and run it
|
60
|
-
directly from there.
|
61
|
-
|
62
|
-
## Auto cleanup squash-merged branches
|
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
|
63
45
|
|
64
46
|
It is common for a PR to go back and forth with a variety of nits, lint fixes,
|
65
47
|
typos, etc. that can muddy history. So many projects will "squash and merge"
|
@@ -71,9 +53,7 @@ forces the deletion.
|
|
71
53
|
Enter `sj bclean` - it determines if the contents of your branch has been merge
|
72
54
|
and safely deletes if so.
|
73
55
|
|
74
|
-
|
75
|
-
sj bclean
|
76
|
-
```
|
56
|
+

|
77
57
|
|
78
58
|
Will delete a branch, if it has been merged, **even if it was squash-merged**.
|
79
59
|
|
@@ -83,44 +63,32 @@ You can pass it a branch if you'd like (it defaults to the branch you're on):
|
|
83
63
|
But it gets better! You can use `sj bcleanall` to remove all branches that have
|
84
64
|
been merged:
|
85
65
|
|
86
|
-
|
87
|
-
$ git branch
|
88
|
-
* argparse
|
89
|
-
master
|
90
|
-
feature
|
91
|
-
hubhost
|
92
|
-
$ git bcleanall
|
93
|
-
Skipping branch argparse - there are unmerged commits
|
94
|
-
Reaped branch feature
|
95
|
-
Reaped branch hubhost
|
96
|
-
```
|
66
|
+

|
97
67
|
|
98
|
-
|
68
|
+
### Smarter clones and remotes
|
99
69
|
|
100
70
|
There's a pattern to every new repo we want to contribute to. First we fork,
|
101
71
|
then we clone the fork, then we add a remote of the upstream repo. It's
|
102
72
|
monotonous. SugarJar does this for you:
|
103
73
|
|
104
|
-
|
105
|
-
sj smartclone jaymzh/sugarjar
|
106
|
-
```
|
74
|
+

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

|
137
102
|
|
138
|
-
A "feature" in SugarJar
|
139
|
-
from "
|
140
|
-
which remote is the "upstream", even if it's
|
141
|
-
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
|
142
107
|
to fetch that remote first to make sure you're working on the latest HEAD.
|
143
108
|
|
144
|
-
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
|
145
110
|
its core is just a branch created from the current branch:
|
146
111
|
|
147
|
-
|
148
|
-
$ sj subfeature dependentnewthing
|
149
|
-
Created feature branch dependentnewthing based on mynewthing
|
150
|
-
```
|
112
|
+

|
151
113
|
|
152
114
|
If you create branches like this then sugarjar can now make several things
|
153
115
|
much easier:
|
154
116
|
|
155
117
|
* `sj up` will rebase intelligently
|
156
118
|
* After an `sj bclean` of a branch earlier in the tree, `sj up` will update
|
157
|
-
the tracked branch to "
|
119
|
+
the tracked branch to "most main"
|
158
120
|
|
159
121
|
There are two commands that will show you the state of your stacked branches:
|
160
122
|
|
161
123
|
* `sj binfo` - shows the current branch and its ancestors up to your primary branch
|
162
|
-
* `sj
|
124
|
+
* `sj smartlog` (aka `sj sl`) - shows you the whole tree.
|
163
125
|
|
164
|
-
To continue with the example above, my `
|
126
|
+
To continue with the example above, my `smartlog` might look like:
|
165
127
|
|
166
|
-
|
167
|
-
$ sj sl
|
168
|
-
* 59c0522 (HEAD -> dependentnewthing) anothertest
|
169
|
-
* 6ebaa28 (mynewthing) test
|
170
|
-
o 7a0ffd0 (tag: v1.1.2, origin/main, origin/HEAD, main) Version bump (#160)
|
171
|
-
```
|
128
|
+

|
172
129
|
|
173
|
-
|
130
|
+
As you can see, `mynewthing` is derived from `main`, and `dependentnewthing` is
|
131
|
+
derived from `mynewthing`.
|
174
132
|
|
175
|
-
|
176
|
-
$ sj feature anotherfeature
|
177
|
-
Created feature branch anotherfeature based on origin/main
|
178
|
-
# do stuff
|
179
|
-
$ sj subfeature dependent2
|
180
|
-
Created feature branch dependent2 based on anotherfeature
|
181
|
-
# do stuff
|
182
|
-
```
|
133
|
+
Now lets make a different feature stack:
|
183
134
|
|
184
|
-
|
135
|
+

|
185
136
|
|
186
|
-
|
187
|
-
$ sj sl
|
188
|
-
* af6f143 (HEAD -> dependent2) morestuff
|
189
|
-
* 028c7f4 (anotherfeature) stuff
|
190
|
-
| * 59c0522 (dependentnewthing) anothertest
|
191
|
-
| * 6ebaa28 (mynewthing) test
|
192
|
-
|/
|
193
|
-
o 7a0ffd0 (tag: v1.1.2, origin/main, origin/HEAD, main) Version bump (#160)
|
194
|
-
```
|
137
|
+
The `smartlog` will now show us this tree, and it's a bit more interesting:
|
195
138
|
|
196
|
-
|
139
|
+

|
197
140
|
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
[mynewthing d33e082] change
|
206
|
-
1 file changed, 1 insertion(+)
|
207
|
-
$ sj sl
|
208
|
-
* d33e082 (HEAD -> mynewthing) change
|
209
|
-
| * af6f143 (dependent2) morestuff
|
210
|
-
| * 028c7f4 (anotherfeature) stuff
|
211
|
-
| | * 59c0522 (dependentnewthing) anothertest
|
212
|
-
| |/
|
213
|
-
|/|
|
214
|
-
* | 6ebaa28 test
|
215
|
-
|/
|
216
|
-
o 7a0ffd0 (tag: v1.1.2, origin/main, origin/HEAD, main) Version bump (#160)
|
217
|
-
```
|
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
|
+

|
218
148
|
|
219
149
|
We can see here now that `dependentnewthing`, is based off a commit that _used_
|
220
|
-
to be `mynewthing
|
221
|
-
|
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:
|
222
154
|
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
dependentnewthing rebased on mynewthing
|
231
|
-
$ sj sl
|
232
|
-
* 93ed585 (HEAD -> dependentnewthing) anothertest
|
233
|
-
* d33e082 (mynewthing) change
|
234
|
-
* 6ebaa28 test
|
235
|
-
| * af6f143 (dependent2) morestuff
|
236
|
-
| * 028c7f4 (anotherfeature) stuff
|
237
|
-
|/
|
238
|
-
o 7a0ffd0 (tag: v1.1.2, origin/main, origin/HEAD, main) Version bump (#160)
|
239
|
-
```
|
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.
|
240
162
|
|
241
163
|
Now, lets say that `mynewthing` gets merged and we use `bclean` to clean it all
|
242
164
|
up, what happens then?
|
243
165
|
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
```
|
166
|
+

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

|
276
|
+

|
356
277
|
|
357
|
-
|
278
|
+
### Pulling in suggestions from the web
|
358
279
|
|
359
280
|
When someone 'suggests' a change in the GitHub WebUI, once you choose to commit
|
360
281
|
them, your origin and local branches are no longer in-sync. The
|
@@ -363,44 +284,31 @@ local branch. This command will show a diff and ask for confirmation before
|
|
363
284
|
attempting the merge and - if allowed to continue - will use a fast-forward
|
364
285
|
merge.
|
365
286
|
|
366
|
-
|
287
|
+
### And more!
|
367
288
|
|
368
289
|
See `sj help` for more commands!
|
369
290
|
|
370
|
-
##
|
291
|
+
## Installation
|
371
292
|
|
372
|
-
|
373
|
-
|
374
|
-
SugarJar to use `gh` instead of `hub`, then it will pass commands straight to
|
375
|
-
`git` since `gh` doesn't act as a `git` wrapper.
|
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:
|
376
295
|
|
377
|
-
|
296
|
+
[](https://repology.org/project/sugarjar/versions)
|
378
297
|
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
$ git br
|
389
|
-
* dependent-feature 44cf9e2 Lint/gemspec cleanups
|
390
|
-
master 44cf9e2 Lint/gemspec cleanups
|
391
|
-
test-branch 44cf9e2 Lint/gemspec cleanups
|
392
|
-
test1 c808eae [ahead 1] test1
|
393
|
-
test2 e545b41 test2
|
394
|
-
test2.1 c1831b3 test2.1
|
395
|
-
test3 e451865 test3
|
396
|
-
```
|
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.
|
397
307
|
|
398
|
-
|
399
|
-
can turn off fallthru by setting `fallthru: false` in your config.
|
308
|
+
For MacOS users, we recommend using Homebrew - SugarJar is now in Homebrew Core.
|
400
309
|
|
401
|
-
|
402
|
-
|
403
|
-
`git version` too!
|
310
|
+
Finally, if none of those work for you, you can clone this repo and run it
|
311
|
+
directly from there.
|
404
312
|
|
405
313
|
## Configuration
|
406
314
|
|
@@ -408,59 +316,32 @@ Sugarjar will read in both a system-level config file
|
|
408
316
|
(`/etc/sugarjar/config.yaml`) and a user-level config file
|
409
317
|
`~/.config/sugarjar/config.yaml`, if they exist. Anything in the user config
|
410
318
|
will override the system config, and command-line options override both. The
|
411
|
-
yaml file is a straight key-value pair of options without their '--'.
|
412
|
-
example:
|
319
|
+
yaml file is a straight key-value pair of options without their '--'.
|
413
320
|
|
414
|
-
|
415
|
-
|
416
|
-
github_user: jaymzh
|
417
|
-
```
|
321
|
+
See [examples/sample_config.yaml](examples/sample_config.yaml) for an example
|
322
|
+
configuration file.
|
418
323
|
|
419
324
|
In addition, the environment variable `SUGARJAR_LOGLEVEL` can be defined to set
|
420
325
|
a log level. This is primarily used as a way to turn debug on earlier in order to
|
421
326
|
troubleshoot configuration parsing.
|
422
327
|
|
423
|
-
|
424
|
-
|
425
|
-
Sugarjar looks for a `.sugarjar.yaml` in the root of the repository to tell it
|
426
|
-
how to handle repo-specific things. Currently there options are:
|
427
|
-
|
428
|
-
* `lint` - A list of scripts to run on `sj lint`. These should be linters like
|
429
|
-
rubocop or pyflake. Linters will be run from the root of the repo.
|
430
|
-
* `lint_list_cmd` - A command to run which will print out linters to run, one
|
431
|
-
per line. Takes precedence over `lint`. The command (and the resulting
|
432
|
-
linters) will be run from the root of the repo.
|
433
|
-
* `unit` - A list of scripts to run on `sj unit`. These should be unittest
|
434
|
-
runners like rspec or pyunit. Test will be run from the root of the repo.
|
435
|
-
* `unit_list_cmd` - A command to run which will print out the unit tests to
|
436
|
-
run, one more line. Takes precedence over `unit`. The command (and the
|
437
|
-
resulting unit tests) will be run from the root of the repo.
|
438
|
-
* `on_push` - A list of types (`lint`, `unit`) of checks to run before pushing.
|
439
|
-
It is highly recommended this is only `lint`. The goal here is to allow for
|
440
|
-
the user to get quick stylistic feedback before pushing their branch to avoid
|
441
|
-
the push-fix-push-fix loop.
|
442
|
-
* `commit_template` - A path to a commit template to set in the `commit.template`
|
443
|
-
git config for this repo. Should be either a fully-qualified path, or a path
|
444
|
-
relative to the repo root.
|
445
|
-
* `include_from` - This will read an additional repoconfig file and merge it
|
446
|
-
into the one being read. The value should be relative to the root of the
|
447
|
-
repo. This will not error if the file does not exist, it is intended for
|
448
|
-
organizations to allow users to optionally extend a default repo config.
|
449
|
-
* `overwrite_from` - Same as `include_from`, but completely overwrites the
|
450
|
-
base configuration if the file is found.
|
451
|
-
|
452
|
-
Example configuration:
|
328
|
+
Deprecated fields will cause a warning, but you can suppress that warning by
|
329
|
+
defining `ignore_deprecated_options`, for example:
|
453
330
|
|
454
331
|
```yaml
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
- scripts/unit
|
459
|
-
on_push:
|
460
|
-
- lint
|
461
|
-
commit_template: .commit-template.txt
|
332
|
+
old_option: foo
|
333
|
+
ignore_deprecated_options:
|
334
|
+
- old_options
|
462
335
|
```
|
463
336
|
|
337
|
+
## Repository Configuration
|
338
|
+
|
339
|
+
Sugarjar looks for a `.sugarjar.yaml` in the root of the repository to tell it
|
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.
|
344
|
+
|
464
345
|
### Commit Templates
|
465
346
|
|
466
347
|
While GitHub provides a way to specify a pull-request template by putting the
|
@@ -471,33 +352,27 @@ prone, so this setting will automatically set this up for each developer.
|
|
471
352
|
|
472
353
|
## Enterprise GitHub
|
473
354
|
|
474
|
-
Like `
|
355
|
+
Like `gh`, SugarJar supports GitHub Enterprise. In fact, we provide extra
|
475
356
|
features just for it.
|
476
357
|
|
477
|
-
|
478
|
-
users will also have a few repos
|
479
|
-
|
358
|
+
You can set `github_host` in your global or user config, but since most
|
359
|
+
users will also have a few opensource repos, you can override it in the
|
360
|
+
Repository Config as well.
|
480
361
|
|
481
|
-
So,
|
482
|
-
set the `hub.host` git config in that single repo so that it'll "just work"
|
483
|
-
from there on out.
|
362
|
+
So, for example you might have:
|
484
363
|
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
```shell
|
489
|
-
sj clone jaymzh/sugarjar --github-host githuh.com
|
364
|
+
```yaml
|
365
|
+
github_host: gh.sample.com
|
490
366
|
```
|
491
367
|
|
492
|
-
|
493
|
-
|
368
|
+
In your `~/.config/sugarjar/config.yaml`, but if the `.sugarjar.yaml` in your
|
369
|
+
repo has:
|
494
370
|
|
495
|
-
|
371
|
+
```yaml
|
372
|
+
github_host: github.com
|
373
|
+
```
|
496
374
|
|
497
|
-
|
498
|
-
can override this by specifying `--github-cli` on the command line or setting
|
499
|
-
`github_cli` to either `gh` or `hub` (it defaults to `auto`) in your
|
500
|
-
configuration.
|
375
|
+
Then we will configure `gh` to talk to github.com when in that repo.
|
501
376
|
|
502
377
|
## FAQ
|
503
378
|
|
@@ -509,15 +384,6 @@ possible options that where there and not taken and tried to find one I could
|
|
509
384
|
make an appropriate name out of. Since this utility adds lots of sugar to git
|
510
385
|
and github, it seemed appropriate.
|
511
386
|
|
512
|
-
**Why did you originally use `hub` instead of the newer `gh` CLI?**
|
513
|
-
|
514
|
-
When I originally wrote SugarJar, `gh` was in early development, and `hub` had
|
515
|
-
many more features. In addition, I wrote SugarJar to be a wrapper for git/hub,
|
516
|
-
and `hub` allows this but `gh` does not.
|
517
|
-
|
518
|
-
When `gh` matured, we added experimental `gh` support in 0.0.11, and switched the
|
519
|
-
default to prefer `gh` in 1.0.0.
|
520
|
-
|
521
387
|
**I'd like to package SugarJar for my favorite distro/OS, is that OK?**
|
522
388
|
|
523
389
|
Of course! But I'd appreciate you emailing me to give me a heads up. Doing so
|
@@ -534,3 +400,15 @@ it on Windows, but I'll happily accept patches for Windows compatibility.
|
|
534
400
|
If the package for your OS/distro didn't set it up manually, you should find
|
535
401
|
that `sugarjar_completion.bash` is included in the package, and you can simply
|
536
402
|
source that in your dotfiles, assuming you are using bash.
|
403
|
+
|
404
|
+
**What happens now that Sapling is released?**
|
405
|
+
|
406
|
+
SugarJar isn't going anywhere anytime soon. This was meant to replace arc/jf,
|
407
|
+
which has now been open-sourced as [Sapling](https://sapling-scm.com/), so I
|
408
|
+
highly recommend taking a look at that!
|
409
|
+
|
410
|
+
Sapling is a great tool and solves a variety of problems SugarJar will never be
|
411
|
+
able to. However, it is a significant workflow change, that won't be
|
412
|
+
appropriate for all users or use-cases. Similarly there are workflows and tools
|
413
|
+
that Sapling breaks. So worry not, SugarJar will continue to be maintained and
|
414
|
+
developed.
|