git_commands 3.2.1 → 3.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6830212ac9292f6ab9a440be58462c0700e0aca5
4
- data.tar.gz: 6dc1beacbc1d9d38805401e989f32810ac2b329b
3
+ metadata.gz: 13ca5fec82febdad4d82a8646490fea282ee1580
4
+ data.tar.gz: f42e6593a54309fa6efa2fb0e779f179b6600492
5
5
  SHA512:
6
- metadata.gz: 27b6cd41ea7fdb45082b63e2c4d9eb5f6f5cd4f300897eeb64e4347d45f73c0f787dbfaedf010c3c9645b4b6e0f333947f3fea3e1ce344c2042c7bb17eaf9114
7
- data.tar.gz: b958bd9a4abd7833b8a42b6220b5ad238223a2aa363b835e92d575eb67c425f45c11548da74c31c669cbea11186111e0c12b9440312b91cff3adc22c62b6009b
6
+ metadata.gz: 3b22a5ab76a7338167a5ad00b9f8e4d1e0e036626f12e9400b47f9f0d531d532a68a01ad3edd102bd280cb91800b5fcb95a407a1f4b2bf69d066a12b6d0316be
7
+ data.tar.gz: 9233e1627bbbb488cddb1452fba6948895f8603918b5e07cff258f3bad855df1cfe7de9f99c8447618e97964a6e8279ecc42cc87142d059eb4b3b3b0f047e500
@@ -16,6 +16,7 @@ module GitCommands
16
16
  def initialize(repo:, branches:, repo_klass: Repository, branch_klass: Branch, out: STDOUT)
17
17
  @out = out
18
18
  @repo = repo_klass.new(repo)
19
+ @conflictual = []
19
20
  Dir.chdir(@repo) do
20
21
  @branches = branch_klass.factory(branches)
21
22
  @timestamp = Time.new.strftime("%Y-%m-%d")
@@ -44,12 +45,13 @@ module GitCommands
44
45
  warning("Rebasing branch: #{branch}")
45
46
  `git checkout #{branch}`
46
47
  `git pull origin #{branch}`
47
- next unless rebase_with_master(branch)
48
+ @conflictual << branch && next unless rebase_with_master
48
49
  `git push -f origin #{branch}`
49
50
  `git checkout #{Branch::MASTER}`
50
51
  `git branch -D #{branch}`
51
52
  success "Rebased successfully!"
52
53
  end
54
+ delete_conflictual
53
55
  end
54
56
  end
55
57
  end
@@ -63,7 +65,7 @@ module GitCommands
63
65
  @branches.each do |branch|
64
66
  warning("Merging branch: #{branch}")
65
67
  `git checkout -b #{temp} origin/#{branch} --no-track`
66
- next unless rebase_with_master(branch)
68
+ @conflictual << branch && next unless rebase_with_master
67
69
  `git rebase #{aggregate}`
68
70
  `git checkout #{aggregate}`
69
71
  `git merge #{temp}`
@@ -71,6 +73,7 @@ module GitCommands
71
73
  end
72
74
  `git checkout #{Branch::MASTER}`
73
75
  end
76
+ delete_conflictual
74
77
  success "#{aggregate} branch created"
75
78
  end
76
79
  end
@@ -88,13 +91,18 @@ module GitCommands
88
91
  `git pull`
89
92
  end
90
93
 
91
- private def rebase_with_master(branch)
94
+ private def rebase_with_master
92
95
  `git rebase origin/#{Branch::MASTER}`
93
96
  return true unless @repo.locked?
94
97
  `git rebase --abort`
95
- `git checkout #{Branch::MASTER}`
96
- `git branch -D #{branch}`
97
- error("Got conflicts, skipping rebase!")
98
+ error("Got conflicts, aborting rebase!")
99
+ end
100
+
101
+ private def delete_conflictual
102
+ return if @conflictual.empty?
103
+ @conflictual.each do |branch|
104
+ `git branch -D #{branch}`
105
+ end
98
106
  end
99
107
 
100
108
  private def enter_repo
@@ -1,3 +1,3 @@
1
1
  module GitCommands
2
- VERSION = "3.2.1"
2
+ VERSION = "3.2.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git_commands
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.1
4
+ version: 3.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - costajob