Advertisement
Guest User

Untitled

a guest
Mar 6th, 2016
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.66 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # To use this, git svn clone the NHibernate repo into an nh-git folder. Use the -s option and no other options.
  4. # Patrick has a current synced copy on his system.
  5.  
  6. # These people don't seem to appear in any commits. For whatever reason, we are missing hundreds of commits.
  7. # Use this command to get a new list when we find our missing branches.
  8. # git log --format "%aN" | sort -u
  9. # johntmorris=John Morris <johntmorris@users.sourceforge.net>
  10. # jimcool=Jakub MArsik <jimcool@users.sourceforge.net>
  11. # luggage=Donald L Mull Jr. <luggage@users.sourceforge.net>
  12. # jerryshea2=Jerry Shea <jerryshea2@users.sourceforge.net>
  13. # Another e-mail address:
  14. # Sergey : sergey.p.k@gmail.com
  15.  
  16. # Exit on any error.
  17. set -e
  18.  
  19. function phase1 {
  20.  
  21. echo ""
  22. echo "*************************************************************************"
  23. echo "* Copying repository before starting work."
  24. echo "*************************************************************************"
  25. rm -rf nh-git2
  26. cp -r nh-git nh-git2
  27. cd nh-git2
  28.  
  29. echo ""
  30. echo "*************************************************************************"
  31. echo "* Converting remotes into tags and branches"
  32. echo "*************************************************************************"
  33. git for-each-ref --format='%(refname)' refs/remotes/tags | cut -d / -f 4 | while read ref; do git tag "$ref" "refs/remotes/tags/$ref"; git branch -r -D "tags/$ref"; done
  34. git for-each-ref --format='%(refname)' refs/remotes | cut -d / -f 3 | while read ref; do git branch "$ref" "refs/remotes/$ref"; git branch -r -D "$ref"; done
  35. # Remove trunk since we have master.
  36. git branch -D trunk
  37.  
  38. echo ""
  39. echo "*************************************************************************"
  40. echo "* Cloning bare repository"
  41. echo "*************************************************************************"
  42. cd ..
  43. rm -rf NHibernate.git
  44. git clone --bare nh-git2 NHibernate.git
  45. cd NHibernate.git
  46.  
  47. echo ""
  48. echo "*************************************************************************"
  49. echo "* Fixing branches that came from src folder instead of nhibernate folder"
  50. echo "*************************************************************************"
  51. git filter-branch --tree-filter "if test -d src; then mkdir nhibernate; ls | grep -v nhibernate | xargs -i mv '{}' nhibernate; fi" -- --all
  52.  
  53. cd ..
  54.  
  55. } # End phase1. We now have NHibernate.git, a bare repository.
  56.  
  57. function rebasebranches {
  58.  
  59. rm -rf NHibernate.working
  60. git clone NHibernate.git NHibernate.working
  61. cd NHibernate.working
  62.  
  63. ########### Record of branches with "src" folders.
  64. # Ref 'refs/heads/LazyProps' was rewritten
  65. # Ref 'refs/heads/LazyProps@4916' was rewritten
  66. # Ref 'refs/heads/Linq%20to%20Nhibernate' was rewritten
  67. # Ref 'refs/heads/Linq%20to%20Nhibernate@4455' was rewritten
  68. # Ref 'refs/heads/static-proxies' was rewritten
  69. # Ref 'refs/heads/static-proxis' was rewritten
  70. # Ref 'refs/heads/static-proxis@3822' was rewritten
  71. # Ref 'refs/tags/1.2.0.Beta1' was rewritten
  72. # Ref 'refs/tags/1.2.0.Beta1@2281' was rewritten
  73.  
  74. # Rebase from 676a2fa550c0eb3c020b89cff149ac572d91135d (exclusive) to ead9f1a166f5d721b2206e17bad34317f5d7577c
  75. # as static-proxies onto 95fa87e1d3d7acd6eccef959be0fa9c671a6683a
  76. # 2008-10-09
  77. git branch static-proxies-branch 95fa87e1d3d7acd6eccef959be0fa9c671a6683a
  78. git checkout static-proxies-branch
  79. git cherry-pick ce10fe6fefedf008c5d4b0889890c4287920f824
  80. git cherry-pick ead9f1a166f5d721b2206e17bad34317f5d7577c
  81. git branch -rd "origin/static-proxies"
  82. git branch -rd "origin/static-proxis"
  83. git branch -rd "origin/static-proxis@3822"
  84. git checkout master
  85.  
  86. # Fix up 1.2.0.Beta1 tag that was based on a "src" tree.
  87. git tag -d "1.2.0.Beta1@2281"
  88. git tag -f 1.2.0.Beta1 f3e4c37d56b6b24951af9804963af6b033422a53
  89.  
  90. # Remove erroneous 1.2.x tag.
  91. git tag -d 1.2.x
  92.  
  93. # Remember the end of a few branches.
  94. git tag end-of-branch-alpha_avalon-proxy origin/alpha_avalon-proxy
  95. git branch -rd origin/alpha_avalon-proxy
  96. git tag end-of-branch-ReadOnlyEntities origin/ReadOnlyEntities
  97. git branch -rd origin/ReadOnlyEntities
  98. git tag end-of-branch-static-proxies static-proxies-branch
  99. git branch -D static-proxies-branch
  100.  
  101. # Remove branches that are included elsewhere or have no content.
  102. git branch -rd "origin/Linq%20to%20Nhibernate"
  103. git branch -rd "origin/Linq%20to%20Nhibernate@4455"
  104. git branch -rd "origin/HibernatePortOfReadOnlyCriteria"
  105. git branch -rd "origin/ReadOnlyCriteria"
  106. git branch -rd "origin/v10branch"
  107. git branch -rd "origin/query-translator"
  108. git branch -rd "origin/LazyProps"
  109. git branch -rd "origin/LazyProps@4916"
  110.  
  111. # Create local branches for remaining tracking branches.
  112. git branch 1.2.x origin/1.2.x
  113. git branch 2.0.x origin/2.0.x
  114. git branch 2.1.x origin/2.1.x
  115.  
  116. cd ..
  117.  
  118. }
  119.  
  120. function retag {
  121.  
  122. cd NHibernate.working
  123.  
  124. # Retag to remove empty commits.
  125. git tag -f 3.2.0GA 38e940a8deb2ea18732def9f7f9ffdfddd729b0e
  126. git tag -f 3.2.0.Alpha2 f90358fd8b9e6ca948305ece19d2952d4e8fdf01
  127. git tag -f 3.2.0.Alpha1 273a753e54af961cfd59602d468a981d5a0e8363
  128. git tag -f 3.1.0GA 7d80fe1139baed12bb35127d83fad680d8b68a0f
  129. git tag -f 3.0.0GA 61adbc010d707c88247e324280467b8c258bba20
  130. git tag -f 3.0.0.Alpha1 d9d112890732fa0a1ddfc16daab50a3759e36a86
  131. git tag -f 2.1.1GA 03b5ccb2aadb3239b01469b8abc2960481f01a8f
  132. git tag -f 2.1.0GA 1e3f44260d6c8a7f721babd39cb09577d531bb96
  133. git tag -f 2.0.0.Alpha1 63787149e7b9633604950fba1e33579a8aaa184f
  134. git tag -f 1.2.1.GA 072dce857433b670e47831d577cf3fcd65836e78
  135. git tag -f 1.2.0.GA b145adfc3cd3677b843b6fdb9e64aa162a4c3201
  136. git tag -f 1.2.0.CR2 1def2692e7b7aaa80864de0d06a772dee2d4a295
  137. git tag -f 1.2.0.CR1 5039666b6e7811eb9037d4c30c947450f9c749a3
  138. git tag -f 1.2.0.Beta3 80ca1da5e0d70ce5facdbc539df29493ac74dcba
  139. git tag -f 1.2.0.Beta2 cc403efbcad812d26314327433273930a6cac631
  140. git tag -f 1.2.0.Alpha1 df10d864a709bbd81d77928fde9cdd6a17cea3ad
  141. git tag -f 1.0.4 ee7ff68312d0eb2a53aafe5736d154e258ffea37
  142. git tag -f 1.0.3 2fb610a7bf387951852d5a77b430b2da9b369419
  143. git tag -f rc_0-99-1-0 bdbab65b3c39b259603f3f22fb13701950685860
  144. git tag -f beta_0-9-1-0 3ea855f641438eb1879e9b4f246d3f5875fc0597
  145. git tag -f beta_0-9-0-0 46a3afc40a486f1aae0ab25e3c9d8cf6a34f8eab
  146. git tag -f beta_0-8-4-0 f0368f393ba34d173cda975de95397397f835868
  147. git tag -f beta_0-8-3-0 6949a58cb072c4e9efe9827b63c145f8fa60bd13
  148. git tag -f beta_0-8-2-0 5d605d390d1cb4622f6f02f40ba3753c7b9663fc
  149. git tag -f beta_0-8-1-0 978f13732ebc822e18654874a3be03a7c40d71c2
  150. git tag -f beta_0-8-0-0 bf90c2a0adb952fba86a3f06d3c98253c9e30f84
  151. git tag -f Pre_2-1_Refactor e752e2a8df06aca42d660422deae12c729ca98d4
  152. git tag -f beta_0-6-0-0 41babe7c8941b3fd7f757f90f01c2ab4871c7073
  153. git tag -f alpha_0-4-0-0 3bbc3ed3e88878af40be8880a20a670a39ab0366
  154. git tag -f alpha_0-3-0-0_pre-avalon-proxy b42b4953564e95041df84890d928a801af394edb
  155. git tag -f alpha_0-3-0-0 2c044594682f0308867bdf56933b6488c7a7c34c
  156. git tag -f alpha_0-2-0-0 b28784618eea72b6757ec46bd640ac371f546271
  157. git tag -f prealpha_0-1-0-0 f8b978b3e1845daec77c513a8aecb338c29b653e
  158.  
  159. cd ..
  160.  
  161. }
  162.  
  163. function rewriteauthors {
  164.  
  165. rm -rf NHibernate-Authors.git
  166. git clone --bare NHibernate.working NHibernate-Authors.git
  167. cd NHibernate-Authors.git
  168.  
  169. echo ""
  170. echo "*************************************************************************"
  171. echo "* Rewriting all author names and e-mail addresses."
  172. echo "*************************************************************************"
  173. # Typo present in converted repository.
  174. #if [ "$GIT_AUTHOR_NAME" = "(no author)" ]; then am="(no auunknown)"$suffix; fi
  175. git filter-branch --env-filter '
  176. an="$GIT_AUTHOR_NAME"
  177. am="$GIT_AUTHOR_EMAIL"
  178. suffix="@users.sourceforge.net"
  179.  
  180. if [ "$GIT_AUTHOR_NAME" = "(no author)" ]; then am="(no author)"$suffix; fi
  181. if [ "$GIT_AUTHOR_NAME" = "RicBrown" ]; then an="Richard Brown"; am="flukefan@googlemail.com"; fi
  182. if [ "$GIT_AUTHOR_NAME" = "ayenderahien" ]; then an="Ayende Rahien"; am="ayende@ayende.com"; fi
  183. if [ "$GIT_AUTHOR_NAME" = "billhawes" ]; then an="Bill Hawes"; am="billhawes"$suffix; fi
  184. if [ "$GIT_AUTHOR_NAME" = "chadly69" ]; then an="Chad Lee"; am="chadly69"$suffix; fi
  185. if [ "$GIT_AUTHOR_NAME" = "crowdozer" ]; then an="Jim Bolla"; am="crowdozer"$suffix; fi
  186. if [ "$GIT_AUTHOR_NAME" = "darioquintana" ]; then an="Dario Quintana"; am="darioquintana"$suffix; fi
  187. if [ "$GIT_AUTHOR_NAME" = "davybrion" ]; then an="Davy Brion"; am="davybrion"$suffix; fi
  188. if [ "$GIT_AUTHOR_NAME" = "demanic" ]; then an="Demetris Manikas"; am="demanic"$suffix; fi
  189. if [ "$GIT_AUTHOR_NAME" = "edgarsanchez" ]; then an="Edgar Sanchez"; am="edgarsanchez"$suffix; fi
  190. if [ "$GIT_AUTHOR_NAME" = "fabiomaulo" ]; then an="Fabio Maulo"; am="fabiomaulo@gmail.com"; fi
  191. if [ "$GIT_AUTHOR_NAME" = "ifof" ]; then an="ifof"; am="ifof"$suffix; fi
  192. if [ "$GIT_AUTHOR_NAME" = "julian-maughan" ]; then an="Julian Maughan"; am="julian.maughan@gmail.com"; fi
  193. if [ "$GIT_AUTHOR_NAME" = "justme84" ]; then an="Sergey Koshcheyev"; am="justme84"$suffix; fi
  194. if [ "$GIT_AUTHOR_NAME" = "karlchu" ]; then an="Karl Chu"; am="karlchu"$suffix; fi
  195. if [ "$GIT_AUTHOR_NAME" = "kevinwilliams" ]; then an="Kevin Williams"; am="kevinwilliams"$suffix; fi
  196. if [ "$GIT_AUTHOR_NAME" = "kpixel" ]; then an="Pierre Henri Kuate"; am="kpixel"$suffix; fi
  197. if [ "$GIT_AUTHOR_NAME" = "mikedoerfler" ]; then an="Mike Doerfler"; am="mikedoerfler"$suffix; fi
  198. if [ "$GIT_AUTHOR_NAME" = "mthird" ]; then an="Michael Third"; am="mthird"$suffix; fi
  199. if [ "$GIT_AUTHOR_NAME" = "patearl" ]; then an="Patrick Earl"; am="patearl@patearl.net"; fi
  200. if [ "$GIT_AUTHOR_NAME" = "phatcher" ]; then an="Paul Hatcher"; am="phatcher"$suffix; fi
  201. if [ "$GIT_AUTHOR_NAME" = "pwistrand" ]; then an="Paul Wistrand"; am="pwistrand"$suffix; fi
  202. if [ "$GIT_AUTHOR_NAME" = "ricbrown" ]; then an="Richard Brown"; am="flukefan@googlemail.com"; fi
  203. if [ "$GIT_AUTHOR_NAME" = "sbohlen" ]; then an="Steve Bohlen"; am="sbohlen@gmail.com"; fi
  204. if [ "$GIT_AUTHOR_NAME" = "steverstrong" ]; then an="Steve Strong"; am="steverstrong"$suffix; fi
  205. if [ "$GIT_AUTHOR_NAME" = "szoke" ]; then an="Peter Smulovics"; am="szoke"$suffix; fi
  206. if [ "$GIT_AUTHOR_NAME" = "tehlike" ]; then an="Tuna Toksoz"; am="tehlike"$suffix; fi
  207. if [ "$GIT_AUTHOR_NAME" = "theoalbers" ]; then an="theoalbers"; am="theoalbers"$suffix; fi
  208. if [ "$GIT_AUTHOR_NAME" = "tjb300" ]; then an="Tom Barrett"; am="tjb300"$suffix; fi
  209. if [ "$GIT_AUTHOR_NAME" = "woil" ]; then an="Will Shaver"; am="woil"$suffix; fi
  210.  
  211. export GIT_AUTHOR_NAME="$an"
  212. export GIT_AUTHOR_EMAIL="$am"
  213. export GIT_COMMITTER_NAME="$an"
  214. export GIT_COMMITTER_EMAIL="$am"
  215. ' -- --all
  216.  
  217. cd ..
  218.  
  219. }
  220.  
  221. function rewritelogs {
  222.  
  223. cd NHibernate-Authors.git
  224.  
  225. git filter-branch -f --msg-filter "sed 's/ c763bc11-fa2b-4e64-94e3-9b040f81b1a0//g'" -- --all
  226. git filter-branch -f --msg-filter "sed 's,git-svn-id: file:///home/patearl/nh/,SVN: ,g'" -- --all
  227.  
  228. cd ..
  229.  
  230. }
  231.  
  232. function changeroot {
  233.  
  234. cd NHibernate-Authors.git
  235.  
  236. echo ""
  237. echo "*************************************************************************"
  238. echo "* Removing root level nhibernate folder."
  239. echo "*************************************************************************"
  240. git filter-branch -f --tree-filter "if test -d nhibernate; then find nhibernate -maxdepth 1 -mindepth 1 -exec mv {} . \\;; rmdir nhibernate; fi" -- --all
  241.  
  242. cd ..
  243.  
  244. }
  245.  
  246. function cleanup {
  247.  
  248. cd NHibernate-Authors.git
  249.  
  250. echo ""
  251. echo "*************************************************************************"
  252. echo "* Collect garbage."
  253. echo "*************************************************************************"
  254. git gc
  255.  
  256. echo ""
  257. echo "*************************************************************************"
  258. echo "* Checking out source for examination into NHibernate.converted."
  259. echo "*************************************************************************"
  260. cd ..
  261. rm -rf NHibernate.converted
  262. git clone NHibernate-Authors.git NHibernate.converted
  263.  
  264. }
  265.  
  266. function recreatebranches {
  267.  
  268. cd NHibernate.converted
  269. git for-each-ref --format='%(refname)' | grep remotes | grep -v HEAD | grep -v master | cut -d / -f 4 | while read ref; do git branch $ref origin/$ref; done
  270. cd ..
  271.  
  272. }
  273.  
  274. ######## MAIN EXECUTION
  275.  
  276. phase1
  277. rebasebranches
  278. retag
  279. rewriteauthors
  280. rewritelogs
  281. changeroot
  282. cleanup
  283. recreatebranches
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement