sugarjar 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 017705b23c86a5a5c6f1695c5e7dabca591409d2f99039c592d9db14822d7cd2
4
- data.tar.gz: e41d40f68013573e5074772d061aa8c55fc69f860d6f63688219a995ab409abc
3
+ metadata.gz: bc16295007c8698083a182a521c68481b3cb421644def0115aa04286867dd1eb
4
+ data.tar.gz: c901d92e5d7d5287472f52cf56a83d29a5b1b4b0248232278b36e1706bc7117d
5
5
  SHA512:
6
- metadata.gz: 54d411046b2f5cab10e97d740e0c4c335a17ec9c4cefcd363720f06660ba4a3310d8ab2a48e057f9047b16d116e30e0e1b082d78953fe9570cee3bee2d14f6f0
7
- data.tar.gz: fefe49ca8cd8a8b8c80139a10cc874d24a08808349cae3a71237f47b263502c2fafc92a12d947bcf9b1c17a977bd4ffff8c3956f17bd0f1a18f68dfb566d8b2f
6
+ metadata.gz: 6d64d758a56feac59e5617544cdde17341c804a8831524c49222f6397e47e886ed16f42280d60584a5231d279410839bdacebda66827ae77bb115addb24f3b6d
7
+ data.tar.gz: e65b75d83d852906c713f00d6424a76897177f39eb1f2eaa0b5d17896b6d2fb288de3d1cf0946f5587f5674819a074782279ecdb26094c8038d221fcd7ceab0f
data/README.md CHANGED
@@ -5,14 +5,13 @@
5
5
  [![DCO](https://github.com/jaymzh/sugarjar/workflows/DCO%20Check/badge.svg)](https://github.com/jaymzh/sugarjar/actions?query=workflow%3A%22DCO+Check%22)
6
6
 
7
7
  > [!IMPORTANT]
8
- > If you are a _new_ user, I suggest looking at [Sapling](https://sapling-scm.com/)
9
- > instead of this. This was written as a stop-gap to approximate some features
10
- > of the Facebook/Meta internal development tools before they were released.
11
- > Now that those tools have been open-sourced and work with GitHub, new users
12
- > will likely want to start there. Sapling is far more feature rich, faster,
13
- > and have more development resources behind them. SugarJar is a smaller
14
- > transition, and for the time being I'm maintaining it for all existing users,
15
- > and for those who may not yet be ready for the transition to Sapling.
8
+ > As this was meant to replace arc/jf, which has now been open-sourced as
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.
16
15
 
17
16
  Welcome to SugarJar - a git/github helper. It needs one of the GitHub CLI's:
18
17
  either [gh](https://cli.github.com/) or the older [hub](https://hub.github.com/).
@@ -33,18 +32,29 @@ If you don't, there's a ton of useful stuff for everyone!
33
32
  Sugarjar is packaged in a variety of Linux distributions - see if it's on the
34
33
  list here, and if so, use your package manager (or `gem`) to install it:
35
34
 
36
- [![Packaging status](https://repology.org/badge/vertical-allrepos/sugarjar.svg)](https://repology.org/project/sugarjar/versions)
35
+ [![Packaging status](https://repology.org/badge/vertical-allrepos/sugarjar.svg?exclude_unsupported=1)](https://repology.org/project/sugarjar/versions)
37
36
 
38
- For MacOS users, you can use our Homebrew Tap:
37
+ If you are using a Linux distribution version that is end-of-life'd, click the
38
+ above image, it'll take you to a page that lists unsupported distro versions
39
+ as well (they'll have older SugarJar, but they'll probably still have some
40
+ version).
41
+
42
+ Ubuntu users, Ubuntu versions prior to 24.x cannot be updated, so if you're on
43
+ an older Ubuntu please use [this
44
+ PPA](https://launchpad.net/~michel-slm/+archive/ubuntu/sugarjar) from our
45
+ Ubuntu package maintainer.
46
+
47
+ For MacOS users, we recommend using Homebrew - SugarJar is now in Homebrew Core.
48
+
49
+ NOTE: If you previously used our custom Homebrew tap, you should remove and
50
+ untap it:
39
51
 
40
52
  ```shell
41
- homebrew tap jaymzh/sugarjar
42
- homebrew install sugarjar
53
+ homebrew uninstall sugarjar
54
+ homebrew untap jaymzh/sugarjar
43
55
  ```
44
56
 
45
- You can also weigh in on [this
46
- PR](https://github.com/Homebrew/homebrew-core/pull/157910) and tell the
47
- Homebrew folks you'd like to see it in core.
57
+ Then you can install the core version (`brew install sugarjar`).
48
58
 
49
59
  Finally, if none of those work for you, you can clone this repo and run it
50
60
  directly from there.
@@ -410,3 +420,9 @@ will allow me to make sure it shows up in the Repology badge above.
410
420
  Since it's Ruby, it should work across all platforms, however, it's developed
411
421
  and primarily tested on Linux as well as regularly used on Mac. I've not tested
412
422
  it on Windows, but I'll happily accept patches for Windows compatibility.
423
+
424
+ **How do I get tab-completion?**
425
+
426
+ If the package for your OS/distro didn't set it up manually, you should find
427
+ that `sugarjar_completion.bash` is included in the package, and you can simply
428
+ source that in your dotfiles, assuming you are using bash.
data/bin/sj CHANGED
@@ -190,9 +190,9 @@ COMMANDS:
190
190
  Print the version of sugarjar, and then run 'hub version'
191
191
  to show the hub and git versions.
192
192
 
193
- Be sure to checkout Sapling (https://sapling-scm.com/)! This was written as
193
+ Be sure to checkout Sapling (https://sapling-scm.com/)! SugarJar was written as
194
194
  a stop-gap to get Sapling features before it was open-sourced, and as such
195
- I may deprecate this in the future.
195
+ Sapling may serve your needs even better.
196
196
  COMMANDS
197
197
 
198
198
  # rubocop:enable Layout/HeredocIndentation
@@ -0,0 +1,42 @@
1
+ # bash completion for sugarjar
2
+
3
+ SJCONFIG="$HOME/.config/sugarjar/config.yaml"
4
+
5
+ _sugarjar_completions()
6
+ {
7
+ if [ "${#COMP_WORDS[@]}" -eq 2 ]; then
8
+ return
9
+ fi
10
+
11
+ local -a suggestions
12
+
13
+ # grap the feature_prefix if we have one so that we
14
+ # can let the user ignore that part. If we have `yq`
15
+ # we'll use it as that's going to be always 100%
16
+ # reliable, but if we don't, do our best with shell
17
+ # utils
18
+ local prefix=''
19
+ if [ -e "$SJCONFIG" ]; then
20
+ if type yq &>/dev/null; then
21
+ prefix=$(yq .feature_prefix $SJCONFIG)
22
+ else
23
+ # the xargs removes extra spaces
24
+ prefix=$(grep feature_prefix $SJCONFIG | cut -f2 -d: | xargs)
25
+ fi
26
+ fi
27
+
28
+ case "${COMP_WORDS[1]}" in
29
+ co|checkout|bclean)
30
+ local branches=$(git branch | sed -e 's/* //g' | xargs)
31
+ if [ -n "$prefix" ]; then
32
+ local branches=$(echo $branches | sed -e "s!$prefix!!g")
33
+ fi
34
+ suggestions=($(compgen -W "$branches" -- "${COMP_WORDS[2]}"))
35
+ COMPREPLY=("${suggestions[@]}")
36
+ ;;
37
+ *)
38
+ return
39
+ esac
40
+ }
41
+
42
+ complete -F _sugarjar_completions sj
@@ -140,10 +140,15 @@ class SugarJar
140
140
  curr = current_branch
141
141
  result = gitup
142
142
  if result['so'].error?
143
+ backout = ''
144
+ if rebase_in_progress?
145
+ backout = ' You can get out of this with a `git rebase --abort`.'
146
+ end
147
+
143
148
  die(
144
149
  "#{color(curr, :red)}: Failed to rebase on " +
145
- "#{result['base']}. Leaving the repo as-is. You can get out of " +
146
- 'this with a `git rebase --abort`. Output from failed rebase is: ' +
150
+ "#{result['base']}. Leaving the repo as-is.#{backout} " +
151
+ 'Output from failed rebase is: ' +
147
152
  "\nSTDOUT:\n#{result['so'].stdout.lines.map { |x| "\t#{x}" }.join}" +
148
153
  "\nSTDERR:\n#{result['so'].stderr.lines.map { |x| "\t#{x}" }.join}",
149
154
  )
@@ -179,7 +184,7 @@ class SugarJar
179
184
  "#{color(branch, :red)} failed rebase. Reverting attempt and " +
180
185
  'moving to next branch. Try `sj up` manually on that branch.',
181
186
  )
182
- git('rebase', '--abort')
187
+ git('rebase', '--abort') if rebase_in_progress?
183
188
  else
184
189
  SugarJar::Log.info(
185
190
  "#{color(branch, :green)} rebased on " +
@@ -807,6 +812,15 @@ class SugarJar
807
812
  }
808
813
  end
809
814
 
815
+ def rebase_in_progress?
816
+ # for rebase without -i
817
+ rebase_file = git('rev-parse', '--git-path', 'rebase-apply').stdout.strip
818
+ # for rebase -i
819
+ rebase_merge_file = git('rev-parse', '--git-path', 'rebase-merge').
820
+ stdout.strip
821
+ File.exist?(rebase_file) || File.exist?(rebase_merge_file)
822
+ end
823
+
810
824
  def tracked_branch
811
825
  s = git_nofail(
812
826
  'rev-parse', '--abbrev-ref', '--symbolic-full-name', '@{u}'
data/lib/sugarjar/util.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  require_relative 'log'
2
2
 
3
+ require 'mixlib/shellout'
4
+
3
5
  class SugarJar
4
6
  # Some common methods needed by other classes
5
7
  module Util
@@ -1,3 +1,3 @@
1
1
  class SugarJar
2
- VERSION = '1.1.0'.freeze
2
+ VERSION = '1.1.1'.freeze
3
3
  end
data/sugarjar.gemspec CHANGED
@@ -8,14 +8,16 @@ Gem::Specification.new do |spec|
8
8
  spec.email = ['phil@ipom.com']
9
9
  spec.license = 'Apache-2.0'
10
10
  spec.homepage = 'https://github.com/jaymzh/sugarjar'
11
- spec.required_ruby_version = '>= 3.1'
11
+ # We'll support 3.0 until 2024-03-31 when it goes EOL
12
+ # https://www.ruby-lang.org/en/downloads/branches/
13
+ spec.required_ruby_version = '>= 3.0'
12
14
  docs = %w{README.md LICENSE Gemfile sugarjar.gemspec}
13
15
  spec.extra_rdoc_files = docs
14
16
  spec.executables << 'sj'
15
17
  spec.files =
16
18
  Dir.glob('lib/sugarjar/*.rb') +
17
19
  Dir.glob('bin/*') +
18
- docs
20
+ Dir.glob('extras/*')
19
21
 
20
22
  spec.add_dependency 'deep_merge'
21
23
  spec.add_dependency 'mixlib-log'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sugarjar
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Phil Dibowitz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-31 00:00:00.000000000 Z
11
+ date: 2024-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: deep_merge
@@ -82,6 +82,7 @@ files:
82
82
  - LICENSE
83
83
  - README.md
84
84
  - bin/sj
85
+ - extras/sugarjar_completion.bash
85
86
  - lib/sugarjar/commands.rb
86
87
  - lib/sugarjar/config.rb
87
88
  - lib/sugarjar/log.rb
@@ -106,7 +107,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
106
107
  requirements:
107
108
  - - ">="
108
109
  - !ruby/object:Gem::Version
109
- version: '3.1'
110
+ version: '3.0'
110
111
  required_rubygems_version: !ruby/object:Gem::Requirement
111
112
  requirements:
112
113
  - - ">="