git_chain 0.1.1 → 0.1.2

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: 1d10b1d1d8aeeb25f7e63ebd82f29259e06ab8c78c6d2b499954062abc9b2b90
4
- data.tar.gz: c9d0787527d8a90c154a440f19bf626a0f91107ea0371197f9b56e44b1fa6602
3
+ metadata.gz: d85a7c86255d54f43461fb946ccdda25046436573311884057cc5152882d72c6
4
+ data.tar.gz: dc21fe06c6a067f91eca4aba3a53b716d22f6d5d4be3e019e083e15ff3457756
5
5
  SHA512:
6
- metadata.gz: b3d68f79be20659a5967e5a49dd0c2e52fbe1dd63f399f4b45d421b9eb5dde9e8c1b6af607d8f52e8f312e6b06d4ce12b58837d316e5d5feb2ccf8cc669be3a2
7
- data.tar.gz: e92ab72e1bb85bb1ebd44f3b0fc4bd7a9f0c6750efba20c1fe8cbe914390955a3f6c6c80c229d961176d1bebdd47ecedf497c99cff7f2afc8672d461ae6868a6
6
+ metadata.gz: 5b8b48b7b2f8a056f6b82784da379a7b5ae39ad185089aaa39b3b4e9f873aafb70bdd1b12e5c1982ed442a6c32458aafad5d3cd07ecce213a71c490a91a4e802
7
+ data.tar.gz: a2bcc8999be97eb6a81dbd20b83306d6b6b665e5282f97d658d21a4cc6f2870274a5abb471126aa05433b8998d6734794b033b14ceff7ff4ee896eb33fc43f82
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- git_chain (0.1.0)
4
+ git_chain (0.1.1)
5
5
  git
6
6
 
7
7
  GEM
@@ -7,14 +7,10 @@ class GitChain::Chain < Struct.new(:storage, :git)
7
7
  storage.save_data
8
8
  end
9
9
 
10
- def rebase(child, chain: false)
10
+ def rebase(child)
11
11
  raise "No chain for #{child}" unless record = storage.record_for(child)
12
12
  raise "Git Directory is not clean" unless git.clean?
13
13
 
14
- if record[:parent] != 'master' && chain
15
- rebase(record[:parent], chain: true)
16
- end
17
-
18
14
  old_base = record[:base]
19
15
  parent = record[:parent]
20
16
  branch = git.branches[parent]
@@ -25,6 +21,21 @@ class GitChain::Chain < Struct.new(:storage, :git)
25
21
  update_dependent(child: child, parent: parent, base: new_base.sha)
26
22
  end
27
23
 
24
+ def rebase_all(child)
25
+ raise "Git Directory is not clean" unless git.clean?
26
+ raise "No chain for #{child}" unless last_record = storage.record_for(child)
27
+
28
+ records = [last_record]
29
+ while new_record = storage.record_for(last_record[:parent])
30
+ records << new_record
31
+ last_record = new_record
32
+ end
33
+
34
+ records.reverse.each do |record|
35
+ rebase(record[:child])
36
+ end
37
+ end
38
+
28
39
  private
29
40
 
30
41
  def update_dependent(child:, parent:, base:)
@@ -18,10 +18,10 @@ class GitChain::Runner
18
18
  old_base: args[1]
19
19
  )
20
20
  when 'rebase'
21
- if args[0] == 'all'
22
- chain.rebase(git.current_branch, chain: true)
21
+ if args.first == 'all'
22
+ chain.rebase_all(git.current_branch)
23
23
  else
24
- chain.rebase(git.current_branch, chain: false)
24
+ chain.rebase(git.current_branch)
25
25
  end
26
26
  else
27
27
  raise "Unknown Command: #{command}"
@@ -1,3 +1,3 @@
1
1
  module GitChain
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git_chain
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan McGarvey
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-08-12 00:00:00.000000000 Z
11
+ date: 2019-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: git