lib/release_tools/services/sync_remotes_service.rb
def sync_branches(project, *branches)
        sync_remotes = remotes_to_sync(project).fetch(:remotes)
        remotes_size = remotes_to_sync(project).fetch(:size)

        if sync_remotes.size < remotes_size
          logger.fatal("Expected at least #{remotes_size} remotes, got #{sync_remotes.size}", project: project, remotes: sync_remotes)
          return
        end

        branches.each do |branch|
          repository = RemoteRepository.get(sync_remotes, global_depth: 50, branch: branch)

          repository.fetch(branch, remote: :dev)

          result = repository.merge("dev/#{branch}", no_ff: true)

          if result.status.success?
            logger.info('Pushing branch to remotes', project: project, name: branch, remotes: sync_remotes.keys)
            repository.push_to_all_remotes(branch)
          else
            logger.fatal('Failed to sync branch', project: project, name: branch, output: result.output)
          end
        end
      end
# Sync project stable branches across all remotes.
#
# If security_remote is enabled it uses all the project remotes
# (Canonical, Dev and Security), if not it only uses Canonical and Dev.
#
# Iterates over stable branches and for each of them:
# 1. It clones from Canonical.
# 2. Fetches stable branch from Dev
# 3. Merges Dev stable branch into Canonical
# 4. If the merge is successful pushes the changes to all remotes.
Sync project stable branches across all remotes.
If security_remote is enabled it uses all the project remotes
(Canonical, Dev and Security), if not it only uses Canonical and Dev.

Iterates over stable branches and for each of them:
1. It clones from Canonical.
2. Fetches stable branch from Dev
3. Merges Dev stable branch into Canonical
4. If the merge is successful pushes the changes to all remotes.
Sync project stable branches across all remotes . If security_remote is enabled it uses all the project remotes ( Canonical Dev and Security ) if not it only uses Canonical and Dev . Iterates over stable branches and for each of them : 1 . It clones from Canonical . 2 . Fetches stable branch from Dev 3 . Merges Dev stable branch into Canonical 4 . If the merge is successful pushes the changes to all remotes .
def sync_branches(project, *branches)
        sync_remotes = remotes_to_sync(project).fetch(:remotes)
        remotes_size = remotes_to_sync(project).fetch(:size)
        if sync_remotes.size < remotes_size
          logger.fatal("Expected at least #{remotes_size} remotes, got #{sync_remotes.size}", project: project, remotes: sync_remotes)
          return
        end
        branches.each do |branch|
          repository = RemoteRepository.get(sync_remotes, global_depth: 50, branch: branch)
          repository.fetch(branch, remote: :dev)
          result = repository.merge("dev/#{branch}", no_ff: true)
          if result.status.success?
            logger.info('Pushing branch to remotes', project: project, name: branch, remotes: sync_remotes.keys)
            repository.push_to_all_remotes(branch)
          else
            logger.fatal('Failed to sync branch', project: project, name: branch, output: result.output)
          end
        end
      end
def sync_branches ( project , * branches ) sync_remotes = remotes_to_sync ( project ) . fetch ( :remotes ) remotes_size = remotes_to_sync ( project ) . fetch ( :size ) if sync_remotes . size < remotes_size logger . fatal ( "Expected at least #{remotes_size} remotes, got #{sync_remotes.size}" , project : project , remotes : sync_remotes ) return end branches . each do | branch | repository = RemoteRepository . get ( sync_remotes , global_depth : 50 , branch : branch ) repository . fetch ( branch , remote : :dev ) result = repository . merge ( "dev/#{branch}" , no_ff : true ) if result . status . success? logger . info ( 'Pushing branch to remotes' , project : project , name : branch , remotes : sync_remotes . keys ) repository . push_to_all_remotes ( branch ) else logger . fatal ( 'Failed to sync branch' , project : project , name : branch , output : result . output ) end end end
Sync project stable branches across all remotes.
Sync project stable branches across all remotes .
project
branches