archivist (version 1.1)

copyLocalRepo: Copy an Existing Repository to Another Repository

Description

copyRepo copies artifact from one Repository to another Repository. It adds new files to exising gallery folder in repoTo Repository. copyLocalRepo copies local Repository, where copyGithubRepo copies Github Repository.

Usage

copyLocalRepo(repoFrom, repoTo, md5hashes)

copyGithubRepo(repoTo, md5hashes, user, repo, branch = "master", repoDirGit = FALSE)

Arguments

repoFrom
A character that specifies the directory of the Repository from which artifacts will be copied. Works only on copyLocalRepo.
repoTo
A character that specifies the directory of the Repository in which artifacts will be copied.
md5hashes
A character or character vector containing md5hashes of artifacts to be copied.
repo
Only if coping a Github repository. A character containing a name of a Github repository on which the repoFrom-Repository is archived.
user
Only if coping a Github repository. A character containing a name of a Github user on whose account the repoFrom is created.
branch
Only if coping with a Github repository. A character containing a name of Github Repository's branch on which a repoFrom-Repository is archived. Default branch is master.
repoDirGit
Only if working with a Github repository. A character containing a name of a directory on Github repository on which the Repository is stored. If the Repository is stored in main folder on Github repository, this should be set to repoDirGit

Details

copyRepo copies artifact from one Repository to another Repository. Functions copyLocalRepo and copyGithubRepo copy artifacts from the archivist Repositories stored in a local folder or on a Github. Both of them take md5hash as a parameter, which is a result from saveToRepo function. For every artifacts, md5hash is a unique string of length 32 that comes out as a result of digest function, which uses a cryptographical MD5 hash algorithm. For more information see md5hash.

See Also

Other archivist: Repository; Tags; archivist-package; createEmptyRepo; deleteRepo; getTagsGithub, getTagsLocal; loadFromGithubRepo, loadFromLocalRepo; md5hash; rmFromRepo; saveToRepo; searchInGithubRepo, searchInLocalRepo; showGithubRepo, showLocalRepo; summaryGithubRepo, summaryLocalRepo; tarGithubRepo, tarLocalRepo

Examples

Run this code
# creating example Repository - that examples will work

exampleRepoDir <- tempdir()
hashes <- searchInGithubRepo( pattern="name", user="pbiecek", repo="archivist", fixed=FALSE )

createEmptyRepo( exampleRepoDir )

copyGithubRepo( repoTo = exampleRepoDir , md5hashes= hashes, user="pbiecek", repo="archivist" )

# removing an example Repository

deleteRepo( exampleRepoDir )

rm( exampleRepoDir )

# many archivist-like Repositories on one Github repository

dir <- paste0(getwd(), "/ex1")
createEmptyRepo( dir )
copyGithubRepo(repoTo = dir , md5hashes = "ff575c261c949d073b2895b05d1097c3",
              user="MarcinKosinski", repo="Museum",
              branch="master", repoDirGit="ex2")
deleteRepo( dir )

Run the code above in your browser using DataCamp Workspace