Changes between Initial Version and Version 2 of Ticket #16944
- Timestamp:
- 2018-11-04T19:58:13+01:00 (7 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #16944 – Description
initial v2 1 1 Split to 4 scripts to make it easier to restart script on errors 2 * git_migrate-1-init.sh 2 3 {{{#!bash 3 #!/ usr/bin/env bash4 #!/bin/sh 4 5 5 6 set -e … … 14 15 ### 15 16 16 git svn init --trunk=. --prefix=svn_jmapviewer -R jmapviewer \ 17 https://svn.openstreetmap.org/applications/viewer/jmapviewer 17 git svn init --trunk=. --prefix=svn_jmapviewer -R jmapviewer https://svn.openstreetmap.org/applications/viewer/jmapviewer 18 18 git svn init --trunk=. --prefix=svn_josm -R josm https://josm.openstreetmap.de/svn/trunk 19 19 # two separate remotes for commons as this is 2x ~10 minutes instead of 2+ houres to fetch 20 git svn init --trunk=. --include-paths='commons/proper/jcs/trunk/.*src/main/java/org/apache/commons/jcs' \ 21 --prefix=svn_commons_jcs -R svn_commons_jcs https://svn.apache.org/repos/asf/commons/proper/jcs/ 22 git svn init --trunk=. --include-paths='commons/proper/logging/trunk/src/main/java/org/apache/commons/logging' \ 23 --prefix=svn_commons_logging -R svn_commons_logging https://svn.apache.org/repos/asf/commons/proper/logging/trunk/ 20 git svn init --trunk=. --include-paths='commons/proper/jcs/trunk/.*src/main/java/org/apache/commons/jcs' --prefix=svn_commons_jcs -R svn_commons_jcs https://svn.apache.org/repos/asf/commons/proper/jcs/ 21 git svn init --trunk=. --include-paths='commons/proper/logging/trunk/src/main/java/org/apache/commons/logging' --prefix=svn_commons_logging -R svn_commons_logging https://svn.apache.org/repos/asf/commons/proper/logging/trunk/ 24 22 git remote add commons_compress https://github.com/apache/commons-compress.git 25 23 24 echo Done 25 }}} 26 * git_migrate-2-fetch.sh 27 {{{#!bash 28 #!/bin/sh 29 30 set -e 31 32 cd josm-tests 26 33 ### 27 34 # fetch from remotes … … 35 42 git fetch commons_compress 36 43 44 echo Done 45 }}} 46 * git_migrate-3-prepare.sh 47 {{{#!bash 48 #!/bin/sh 37 49 50 set -e 51 52 cd josm-tests 38 53 ### 39 54 # Reorganize externals … … 41 56 42 57 # JMapViewer 43 git branch svn_jmapviewer_rewrite remotes/svn_jmapviewertrunk 58 git branch -f svn_jmapviewer_rewrite remotes/svn_jmapviewertrunk 44 59 git filter-branch -f --tree-filter ' 45 60 if [ -d src/org/openstreetmap/gui/jmapviewer ] ; then … … 62 77 # compress is already on git, need first to somehow mix with other repositories (using commit date, not author date) 63 78 # as commits sorted by date do not constitue the history. 64 # So first - order by commit date and mix, then filter the content 65 # For now it generates a few merge conflicts 66 # TODO: can it be done using --index-filter? 67 git branch svn_commons_compress_rewrite remotes/commons_compress/master 68 git filter-branch -f --tree-filter ' 69 if [ -d src/main/java ] ; then 70 git mv src src.new && 71 find . -depth 1 | 72 grep -v ^./src.new | grep -v ^./.git$ | 73 xargs -r git rm -fr && 74 git mv src.new/main/java src && 75 git rm -rf --ignore-unmatch src.new 76 else 77 find . -depth 1 | 78 grep -v ^./.git$ | 79 xargs -r git rm -fr 80 fi' \ 79 # first - create subdirectory where all commons-compress files will go 80 git branch -f svn_commons_compress_rewrite remotes/commons_compress/master 81 git filter-branch -f --index-filter " 82 git ls-files -s | sed -e \$'s#\t#\tcommons-compress/#' | 83 GIT_INDEX_FILE=\$GIT_INDEX_FILE.new git update-index --index-info && 84 if [ -f \$GIT_INDEX_FILE.new ] ; then mv \$GIT_INDEX_FILE.new \$GIT_INDEX_FILE ; fi" \ 81 85 svn_commons_compress_rewrite 86 82 87 # Apache Commons JCS 83 git branch svn_commons_jcstrunk_rewrite remotes/svn_commons_jcstrunk 88 git branch -f svn_commons_jcstrunk_rewrite remotes/svn_commons_jcstrunk 84 89 git filter-branch -f --tree-filter ' 85 90 if [ -d trunk/commons-jcs-core/src/main/java/ ] ; then … … 97 102 98 103 # Apache Commons Logging 99 git branch svn_commons_loggingtrunk_rewrite remotes/svn_commons_loggingtrunk 104 git branch -f svn_commons_loggingtrunk_rewrite remotes/svn_commons_loggingtrunk 100 105 git filter-branch -f --tree-filter ' 101 106 if [ -d src/main/java ] ; then … … 114 119 115 120 ### 121 # Linearlize commons_compress history 122 ### 123 124 git branch -f svn_commons_compress_clean svn_commons_compress_rewrite 125 git filter-branch -f --parent-filter 'cut -f 2,3 -d " "' svn_commons_compress_clean 126 127 ### 116 128 # Remove empty commits 117 129 ### 118 130 119 for i in svn_jmapviewer svn_commons_ compress svn_commons_jcstrunk svn_commons_loggingtrunk ; do120 git branch "${i}_clean" "${i}_rewrite" 131 for i in svn_jmapviewer svn_commons_jcstrunk svn_commons_loggingtrunk ; do 132 git branch -f "${i}_clean" "${i}_rewrite" 121 133 git rebase $(git log --reverse --oneline --no-abbrev-commit "${i}_clean" | head -n 1 | cut -d ' ' -f 1) "${i}_clean" || exit 1 122 134 done 135 }}} 136 * git_migrate-4-merge.sh 137 {{{#!bash 138 #!/bin/sh 139 140 set -e 141 142 cd josm-tests 123 143 124 144 ### … … 134 154 JOSM_EPOCH=$(head -n 1 ${REBASE_CONF} | cut -d ' ' -f1 ) 135 155 ( 136 git log --pretty="format:%at %H %s" svn_commons_compress_rewrite 137 git log --pretty="format:%at %H %s" svn_commons_jcstrunk_rewrite 138 git log --pretty="format:%at %H %s" svn_commons_loggingtrunk_rewrite 139 ) | awk -F ' ' "\$1 > ${JOSM_EPOCH} {print \$1 \" \" \$2} {}" >> "${REBASE_CONF}" 156 #git log --ancestry-path --pretty="format:%ct %H %s" \ 157 # $(git log --reverse --oneline --no-abbrev-commit svn_commons_compress_rewrite | 158 # head -n 1 | cut -d ' ' -f 1)..svn_commons_compress_rewrite # we are not rebasing this, to preserve commit timestamps which we use here 159 git log --first-parent --pretty="format:%at %H %s" svn_commons_compress_clean 160 git log --pretty="format:%at %H %s" svn_commons_jcstrunk_clean 161 git log --pretty="format:%at %H %s" svn_commons_loggingtrunk_clean 162 # could use it: 163 # | awk -F ' ' "\$1 > ${JOSM_EPOCH} {print \$1 \" \" \$2} {}" >> "${REBASE_CONF}" 164 # to keep only history after fist JOSM commit, but we would need to squash all the previous history into one commit 165 ) >> "${REBASE_CONF}" 140 166 141 167 sort -n ${REBASE_CONF} | cut -d ' ' -f2 | sed -e 's/^/p /' > ../rebase_config … … 144 170 git checkout master 145 171 git rebase --keep-empty -i $(git log --reverse --oneline --no-abbrev-commit | head -n 1 | cut -d ' ' -f 1) 172 173 # fix Apache Commons Compress paths 174 git filter-branch -f --tree-filter ' 175 if [ -d commons-compress/src/main/java ] ; then 176 mkdir -p src/java/org/apache/commons/ 177 git mv commons-compress/src/main/java/org/apache/commons/compress src/java/org/apache/commons/ && 178 find commons-compress -depth 1 | 179 xargs -r git rm -fr 180 else 181 find commons-compress -depth 1 | 182 xargs -r git rm -fr 183 fi' \ 184 master 146 185 147 186 # helpful one-liner: git diff --name-only --diff-filter=U | xargs git checkout ...


