git_chain 0.1.1 → 0.1.2
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/Gemfile.lock +1 -1
- data/lib/git_chain/chain.rb +16 -5
- data/lib/git_chain/runner.rb +3 -3
- data/lib/git_chain/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d85a7c86255d54f43461fb946ccdda25046436573311884057cc5152882d72c6
|
4
|
+
data.tar.gz: dc21fe06c6a067f91eca4aba3a53b716d22f6d5d4be3e019e083e15ff3457756
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b8b48b7b2f8a056f6b82784da379a7b5ae39ad185089aaa39b3b4e9f873aafb70bdd1b12e5c1982ed442a6c32458aafad5d3cd07ecce213a71c490a91a4e802
|
7
|
+
data.tar.gz: a2bcc8999be97eb6a81dbd20b83306d6b6b665e5282f97d658d21a4cc6f2870274a5abb471126aa05433b8998d6734794b033b14ceff7ff4ee896eb33fc43f82
|
data/Gemfile.lock
CHANGED
data/lib/git_chain/chain.rb
CHANGED
@@ -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
|
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:)
|
data/lib/git_chain/runner.rb
CHANGED
@@ -18,10 +18,10 @@ class GitChain::Runner
|
|
18
18
|
old_base: args[1]
|
19
19
|
)
|
20
20
|
when 'rebase'
|
21
|
-
if args
|
22
|
-
chain.
|
21
|
+
if args.first == 'all'
|
22
|
+
chain.rebase_all(git.current_branch)
|
23
23
|
else
|
24
|
-
chain.rebase(git.current_branch
|
24
|
+
chain.rebase(git.current_branch)
|
25
25
|
end
|
26
26
|
else
|
27
27
|
raise "Unknown Command: #{command}"
|
data/lib/git_chain/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2019-08-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: git
|