mgit 0.2.5 → 0.2.6

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- Zjg4MjgyNDhlYzIyYjM3ZDU5OTk3ZTA2ZDQ5YzcxZDBjMTk2YjBkMQ==
4
+ ZjNmMTI1NTJjZWIzMjNhNGUzODNhYTZjZThlZGU3N2M5NTI1NDQ1Mw==
5
5
  data.tar.gz: !binary |-
6
- NThkN2I2YzJmOTI3OGJkMDE3YzM0ZWY5MDYzMDNlZmM5ZmFjOGQ5ZA==
6
+ MjMyZTNiYjBlMTgyMzg5ZWRmYzQ5YjQzYzAyY2VlZmYwZGRmODgxZA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YTNiMGM4YzkzMTU1MzYwZWI1OGRkM2RkMGY4NTExOWRiNzc4NmRiNDlmMzVi
10
- MTJjZjI2NDJiYTBkZWRmMDc0NDkzOTQwNzlkZDU2YmFiYWRlMWRhNDQ5ZmQy
11
- ZTgwNzEwZjQwYmRmYWNkNjc4OGEyNTZhYWMzM2UxYTkzNjU1MzM=
9
+ M2EyYjBkYzg5ZDdiZjIwZWJjZDIyYzNkMTM0MTJlNzNjMjgxYTA0ZTcxZWIw
10
+ OTJhYWU2NDIzNjlmYzEzOGQ2NmY0M2UxN2Y3ZGMwZmEyMDViN2I4M2QxM2U1
11
+ ZTYxZWJmZGFiOGMyMjI2ZWNmMTFiMWMwZGFkNWI1ZThlYjUzN2U=
12
12
  data.tar.gz: !binary |-
13
- YzMyY2UyM2FlN2NhNTNhYjgyNjc1YWVhMzkzYmY3MTZjZjI5YWQ0ZDg4NDU1
14
- MjJiMWM4MGQzYzUyMWZiZmFlZGUxYjJlMTk1NmU1OTM4MmQ2ZTg0ZTljZmEz
15
- ZjIzNmI3MjczODczYmU5ZGZjOTM0OWExMTJhYzdiODdmMGYzZDU=
13
+ Y2RjNTlmMGYzMmI2MGU3YzMzYmMwZGYxNTljYTMxNjNkNTc0OTdiY2U5YWU4
14
+ NjJiZmMwMTc0ZDkxOWQzY2M0MGRkN2NiYmI5NmE2NDNiYTg2ZDdhN2VlN2Jh
15
+ ZDYyOTNjMDcxNWZlNmRjYTlkMmExZDQxODgwZGZhODBiNWUwNTU=
@@ -2,6 +2,13 @@ module MGit
2
2
  class FFMergeCommand < Command
3
3
  def execute(args)
4
4
  Registry.chdir_each do |repo|
5
+
6
+ bs = repo.remote_tracking_branches.select do |branch, upstream|
7
+ !repo.unmerged_commits(branch, upstream).empty?
8
+ end.map { |b, u| b }
9
+
10
+ next if bs.empty?
11
+
5
12
  if repo.dirty?
6
13
  pwarn "Skipping repository #{repo.name} since it's dirty."
7
14
  next
@@ -10,7 +17,7 @@ module MGit
10
17
  pinfo "Fast-forward merging branches in repository #{repo.name}..."
11
18
 
12
19
  cb = repo.current_branch
13
- repo.remote_tracking_branches.each do |b, u|
20
+ bs.each do |b|
14
21
  `git checkout -q #{b}`
15
22
  `git merge --ff-only @{u}`
16
23
  end
@@ -3,7 +3,7 @@ module MGit
3
3
  def execute(args)
4
4
  Registry.chdir_each do |repo|
5
5
  repo.remote_tracking_branches.each do |branch, upstream|
6
- uc = unmerged_commits(branch, upstream)
6
+ uc = repo.unmerged_commits(branch, upstream)
7
7
  next if uc.empty?
8
8
 
9
9
  pinfo "In repository #{repo.name}, branch #{upstream} the following commits were made:"
@@ -28,20 +28,5 @@ module MGit
28
28
  end
29
29
 
30
30
  register_command :log
31
-
32
- private
33
-
34
- def unmerged_commits(branch, upstream)
35
- `git log --pretty=format:"%h#%an#%s" --reverse --relative-date #{branch}..#{upstream}`.
36
- split("\n").
37
- map { |line| line.split('#') }.
38
- map do |words|
39
- {
40
- :commit => words[0],
41
- :author => words[1],
42
- :subject => words[2..-1].join('#')
43
- }
44
- end
45
- end
46
31
  end
47
32
  end
@@ -36,6 +36,21 @@ module MGit
36
36
  end
37
37
  end
38
38
 
39
+ def unmerged_commits(branch, upstream)
40
+ in_repo do
41
+ `git log --pretty=format:"%h#%an#%s" --reverse --relative-date #{branch}..#{upstream}`.
42
+ split("\n").
43
+ map { |line| line.split('#') }.
44
+ map do |words|
45
+ {
46
+ :commit => words[0],
47
+ :author => words[1],
48
+ :subject => words[2..-1].join('#')
49
+ }
50
+ end
51
+ end
52
+ end
53
+
39
54
  def flags
40
55
  flags = Set.new
41
56
  status_lines do |s|
data/lib/mgit/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module MGit
2
- VERSION = '0.2.5'
2
+ VERSION = '0.2.6'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mgit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - FlavourSys Technology GmbH