123456789_123456789_123456789_123456789_123456789_

Module: Octokit::Client::SourceImport

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Included In:
Defined in: lib/octokit/client/source_import.rb

Overview

Methods for the Source Import API

Instance Method Summary

Instance Method Details

#cancel_source_import(repo, options = {}) ⇒ Boolean

Stop an import for a repository.

Examples:

@client.cancel_source_import("octokit/octokit.rb")

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository.

Returns:

  • (Boolean)

    True if the import has been cancelled, false otherwise.

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/source_import.rb', line 126

def cancel_source_import(repo, options = {})
  options = ensure_api_media_type(:source_imports, options)
  boolean_from_response :delete, "#{Repository.path repo}/import", options
end

#map_source_import_commit_author(author_url, values, options = {}) ⇒ Sawyer::Resource

Update an author's identity for the import.

Examples:

author_url = "https://api.github.com/repos/octokit/octokit.rb/import/authors/1"
@client.map_source_import_commit_author(author_url, {
  :email => "hubot@github.com",
  :name => "Hubot the Robot"
})

Parameters:

  • author_url (String)

    The source import API url for the commit author

  • values (Hash)

    The updated author attributes

Options Hash (values):

  • :email (String)

    The new Git author email.

  • :name (String)

    The new Git author name.

Returns:

  • (Sawyer::Resource)

    Hash representing the updated commit author

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/source_import.rb', line 113

def map_source_import_commit_author(author_url, values, options = {})
  options = ensure_api_media_type(:source_imports, options.merge(values))
  patch author_url, options
end

#set_source_import_lfs_preference(repo, use_lfs, options = {}) ⇒ Sawyer::Resource

Set preference for using Git LFS to import files over 100MB

Examples:

@client.opt_in_source_import_lfs("octokit/octokit.rb", "opt_in")

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository.

  • use_lfs (String)

    Preference for using Git LFS to import large files. Can be one of "opt_in" or "opt_out"

Returns:

  • (Sawyer::Resource)

    Hash representing the repository import

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/source_import.rb', line 155

def set_source_import_lfs_preference(repo, use_lfs, options = {})
  options = ensure_api_media_type(:source_imports, options.merge(use_lfs: use_lfs))
  patch "#{Repository.path repo}/import/lfs", options
end

#source_import_commit_authors(repo, options = {}) ⇒ Array<Sawyer::Resource>

List source import commit authors

Examples:

@client.source_import_commit_authors("octokit/octokit.rb")

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository.

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :since (String)

    Only authors found after this id are returned.

Returns:

  • (Array<Sawyer::Resource>)

    Array of hashes representing commit_authors.

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/source_import.rb', line 93

def source_import_commit_authors(repo, options = {})
  options = ensure_api_media_type(:source_imports, options)
  get "#{Repository.path repo}/import/authors", options
end

#source_import_large_files(repo, options = {}) ⇒ Array<Sawyer::Resource>

List source import large files

Examples:

@client.source_import_large_files("octokit/octokit.rb")

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository.

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :page (Integer)

    Page of paginated results

Returns:

  • (Array<Sawyer::Resource>)

    Array of hashes representing files over 100MB.

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/source_import.rb', line 141

def source_import_large_files(repo, options = {})
  options = ensure_api_media_type(:source_imports, options)
  get "#{Repository.path repo}/import/large_files", options
end

#source_import_progress(repo, options = {}) ⇒ Sawyer::Resource

View the progress of an import.

Examples:

@client.source_import_progress("octokit/octokit.rb")

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository.

Returns:

  • (Sawyer::Resource)

    Hash representing the progress of the import

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/source_import.rb', line 57

def source_import_progress(repo, options = {})
  options = ensure_api_media_type(:source_imports, options)
  get "#{Repository.path repo}/import", options
end

#start_source_import(repo, vcs, vcs_url, options = {}) ⇒ Sawyer::Resource #start_source_import(repo, vcs_url, options = {}) ⇒ Sawyer::Resource

Start a source import to a GitHub repository using GitHub Importer.

Examples:

@client.start_source_import("octokit/octokit.rb", "http://svn.mycompany.com/svn/myproject", {
 :vcs           => "subversion",
 :vcs_username" => "octocat",
 :vcs_password  => "secret"
})

Overloads:

  • #start_source_import(repo, vcs, vcs_url, options = {}) ⇒ Sawyer::Resource
    Deprecated.

    Parameters:

    • repo (Integer, String, Hash, Repository)

      A GitHub repository.

    • vcs (String)

      The originating VCS type. Can be one of "subversion", "git", "mercurial", or "tfvc".

    • vcs_url (String)

      The URL of the originating repository.

    • options (Hash) (defaults to: {})

    Options Hash (options):

    • :vcs_username (String)

      If authentication is required, the username to provide to vcs_url.

    • :vcs_password (String)

      If authentication is required, the password to provide to vcs_url.

    • :tfvc_project (String)

      For a tfvc import, the name of the project that is being imported.

  • #start_source_import(repo, vcs_url, options = {}) ⇒ Sawyer::Resource

    Parameters:

    • repo (Integer, String, Hash, Repository)

      A GitHub repository.

    • vcs_url (String)

      The URL of the originating repository.

    • options (Hash) (defaults to: {})
    • options (String) (defaults to: {})

      :vcs The originating VCS type. Can be one of "subversion", "git", "mercurial", or "tfvc".

    Options Hash (options):

    • :vcs_username (String)

      If authentication is required, the username to provide to vcs_url.

    • :vcs_password (String)

      If authentication is required, the password to provide to vcs_url.

    • :tfvc_project (String)

      For a tfvc import, the name of the project that is being imported.

Returns:

  • (Sawyer::Resource)

    Hash representing the repository import

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/source_import.rb', line 37

def start_source_import(*args)
  arguments = Octokit::RepoArguments.new(args)
  vcs_url = arguments.pop
  vcs = arguments.pop
  if vcs
    octokit_warn 'Octokit#start_source_import vcs parameter is now an option, please update your call before the next major Octokit version update.'
    arguments.options.merge!(vcs: vcs)
  end
  options = ensure_api_media_type(:source_imports, arguments.options.merge(vcs_url: vcs_url))
  put "#{Repository.path arguments.repo}/import", options
end

#update_source_import(repo, options = {}) ⇒ Sawyer::Resource

Update source import with authentication or project choice Restart source import if no options are passed

https://developer.github.com/v3/migration/source_imports/#update-existing-import

Examples:

@client.update_source_import("octokit/octokit.rb", {
 :vcs_username" => "octocat",
 :vcs_password  => "secret"
})

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository.

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :vcs_username (String)

    If authentication is required, the username to provide to vcs_url.

  • :vcs_password (String)

    If authentication is required, the password to provide to vcs_url.

  • To (String)

    update project choice, please refer to the project_choice array from the progress return hash for the exact attributes.

Returns:

  • (Sawyer::Resource)

    Hash representing the repository import

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/source_import.rb', line 78

def update_source_import(repo, options = {})
  options = ensure_api_media_type(:source_imports, options)
  patch "#{Repository.path repo}/import", options
end