Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 # Introduction | |
| 2 | |
| 3 If you'd like to use git but you have only used subversion for chromium until no w, then you are faced with the prospect of cloning the entire repo again to star t using git or downloading a big rather old bootstrap tarball and updating from there. This sucks. However since git is all about **content** and since you alre ady have the content on your drive it is possible to cheat. This set of instruct ions will guide you through manually creating a new git repo that is the equival ent of your current svn repo without downloading stuff from the net. | |
|
Bons
2015/08/20 20:16:50
propose obsoletion since git is the standard now
| |
| 4 | |
| 5 Note that this procedure has only been lightly tested. You should try to underst and the commands presented here before you type them blindly. Run the commands o ne at a time so you can see if anything goes wrong or run them as another user f irst. **This method comes with no guarantees. If it eats your hard drive, sorry :(** | |
| 6 | |
| 7 # Details | |
| 8 ``` | |
| 9 # How to make a git repo from an existing subversion repo and be able to | |
| 10 # track svn changes with git svn without having to clone the whole | |
| 11 # subversion repo over the network again or download "bootstrap" tarballs etc. | |
| 12 # | |
| 13 # Assumptions: | |
| 14 # 1. your svn checkout is in ~/chromium(/src) and is pristine i.e. no build gene rated files | |
| 15 # 2. you have the latest git and svn installed | |
| 16 # 3. your new git repo will live in ~/chromium.git | |
| 17 # | |
| 18 # Note that this does a "shallow clone" of sorts i.e. you will only get | |
| 19 # history from this point onwards | |
| 20 | |
| 21 cd | |
| 22 mkdir chromium.git | |
| 23 # make a copy of your existing repo without the svn bits and pieces .. this take s a long time | |
| 24 # you should end up with a .gclient etc. in ~/chromium.git as well as a result o f this | |
| 25 ( cd ~/chromium && tar --exclude '*.svn*' -cf - . ) | (cd ~/chromium.git/ && tar -xpf - ) | |
| 26 cd ~/chromium.git/src | |
| 27 git init | |
| 28 # tell git to ignore some of the files - taken from git page on chromium.org | |
| 29 echo "*.pyc" >> .git/info/exclude | |
| 30 # Some Visual Studio files, only necessary on Windows: | |
| 31 echo -e "*.user\n*.ncb\n*.suo" >> .git/info/exclude | |
| 32 # Hammer: Linux build output | |
| 33 echo "/chrome/Hammer" >> .git/info/exclude | |
| 34 # Debug/Release: Windows build output | |
| 35 echo "/chrome/Debug" >> .git/info/exclude | |
| 36 echo "/chrome/Release" >> .git/info/exclude | |
| 37 # Ignore directories managed by gclient. | |
| 38 sed -ne 's/[^"]*"src\(.*\)".*/\1/p' DEPS >> .git/info/exclude | |
| 39 # We didn't copy the svn metadata for the gclient managed directories | |
| 40 # and since gclient manages them through svn, we want that | |
| 41 sed -ne 's/[^"]*"src\(.*\)".*/\1/p' DEPS | (cd ~/chromium/src/ ; xargs -I ’{}’ f ind .’{}’ -name '.svn' -print; ) | ( cd ~/chromium/src/ ; xargs tar -cf - ) | (c d ~/chromium.git/src/ ; tar -xpf - ) | |
| 42 # Now add the actual files that aren't being ignored to git | |
| 43 # we need to quote this so that git does the wildcard expansion I think | |
| 44 git add '*' | |
| 45 # git svn parses log messages to figure out what the previous revision was | |
| 46 # but we haven't used git svn to clone anything so we must commit with the | |
| 47 # right message to fool it. | |
| 48 # The big juicy hex number is the uuid of the subversion repository. | |
| 49 # You should change 7544 to whatever revision you subversion checkout is at. | |
| 50 git commit -m 'git-svn-id: http://src.chromium.org/svn/trunk/src@7544 4ff67af0-8 c30-449e-8e8b-ad334ec8d88c' | |
| 51 # might as well pack things for faster access | |
| 52 git gc | |
| 53 # taken from some tutorial on the net about git svn and svk ... | |
| 54 git update-ref refs/remotes/git-svn master | |
| 55 git svn init http://src.chromium.org/svn/trunk/src | |
| 56 # manually create the metadata git svn needs | |
| 57 cat > .git/svn/.metadata | |
| 58 ; This file is used internally by git-svn | |
| 59 ; You should not have to edit it | |
| 60 [svn-remote "svn"] | |
| 61 uuid = 4ff67af0-8c30-449e-8e8b-ad334ec8d88c | |
| 62 reposRoot = http://src.chromium.org/svn | |
| 63 | |
| 64 press ctrl-D | |
| 65 | |
| 66 # if everything worked the command below should say something useful and rebuild a rev map | |
| 67 git svn info | |
| 68 # now you can update the svn branch | |
| 69 git svn fetch | |
| 70 # and merge into master | |
| 71 git merge git-svn | |
| 72 # and view cool stuff | |
| 73 gitk | |
| 74 ``` | |
| OLD | NEW |