How does it all work?
LiveJournal source code is stored in several separate SVN repositories. The files
from these are merged into a single live tree. The live tree is your home
directory. It contains the code that actually runs on your server. This is the
code you edit and play with. The SVN trees are all stored below
. The
$/cvs/LJHOME…/cvs directory is a holdover,
from when the LiveJournal project used CVS for version
control.
The cvsreport.pl script lets you update the SVN
trees with the newest code, copy new files from there to the live tree, create
patch files for submission, and more.
Typically, you keep your SVN trees up-to-date, updating them every now and then. You use cvsreport.pl to copy new stuff from the SVN trees into the live tree, while being careful not to overwrite files in the live tree that you have been working on. You edit source in the live tree, test it on your server, edit again, test again and so on. At some point you create a diff of your changed/added files in the live tree against the up-to-date SVN trees, and you submit it. All these actions are explained in detail below.
Use your preferred text editor to edit your source code. Make sure you
use Unix style line-endings, UTF-8 encoding, and spaces
not tabs.
Resetting your database. If you have totally messed-up your database and want to re-create it from scratch, do:
$ mysqladmin drop livejournal
$ mysqladmin create livejournal
$ $LJHOME/bin/upgrading/update-db.pl -r -p
$ $LJHOME/bin/upgrading/texttool.pl load
Staying up to date with SVN.
It's important to make sure you're developing against the latest
“trunk” code, when making changes and contributing patches.
Every so often, update from SVN:
$ cvsreport.pl -u
… but that's not all.
The above only updates your
directory to be
current. It does not affect your live tree. For that, you also use
cvsreport.pl.$/cvsLJHOME
Merging your live and cvs trees.
See what's changed where:
$ bin/cvsreport.pl
| main -> cvs cgi-bin/ljlib.pl |
| main <- cvs htdocs/create.bml |
In the example you can see htdocs/create.bml is
newest in your SVN tree, and cgi-bin/ljlib.pl is newest
in the live tree (where you should be working).
But maybe you have been working on htdocs/create.bml
also and don't want to lose your changes. So, use
cvsreport.pl to make a diff and store it somewhere.
$bin/cvsreport.pl--diffhtdocs/create.bml$bin/cvsreport.pl-dhtdocs/create.bmlcgi-bin/ljlib.pl(two files in one diff)$bin/cvsreport.pl-d(without filenames, puts all changes in all files in one diff)
Say you want to copy your cgi-bin/ljlib.pl to the
SVN tree (under cvs).
$cvsreport.pl--synccgi-bin/ljlib.pl$cvsreport.pl-scgi-bin/ljlib.pl
Maybe later fifty files change in SVN, but you have a few files in your
live tree that are not ready to go into your
directory.$/cvs/LJHOME
$ cvsreport.pl -c -s
(Only syncs stuff from to main).
That's the command you will probably want to run the most often. There
is usually no reason to copy files from your live tree to
$/cvs/LJHOME tree (you might think
you'd do that to create a diff with svn diff, but
cvsreport.pl $/cvsLJHOME-d is easier and creates diffs
just the way we like them).