def process_remotes
      remotes.each do |_name, remote|
        dir = workspace_of(remote)
        rc_url = remote[:rc_url] || remote[:vault]
        tag = remote[:tag].nil? ? Origen::VersionString.new(remote[:version]) : Origen::VersionString.new(remote[:tag])
        version_file = dir.to_s + '/.current_version'
        begin
          if File.exist?("#{dir}/.initial_populate_successful")
            FileUtils.rm_f(version_file) if File.exist?(version_file)
            rc = RevisionControl.new remote: rc_url, local: dir
            rc.send rc.remotes_method, version: prefix_tag(tag), force: true
            File.open(version_file, 'w') do |f|
              f.write tag
            end
          else
            rc = RevisionControl.new remote: rc_url, local: dir
            rc.send rc.remotes_method, version: prefix_tag(tag), force: true
            FileUtils.touch "#{dir}/.initial_populate_successful"
            File.open(version_file, 'w') do |f|
              f.write tag
            end
          end
        rescue Origen::GitError, Origen::DesignSyncError, Origen::PerforceError => e
          # If Git failed in the remote, its usually easy to see what the problem is, but now *where* it is.
          # This will prepend the failing remote along with the error from the revision control system,
          # then rethrow the error
          e.message.prepend "When updating remotes for #{remote[:importer].name}: "
          raise e
        end
      end
    end
def process_remotes
      remotes.each do |_name, remote|
        dir = workspace_of(remote)
        rc_url = remote[:rc_url] || remote[:vault]
        tag = remote[:tag].nil? ? Origen::VersionString.new(remote[:version]) : Origen::VersionString.new(remote[:tag])
        version_file = dir.to_s + '/.current_version'
        begin
          if File.exist?("#{dir}/.initial_populate_successful")
            FileUtils.rm_f(version_file) if File.exist?(version_file)
            rc = RevisionControl.new remote: rc_url, local: dir
            rc.send rc.remotes_method, version: prefix_tag(tag), force: true
            File.open(version_file, 'w') do |f|
              f.write tag
            end
          else
            rc = RevisionControl.new remote: rc_url, local: dir
            rc.send rc.remotes_method, version: prefix_tag(tag), force: true
            FileUtils.touch "#{dir}/.initial_populate_successful"
            File.open(version_file, 'w') do |f|
              f.write tag
            end
          end
        rescue Origen::GitError, Origen::DesignSyncError, Origen::PerforceError => e
          # If Git failed in the remote, its usually easy to see what the problem is, but now *where* it is.
          # This will prepend the failing remote along with the error from the revision control system,
          # then rethrow the error
          e.message.prepend "When updating remotes for #{remote[:importer].name}: "
          raise e
        end
      end
    end
Process each remote