« Site upgrades | Using Haystack to index non-database content »
In my work in ReadTheDocs, we now support all of the major VCS repositories: svn, bzr, hg, and git. At this point in time we're only checking out the repos to their default branches, and then trying to trying to update them again to another revision. While writing this code I have had at least 3 different bugs that caused the repos not to be updated correctly. So I'm going to detail here the exact code that allows me to do this for each of these types of repos, hopefully so that when you or I need to do this in the future, we can at least start from here.
Let me know if any of these are wrong, because they probably are.
Checking out a repo:
git clone --depth=1 <remote_url> <local_filepath>
Updating a repo:
git --git-dir=.git fetch
git --git-dir=.git reset --hard origin/master
I'm specifying the --git-dir here because my master repository is git as well, and I don't want to risk the git commands cascading up and applying to the outer repository. I'm also specifying --depth=1 so that I don't clone the entire repository, but only the latest commit. I don't need the history, so I'm doing this. As you can tell, I'm more familiar with git than the other VCS systems here.
Checking out a repo:
svn checkout <remote_url> <local_filepath>
Updating a repo:
svn revert --recursive .
svn up --accept theirs-full
I ran into problems here where I was calling revert without recursive and it wasn't doing anything! You need to do this from the top-level of the repo, and it will make sure all the state lower in the repo is reverted.
Checking out a repo:
bzr checkout <remote_url> <local_filepath>
Updating a repo:
bzr revert
bzr up
This one is nice and easy.
Checking out a repo:
hg clone <remote_url> <local_filepath>
Updating a repo:
hg pull
hg update -C .
Again, a slightly different syntax to make sure that you're deleting all the files, and with the update command.
I hope this helps people in the future at least get to the point where they can pull down code and update it. My next task is figuring out how to support branching in all of the different repositories which is going to be fun, because they have different filesystem structures.
Posted at 9:28 p.m. on November 15, 2010
Comments: 0
Tags: bzr , django , git , hg , svn , vcs hell
Django on Github
Should reusable apps have templates?
Announcing Django Crawler and django-test-utils
Welcome to the home of Eric Holscher on the web. I talk about software development, mostly in the realm of Django. I am interested in the real time web, testing, mobile apps, and other things.
Why Read the Docs matters
1 month ago (Comments: 7)
Read the Docs Update
10 months, 2 weeks ago (Comments: 2)
Using Reviewboard with Git
1 year ago (Comments: 0)
Read the Docs Updates
1 year, 1 month ago (Comments: 1)
Handling Django Settings Files
1 year, 1 month ago (Comments: 12)
Required Reading
1 year, 3 months ago (Comments: 0)
Using Haystack to index non-database content
1 year, 3 months ago (Comments: 4)
Correct commands to check out and update VCS repos
1 year, 3 months ago (Comments: 0)
Site upgrades
1 year, 3 months ago (Comments: 0)
Building a Django App Server with Chef: Part 4
1 year, 3 months ago (Comments: 1)
Setting up Django and mod_wsgi
Building a Django App Server with Chef: Part 1
Screencast: Django Command Extensions
Big list of Django tips (and some python tips too)
Handling Django Settings Files
Lessons Learned From The Dash: Easy Django Deployment
Large Problems in Django, Mostly Solved: Delayed Execution
Building a Django App Server with Chef: Part 2

