Difference between revisions of "Import from SVN"
From Gcube Wiki
Manuele.simi (Talk | contribs) (→Mount a case-sensitive disk image (for Mac OS)) |
Manuele.simi (Talk | contribs) (→Edit the authors file) |
||
Line 77: | Line 77: | ||
== Edit the authors file == | == Edit the authors file == | ||
− | You need to edit the file and add the correct email address (i.e. the address configured in the Git service): | + | You need to edit the file and add the correct email address (i.e. the address configured in the Git service) for each listed author: |
<source lang="bash"> | <source lang="bash"> | ||
− | + | > cat authors.txt | |
− | + | ||
luca.frosini = luca.frosini <luca.frosini@mycompany.com> | luca.frosini = luca.frosini <luca.frosini@mycompany.com> | ||
lucio.lelii = lucio.lelii <lucio.lelii@mycompany.com> | lucio.lelii = lucio.lelii <lucio.lelii@mycompany.com> | ||
manuele.simi = manuele.simi <manuele.simi@mycompany.com | manuele.simi = manuele.simi <manuele.simi@mycompany.com | ||
− | vi | + | > vi authors.txt |
− | + | ||
− | + | ||
+ | > cat authors.txt | ||
luca.frosini = luca.frosini <luca.frosini@isti.cnr.it> | luca.frosini = luca.frosini <luca.frosini@isti.cnr.it> | ||
lucio.lelii = lucio.lelii <lucio.lelii@isti.cnr.it> | lucio.lelii = lucio.lelii <lucio.lelii@isti.cnr.it> |
Revision as of 20:32, 10 May 2019
Contents
- 1 Download migration utilities
- 2 Install git-svn
- 3 Mount a case-sensitive disk image (for Mac OS)
- 4 Extract the author(s) information
- 5 Clone the SVN repository
- 6 Rename “trunk” branch to “master” (if needed)
- 7 Check the imported history
- 8 Add code-repo’s Git repository as new remote
- 9 Push the local repo to the new remote
- 10 Clone the repo and create a working copy
- 11 Fix authors info
Download migration utilities
For an easy reference in this guide, the migration scripts is downloaded in the home folder:
cd $HOME && wget https://bitbucket.org/atlassian/svn-migration-scripts/downloads/svn-migration-scripts.jar
Install git-svn
Ubuntu
On Ubuntu, if you you get this output:
$ java -jar ./svn-migration-scripts.jar verify svn-migration-scripts: using version 0.1.56bbc7f Git: using version 2.17.1 Subversion: using version 1.9.7 git: 'svn' is not a git command. See 'git --help'. The most similar commands are fsck mv show git-svn: ERROR: Unable to determine version.
You must install the git-svn package by running:
$ sudo apt install git-svn
Now, you will get something like this:
$ java -jar ./svn-migration-scripts.jar verify svn-migration-scripts: using version 0.1.56bbc7f Git: using version 2.17.1 Subversion: using version 1.9.7 git-svn: using version 2.17.1
Mount a case-sensitive disk image (for Mac OS)
Check if this step is needed by running:
java -jar ~/svn-migration-scripts.jar verify svn-migration-scripts: using version 0.1.56bbc7f Git: using version 2.11.0 Subversion: using version 1.9.4 git-svn: using version 2.11.0 You appear to be running on a case-insensitive file-system. This is unsupported, and can result in data loss.
Following the warning, we create a disk image dedicated to the migration activities:
java -jar ~/svn-migration-scripts.jar create-disk-image 5 GitMigration created: /Users/manuelesimi/GitMigration.sparseimage /dev/disk2 GUID_partition_scheme /dev/disk2s1 EFI /dev/disk2s2 Apple_HFS /Users/manuelesimi/GitMigration The disk image was created successfully and mounted as: /Users/manuelesimi/GitMigration
Extract the author(s) information
cd ~/GitMigration java -jar ~/svn-migration-scripts.jar authors https://svn.d4science.research-infrastructures.eu/gcube/trunk/Common/gxREST > authors.txt About to create the authors file.
Alternative (pure SVN):
svn co https://svn.d4science.research-infrastructures.eu/gcube/trunk/Common/gxREST cd gxREST svn log -q | awk -F '|' '/^r/ {sub("^ ", "", $2); sub(" $", "", $2); print $2" = "$2" <"$2">"}' | sort -u > authors.txt
Edit the authors file
You need to edit the file and add the correct email address (i.e. the address configured in the Git service) for each listed author:
> cat authors.txt luca.frosini = luca.frosini <luca.frosini@mycompany.com> lucio.lelii = lucio.lelii <lucio.lelii@mycompany.com> manuele.simi = manuele.simi <manuele.simi@mycompany.com > vi authors.txt > cat authors.txt luca.frosini = luca.frosini <luca.frosini@isti.cnr.it> lucio.lelii = lucio.lelii <lucio.lelii@isti.cnr.it> manuele.simi = manuele.simi <manuele.simi@isti.cnr.it>
Clone the SVN repository
git svn clone --authors-file=authors.txt --follow-parent https://svn.d4science.research-infrastructures.eu/gcube/trunk/Common/gxREST --username manuele.simi gxRest Note: --follow-parent makes it slower, but it’s needed if the SVN folder has been moved around. Initialized empty Git repository in /Users/manuelesimi/GitMigration/gxRest/.git/ This may take a while on large repositories Checked through r173000 Checked Ahrough .classpath A idea/.idea/encodings.xml A idea/.idea/compiler.xml A idea/.idea/misc.xml A idea/.idea/vcs.xml A idea/.idea/.name A .project A pom.xml A gxJRS/.classpath A gxJRS/.project A gxJRS/distro/profile.xml A gxJRS/distro/LICENSE A gxJRS/distro/changelog.xml A gxJRS/distro/README A gxJRS/src/test/java/org/gcube/common/gxrest/request/GXWebTargetAdapterRequestTest.java A gxJRS/src/test/java/org/gcube/common/gxrest/request/GXHTTPStringRequestTest.java A gxJRS/src/test/resources/logback-test.xml A gxJRS/src/main/java/org/gcube/common/gxrest/methods/package-info.java A gxJRS/src/main/java/org/gcube/common/gxrest/request/GXHTTPStreamRequest.java A gxJRS/src/main/java/org/gcube/common/gxrest/request/package-info.java A gxJRS/src/main/java/org/gcube/common/gxrest/request/GXWebTargetAdapterRequest.java A gxJRS/src/main/java/org/gcube/common/gxrest/request/GXHTTPStringRequest.java A gxJRS/src/main/java/org/gcube/common/gxrest/response/outbound/CodeFinder.java A gxJRS/src/main/java/org/gcube/common/gxrest/response/outbound/ErrorCode.java A gxJRS/src/main/java/org/gcube/common/gxrest/response/outbound/LocalCodeException.java A gxJRS/src/main/java/org/gcube/common/gxrest/response/outbound/package-info.java A gxJRS/src/main/java/org/gcube/common/gxrest/response/outbound/GXOutboundSuccessResponse.java A gxJRS/src/main/java/org/gcube/common/gxrest/response/outbound/GXOutboundErrorResponse.java A gxJRS/src/main/java/org/gcube/common/gxrest/response/outbound/WebCodeException.java A gxJRS/src/main/java/org/gcube/common/gxrest/response/outbound/WebStreamException.java A gxJRS/src/main/java/org/gcube/common/gxrest/response/entity/StackTraceEncoder.java A gxJRS/src/main/java/org/gcube/common/gxrest/response/entity/package-info.java A gxJRS/src/main/java/org/gcube/common/gxrest/response/entity/CodeEntity.java A gxJRS/src/main/java/org/gcube/common/gxrest/response/entity/EntityTag.java A gxJRS/src/main/java/org/gcube/common/gxrest/response/entity/SerializableErrorEntity.java A gxJRS/src/main/java/org/gcube/common/gxrest/response/inbound/ExceptionDeserializer.java A gxJRS/src/main/java/org/gcube/common/gxrest/response/inbound/package-info.java A gxJRS/src/main/java/org/gcube/common/gxrest/response/inbound/ErrorCodeDeserializer.java A gxJRS/src/main/java/org/gcube/common/gxrest/response/inbound/JsonUtils.java A gxJRS/src/main/java/org/gcube/common/gxrest/response/inbound/GXInboundResponse.java A gxJRS/pom.xml A gxJRS/.settings/org.eclipse.jdt.core.prefs A gxJRS/.settings/org.eclipse.core.resources.prefs A .settings/org.eclipse.core.resources.prefs A gxHTTP/.classpath A gxHTTP/.project A gxHTTP/distro/profile.xml A gxHTTP/distro/LICENSE A gxHTTP/distro/changelog.xml A gxHTTP/distro/README A gxHTTP/src/test/java/org/gcube/common/gxhttp/GXHTTPStringRequestTest.java A gxHTTP/src/test/resources/logback-test.xml A gxHTTP/src/main/java/org/gcube/common/gxhttp/request/GXHTTPCommonRequest.java A gxHTTP/src/main/java/org/gcube/common/gxhttp/request/GXHTTPStreamRequest.java A gxHTTP/src/main/java/org/gcube/common/gxhttp/request/package-info.java A gxHTTP/src/main/java/org/gcube/common/gxhttp/request/GXHTTPStringRequest.java A gxHTTP/src/main/java/org/gcube/common/gxhttp/util/package-info.java A gxHTTP/src/main/java/org/gcube/common/gxhttp/util/ContentUtils.java A gxHTTP/src/main/java/org/gcube/common/gxhttp/reference/package-info.java A gxHTTP/src/main/java/org/gcube/common/gxhttp/reference/GXConnection.java A gxHTTP/src/main/java/org/gcube/common/gxhttp/reference/GXHTTP.java A gxHTTP/src/main/java/org/gcube/common/gxhttp/reference/GXHTTPRequestBuilder.java A gxHTTP/pom.xml A gxHTTP/.settings/org.eclipse.jdt.core.prefs A gxHTTP/.settings/org.eclipse.core.resources.prefs W: +empty_dir: gxHTTP/src/main/resources W: +empty_dir: gxJRS/src/main/resources W: +empty_dir: gxJRS/src/test/java/org/gcube/common/gxrest/response r178656 = 7bba7ebe6e18a6950926cb00e289efc771b6b6b8 (refs/remotes/git-svn) M .project r178659 = 523fde2f5894083841569bc61e9482bd0a8e143b (refs/remotes/git-svn) M pom.xml M gxJRS/pom.xml M gxHTTP/pom.xml r178711 = 69bac931ecb19023be916d7a897b5237bb45a6fe (refs/remotes/git-svn) M gxJRS/src/test/java/org/gcube/common/gxrest/request/GXHTTPStringRequestTest.java r178712 = 7993999be2a187943434ec519b9e627337aca60b (refs/remotes/git-svn) M gxJRS/src/main/java/org/gcube/common/gxrest/response/outbound/GXOutboundErrorResponse.java M gxJRS/src/main/java/org/gcube/common/gxrest/response/outbound/WebStreamException.java r178713 = 575c3daa758dec76658d97d20b003ec0e322e11f (refs/remotes/git-svn) M gxJRS/src/main/java/org/gcube/common/gxrest/response/entity/SerializableErrorEntity.java r178786 = 6eb3f608dbe31c50578e46c53e16c469a0cc7f0c (refs/remotes/git-svn) A gxJRS/src/main/java/org/gcube/common/gxrest/response/entity/SerializableErrorEntityTextWriter.java A gxJRS/src/main/java/org/gcube/common/gxrest/response/entity/SerializableErrorEntityTextReader.java M gxJRS/src/main/java/org/gcube/common/gxrest/response/entity/SerializableErrorEntity.java r178787 = ac04855b00de818f2095d0784eb68c51a6ec9f77 (refs/remotes/git-svn) Checked out HEAD: https://svn.d4science.research-infrastructures.eu/gcube/trunk/Common/gxREST r178787 creating empty directory: gxHTTP/src/main/resources creating empty directory: gxJRS/src/main/resources creating empty directory: gxJRS/src/test/java/org/gcube/common/gxrest/response
Rename “trunk” branch to “master” (if needed)
>git branch * trunk >git branch -m trunk master > git branch * master
Check the imported history
> git log -10 commit ac04855b00de818f2095d0784eb68c51a6ec9f77 Author: manuele.simi <manuele.simi@isti.cnr.it> Date: Sun Mar 31 03:39:06 2019 +0000 Add JAX-RS MessageBodyWriter/Reader responsible for converting SerializableErrorEntity to/from a stream. git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/Common/gxREST@178787 82a268e6-3cf1-43bd-a215-b396298e98cf commit 6eb3f608dbe31c50578e46c53e16c469a0cc7f0c Author: manuele.simi <manuele.simi@isti.cnr.it> Date: Sat Mar 30 19:58:21 2019 +0000 Tweak some javadoc. git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/Common/gxREST@178786 82a268e6-3cf1-43bd-a215-b396298e98cf
Add code-repo’s Git repository as new remote
> git remote add origin https://code-repo.d4science.org/manuele.simi/gxRest.git > git remote -v origin https://code-repo.d4science.org/manuele.simi/gxRest.git (fetch) origin https://code-repo.d4science.org/manuele.simi/gxRest.git (push)
Push the local repo to the new remote
> git push --set-upstream --force origin master Counting objects: 168, done. Delta compression using up to 4 threads. Compressing objects: 100% (125/125), done. Writing objects: 100% (168/168), 39.47 KiB | 0 bytes/s, done. Total 168 (delta 44), reused 0 (delta 0) remote: Resolving deltas: 100% (44/44), done. To https://code-repo.d4science.org/manuele.simi/gxRest.git + 4ec6b48...ac04855 master -> master (forced update) Branch master set up to track remote branch master from origin.
Clone the repo and create a working copy
> cd ~/Work/CNR/Projects/Git/ > git clone https://code-repo.d4science.org/manuele.simi/gxRest.git Cloning into 'gxRest'... remote: Counting objects: 168, done. remote: Compressing objects: 100% (81/81), done. remote: Total 168 (delta 44), reused 168 (delta 44) Receiving objects: 100% (168/168), 39.47 KiB | 0 bytes/s, done. Resolving deltas: 100% (44/44), done.
Fix authors info
Configure the local author info
> git config user.email "manuele.simi@isti.cnr.it" > git config user.name "Manuele Simi"
Configure the local author for all the Repos on my computer
> git config --global user.email "manuele.simi@isti.cnr.it" > git config --global user.name "Manuele Simi"