Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(832)

Unified Diff: docs/migrating_from_subversion_to_git.md

Issue 1309473002: WIP: Migrate Wiki content over to src/docs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: docs/migrating_from_subversion_to_git.md
diff --git a/docs/migrating_from_subversion_to_git.md b/docs/migrating_from_subversion_to_git.md
new file mode 100644
index 0000000000000000000000000000000000000000..fbfac19ff56afce4527d32a8c9aa7a485e6e19ef
--- /dev/null
+++ b/docs/migrating_from_subversion_to_git.md
@@ -0,0 +1,74 @@
+# Introduction
+
+If you'd like to use git but you have only used subversion for chromium until now, then you are faced with the prospect of cloning the entire repo again to start 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 already have the content on your drive it is possible to cheat. This set of instructions will guide you through manually creating a new git repo that is the equivalent 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
+
+Note that this procedure has only been lightly tested. You should try to understand the commands presented here before you type them blindly. Run the commands one at a time so you can see if anything goes wrong or run them as another user first. **This method comes with no guarantees. If it eats your hard drive, sorry :(**
+
+# Details
+```
+# How to make a git repo from an existing subversion repo and be able to
+# track svn changes with git svn without having to clone the whole
+# subversion repo over the network again or download "bootstrap" tarballs etc.
+#
+# Assumptions:
+# 1. your svn checkout is in ~/chromium(/src) and is pristine i.e. no build generated files
+# 2. you have the latest git and svn installed
+# 3. your new git repo will live in ~/chromium.git
+#
+# Note that this does a "shallow clone" of sorts i.e. you will only get
+# history from this point onwards
+
+cd
+mkdir chromium.git
+# make a copy of your existing repo without the svn bits and pieces .. this takes a long time
+# you should end up with a .gclient etc. in ~/chromium.git as well as a result of this
+( cd ~/chromium && tar --exclude '*.svn*' -cf - . ) | (cd ~/chromium.git/ && tar -xpf - )
+cd ~/chromium.git/src
+git init
+# tell git to ignore some of the files - taken from git page on chromium.org
+echo "*.pyc" >> .git/info/exclude
+# Some Visual Studio files, only necessary on Windows:
+echo -e "*.user\n*.ncb\n*.suo" >> .git/info/exclude
+# Hammer: Linux build output
+echo "/chrome/Hammer" >> .git/info/exclude
+# Debug/Release: Windows build output
+echo "/chrome/Debug" >> .git/info/exclude
+echo "/chrome/Release" >> .git/info/exclude
+# Ignore directories managed by gclient.
+sed -ne 's/[^"]*"src\(.*\)".*/\1/p' DEPS >> .git/info/exclude
+# We didn't copy the svn metadata for the gclient managed directories
+# and since gclient manages them through svn, we want that
+sed -ne 's/[^"]*"src\(.*\)".*/\1/p' DEPS | (cd ~/chromium/src/ ; xargs -I ’{}’ find .’{}’ -name '.svn' -print; ) | ( cd ~/chromium/src/ ; xargs tar -cf - ) | (cd ~/chromium.git/src/ ; tar -xpf - )
+# Now add the actual files that aren't being ignored to git
+# we need to quote this so that git does the wildcard expansion I think
+git add '*'
+# git svn parses log messages to figure out what the previous revision was
+# but we haven't used git svn to clone anything so we must commit with the
+# right message to fool it.
+# The big juicy hex number is the uuid of the subversion repository.
+# You should change 7544 to whatever revision you subversion checkout is at.
+git commit -m 'git-svn-id: http://src.chromium.org/svn/trunk/src@7544 4ff67af0-8c30-449e-8e8b-ad334ec8d88c'
+# might as well pack things for faster access
+git gc
+# taken from some tutorial on the net about git svn and svk ...
+git update-ref refs/remotes/git-svn master
+git svn init http://src.chromium.org/svn/trunk/src
+# manually create the metadata git svn needs
+cat > .git/svn/.metadata
+; This file is used internally by git-svn
+; You should not have to edit it
+[svn-remote "svn"]
+ uuid = 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
+ reposRoot = http://src.chromium.org/svn
+
+press ctrl-D
+
+# if everything worked the command below should say something useful and rebuild a rev map
+git svn info
+# now you can update the svn branch
+git svn fetch
+# and merge into master
+git merge git-svn
+# and view cool stuff
+gitk
+```

Powered by Google App Engine
This is Rietveld 408576698