[mythtv-users] 0.21 - general Subversion tips

Michael T. Dean mtdean at thirdcontact.com
Sat Jan 19 18:49:21 UTC 2008

<fixed bottom posting>

On 01/19/2008 06:04 AM, Holger wrote:
> Mike Perkins wrote:
>> Chris Weiland wrote:
>>> I don't really see a point in making a temp copy of the source.  If you mess
>>> up the source, you can run "svn revert", which will restore any changes that
>>> you've made to the source tree (except for additional files that were
>>> created), or just delete it and check it out again.  I believe that
>>> reverting does not even communicate with the svn server because svn keeps a
>>> local clean copy on your machine for just this reason.
>> Whenever I have pulled source from svn I always immediately tar it up, before I 
>> do anything else.
>> This makes sure that I have the exact same source on the four machines I run 
>> Myth on. It also means I have a reference if one of the machines self-destructs, 
>> and it saves me from clogging up the internet tubes more than once.

And allows you to clean out all non-versioned files from the directory 
structure.  And fixes changed permissions that can break svn up--look at 
all the instances where people have submitted bugs for MythWeb or 
MythArchive (which has a lot of binary files) where the end result was 
"svn up didn't work, but when I removed the directory and svo co'ed, 
everything was fine".  And gives the benefit of and even cleaner version 
of make distclean (definitely use ccache, though, or you're wasting a 
lot of time recompiling stuff.).  And restores the source without using 
additional bandwidth even if directories (including the .svn subdirs) 
are lost/corrupted.

There are actually many more reasons this is a great way of working with 
MythTV source.  It's especially nice if you're actually hacking the 
source.  I often have multiple working copies of the source in use for 
the different patches I'm working on.

> Btw: You can find excellent online documentation for Subversion at
> http://svnbook.red-bean.com/

Definitely good advice.

> Now on to more specific stuff:
> Mike Perkins wrote:
>> Whenever I have pulled source from svn I always immediately tar it up, before I 
>> do anything else.
> Two things about SVN:
> 1) It keeps copies (!) of everything you "pull from the server".
> 2) You can specify revisions when you check out sources
> Both things have already been mentioned.
> The consequences are:
> 1) Your tar files are twice the size they need to be. Hmm, maybe not 
> quite since some of that might be compressed nicely (might be worth a 
> test), but still... the (extracted) "content" takes up twice the space 
> it would need

Yes, but my MythTV SVN tarballs take up 268MiB (including a tarball for 
the themes, which contains "extra" themes--so this is as large as the 
tarball is likely to be for anyone).  That 268MiB of space = 13min of 
video at 1.15GiB/hr (i.e. the low-quality setting I used to use for my 
SDTV).  It's only about 4min of video for HDTV at 4GiB/hr or 2min for 
HDTV at 8GiB/hr.

> If you don't want to use "Subversion features" (like update) on a 
> directory, "svn export" is a very good command. It basically makes a 
> copy and removes all the Subversion specific stuff from it to give you 
> "a clean directory tree from the repository". OR it doesn't create the 
> subversion specific stuff in the first place.

But, keeping a copy of a full-fledged SVN working copy to allow you to 
svn up later is very important.  You should /not/ svn co every time you 
update myth (as you have suggested, but I'm trying to specifically ask 
that people don't do full checkouts of myth all the time).

> Using "svn update" is really highly recommended to save some server load 
> and network traffic, but if you don't use it anyway, you can use
> svn export http://svn.mythtv.org/svn/trunk/mythplugins/mythvideo/
> instead of
> svn co http://svn.mythtv.org/svn/trunk/mythplugins/mythvideo/
> to get "clean directories" (half the size).
> you can also use
> svn export mythtvplugins mythtvplugins_copy
> to make "local copies" that don't include the subversion stuff...
> Take a look at http://svnbook.red-bean.com/en/1.4/svn.ref.svn.c.export.html
> 2) You can specify revisions when you check out sources...
> ... and also when you update
> svn update -r 12345
> ==>
> In your case, I see two ways of "doing things better":
> a) Have some directory for checkouts and use "clean copies" otherwise 
> (for builds on local machine and the three others)
> First:
> - svn co ...
> - svn export

But, please, do the export from the working copy--not from the 
repository (as Holger's example showed).

> - tar + copy, make as before
> After that:
> - svn up
> - svn export
> - tar + copy, make as always
> b) Specify a revision in update
> Depending on your network setup, this may be more convenient
> Keep a checkout of mythtv on each machine.
> Do "svn up" on the first machine. It tells you the current revision 
> number. If you forget it, you can find out by typing "svn info".
> Do "svn up -r [that number]" on the other machines.

Though this approach does require 4 svn up's (i.e. downloading the 
changes 4 times)...  It also requires 4 times the server resources.

> The network traffic should normally be minimal because it downloads only 
> the changes since last time. (even only those *parts of a file* that 
> have changed)

A little bit extra times a lot of people (times a lot of MythTV boxes 
per person) adds up quickly.

> Oh, I guess this sounds much more complicated than it is...
> Hope it helps a little anyway  :-) 

It's good advice (and good to help people better understand SVN), but I 
wouldn't go so far as recommending against making tar file "backups" of 
a clean checkout of the source.


More information about the mythtv-users mailing list