archivist (version 2.1.1)

copyLocalRepo: Copy an Existing Repository into Another Repository

Description

copy*Repo copies artifacts from one Repository into another Repository. It adds new files to existing gallery folder in repoTo Repository. copyLocalRepo copies local Repository while copyRemoteRepo copies remote Repository.

Usage

copyLocalRepo(repoFrom = NULL, repoTo, md5hashes)
copyRemoteRepo(repoTo, md5hashes, repo = aoptions("repo"), user = aoptions("user"), branch = aoptions("branch"), subdir = aoptions("subdir"), repoType = aoptions("repoType"))

Arguments

repoFrom
While copying local repository. A character that specifies the directory of the Repository from which artifacts will be copied. If it is set to NULL (by default), it will use the repoDir specified in setLocalRepo.
repoTo
A character that specifies the directory of the Repository into which artifacts will be copied.
md5hashes
A character vector containing md5hashes of artifacts to be copied.
repo
While coping the remote repository. A character containing a name of the remote repository on which the "repoFrom" - Repository is archived. By default set to NULL - see Note.
user
While coping the remote repository. A character containing a name of the remote user on whose account the "repoFrom" - Repository is created. By default set to NULL - see Note.
branch
While coping with the remote repository. A character containing a name of Remote Repository's branch on which the "repoFrom" - Repository is archived. Default branch is master.
subdir
While working with the remote repository. A character containing a name of a directory on the remote repository on which the "repoFrom" - Repository is stored. If the Repository is stored in the main folder on the remote repository, this should be set to FALSE as default.
repoType
A character containing a type of the remote repository. Currently it can be 'Remote' or 'bitbucket'.

Details

Functions copyLocalRepo and copyRemoteRepo copy artifacts from the archivist's Repositories stored in a local folder or on the Remote. Both of them use md5hashes of artifacts which are to be copied in md5hashes parameter. For more information about md5hash see md5hash.

See Also

Other archivist: Repository, Tags, %a%, addHooksToPrint, addTagsRepo, aformat, ahistory, alink, aoptions, archivist-package, aread, asearch, asession, atrace, cache, createLocalRepo, createMDGallery, deleteLocalRepo, getRemoteHook, getTagsLocal, loadFromLocalRepo, md5hash, restoreLibs, rmFromLocalRepo, saveToLocalRepo, searchInLocalRepo, setLocalRepo, shinySearchInLocalRepo, showLocalRepo, splitTagsLocal, summaryLocalRepo, zipLocalRepo

Examples

Run this code
## Not run: 
# 
# 
# ## Using archivist remote Repository to copy artifacts
# # creating example Repository
#  
# exampleRepoDir <- tempfile()
# createLocalRepo( exampleRepoDir )
# 
# # Searching for md5hashes of artifacts (without data related to them)
# # in the archivist remote  Repository
# hashes <- searchInRemoteRepo( pattern="name", user="pbiecek", repo="archivist", fixed=FALSE )
# 
# # Copying selected artifacts from archivist Remote  Repository into exampleRepoDir Repository
# 
# copyRemoteRepo( repoTo = exampleRepoDir , md5hashes= hashes, user="pbiecek", repo="archivist" )
# 
# # See how the gallery folder in our exampleRepoDir Repository
# # with copies of artifacts from archivist Remote  Repository looks like
# list.files( path = file.path( exampleRepoDir, "gallery" ) )
# 
# # See how the backpack database in our exampleRepoDir Repository looks like
# showLocalRepo( repoDir = exampleRepoDir )
# 
# # removing an example Repository
# 
# deleteLocalRepo( exampleRepoDir, deleteRoot=TRUE )
# 
# rm( exampleRepoDir )
# 
# # many archivist-like Repositories on one Remote repository
# 
# dir <- paste0(getwd(), "/ex1")
# createLocalRepo( dir )
# copyRemoteRepo( repoTo = dir , md5hashes = "ff575c261c949d073b2895b05d1097c3",
#                 user="MarcinKosinski", repo="Museum",
#                 branch="master", subdir="ex2")
#                 
# # Check if the copied artifact is on our dir Repository
# 
# showLocalRepo( repoDir = dir) # It is in backpack database indeed
# list.files( path = file.path( dir, "gallery" ) ) # it is also in gallery folder
# 
# # removing an example Repository
# deleteLocalRepo( dir, TRUE)
# 
# rm(dir)
# 
# ## Using graphGallery Repository attached to the archivist package to copy artifacts
# 
# # creating example Repository
# 
# exampleRepoDir <- tempfile()
# createLocalRepo( exampleRepoDir )
# 
# # Searching for md5hashes of artifacts (without data related to them)
# # in the graphGallery  Repository
# archivistRepo <- system.file( "graphGallery", package = "archivist")
# # You may use: 
# # hashes <- unique(showLocalRepo(repoDir)[,1]) 
# # to extract all artifacts from repository
# hashes <- searchInLocalRepo( pattern="name",
#                              repoDir =  archivistRepo,
#                              fixed=FALSE )
# 
# # Copying selected artifacts from archivist Remote  Repository into exampleRepoDir Repository
# 
# copyLocalRepo( repoFrom = archivistRepo, repoTo = exampleRepoDir , md5hashes= hashes )
# 
# # See how the backpack database in our exampleRepoDir Repository looks like
# showLocalRepo( repoDir = exampleRepoDir )
# 
# # removing an example Repository
# 
# deleteLocalRepo( exampleRepoDir, deleteRoot=TRUE )
# 
# rm( exampleRepoDir )
# rm( archivistRepo )
# 
# ## End(Not run)


Run the code above in your browser using DataLab