Class: MGit::FFMergeCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/mgit/commands/ffmerge.rb

Instance Method Summary collapse

Methods inherited from Command

#check_arity, create, execute, instance_each, list, load_commands, register_alias, register_command, require_commands_from_directory

Methods included from Output

#perror, #pinfo, #psystem, #ptable, #pwarn

Instance Method Details

#arityObject



17
18
19
# File 'lib/mgit/commands/ffmerge.rb', line 17

def arity
  [nil, 0]
end

#descriptionObject



25
26
27
# File 'lib/mgit/commands/ffmerge.rb', line 25

def description
  'merge all upstream tracking branches that can be fast-forwarded'
end

#execute(_) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/mgit/commands/ffmerge.rb', line 3

def execute(_)
  Registry.chdir_each do |repo|
    branches = mergable_branches(repo)
    next if branches.empty?

    if repo.dirty?
      pwarn "Skipping repository #{repo.name} since it's dirty."
      next
    end

    merge_branches(repo, branches)
  end
end

#usageObject



21
22
23
# File 'lib/mgit/commands/ffmerge.rb', line 21

def usage
  'ffmerge'
end