Archive for the ‘development’ Category

I didn’t setup my svn in the standard way. Standard convention would say it looks something like this:

projecta/trunk/src
projecta/trunk/docs
projecta/branch/betabranch/src
projecta/branch/betabranch/docs

As I have previously posted, I don’t like the tools dictating how I should setup my source tree. So I have:

projecta/src
projecta/docs
projectb/src
projectb/docs

etc… projecta and project b interact with other (one is libraries).

but now I need a branch. So what I did was create a “branch” project for my “betabranch”.

mkdir -p branch/betabranch
svn import branch http://somehere/svn/branch

So now I can easily branch the code with

svn copy http://somewhere/svn/projecta http://somewhere/svn/branch/betabanch/projecta

I haven’t done the merge yet, so I might be in for some pain. We will see..

Cameron

How to install svn 1.6 for centos 5.5:
First enable the rpmforge repo (repository – a place for “rpm” packages),
then you can just install using yum. Note that after I installed the subversion, I then disabled the repo to keep my install as close to CentOS as I can.

wget http://dag.wieers.com/rpm/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm

rpm -ivh rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm

yum install subversion.x86_64

You can disable the rpmforge repo in /etc/yum.repos.d/rpmforge.repo
and changed enabled = 1 to enabled = 0

As you know, I’m tortured by the pseudo requirement to layout your projects a certain way with svn. Some more thought (and chats with my svn friends) have led me to think that the tool doesn’t really force you to lay things out a certain way, since you could (and should I guess) checkout your projects at a lower level than the top.

eg
ft/
ft/cgi
ft/www

in svn would be

ft.repo/trunk/ft/
ft.repo/trunk/ft/cgi
ft.repo/trunk/ft/www

So you make the project called ft.repo, and make the svn directories under that of trunk, tags and branches. Then ft is my top level directory, and so I check it out with

svn checkout svn://…/ft.repo/trunk/ft ft

and this way my directories are arranged the way I want in my workspace, and tagging will not clutter up my workspace.

But I’m still not overly happy with this, and couldn’t be bothered moving my stuff around, so I decided to write a small shell script that associates the current revision with a tag that is saved into the file .tags in current directory (and committed). It doesn’t let you tag files, but certainly sub-directories are fine. I also merged in the svnignore program from a previous post. Suggestions for improvement are welcome, as this is the first version :)

This works by writing version=tag to the file .tags in the current directory.
It is not a "real tag"

Usage:
svn tag “version-1.0″
This will write a “tag” to the current directory as version-1.0

svn listtags
This will list the “tags” for the current directory.

Put this in your path ahead of the real svn (or rename this file)
File: $HOME/bin/svn

#!/bin/sh
# @author Cameron Gregory. http://www.bloke.com/

SVN=/usr/bin/svn
if [ "$1" == "ignore" ]; then
        shift;
        #Usage svn ingore [file|dir|pattern]+
        echo "Intercept ignore"

        if [ $# -eq 0 ]; then
                svn propget svn:ignore .
                exit 0;
        fi
        FILE="/tmp/svnignore.$$"
        $SVN propget svn:ignore . > $FILE
        i=0;
        while [ $i -lt $# ]; do
                echo "$1" >> $FILE
                shift
        done
        sort -u $FILE | grep -v "^$" > $FILE.2
        $SVN propset svn:ignore -F $FILE.2 .
        $SVN propget svn:ignore .
        /bin/rm -f $FILE $FILE.2
        exit 0;
fi
if [ "$1" == "tag" ]; then
        shift;
        echo "Intercept tag"

        TAG="$1"
        $SVN update .
        VER=`svnversion .`
        echo "$VER=$TAG" >> .tags
        $SVN add .tags  2> /dev/null
        $SVN commit .tags -m "saving tag: $TAG"
        tail -5 .tags
        exit 0;
fi
if [ "$1" == "listtags" ]; then
        echo "Intercept listtags"
        if [ -f .tags ]; then
                cat .tags
        else
                echo no tags
        fi
        exit 0;
fi

$SVN $*
exit $?

So if you want to checkout with a tag, then lookup the revision
and checkout using that. Hmm .. perhaps a little grep in the .tags file would be useful. Next time :)

I was having problems building libpangocairo. I had the latest cairo, I had freetype installed, I had fontconfig intalled, but everytime I ran configure on pango, it would tell me yes I had cairo, but it was being disabled because there were no backends to use. After trudging through pango configure, I finally figured out that my “fontconfig” was not a high enough version to even test for FreeType, and so it was there were no cairo font backends to use, and so it didn’t build pangocairo and the only error was no cairo backends (when clearly there was!) anyway, if after you google the other posts, and don’t find a solution, update for fontconfig package.

Not building tags and branches into the base system on svn seems like a bad idea. Shouldn’t these be the easiest things to do? I just want mark the current files as a release I made, but apparently, svn projects should be laid out a particular way.
This is a sure sign that the tool is not helping but hindering when you have to organize your files to suit the tool. It’s not unreasonable to make small changes in your project to make your life easier, but if the top level has to be rearranged, then you know you are in for some pain.

suggest:

svn tag “My tag” .

fancy that, easy to use…

properties for ignoring files. Come on guys (gals?), this is crazy. Imagine you wanted an easy to use source code control system. You’d have something like:

svn ignore [files|dirs]+

But no, ignore files are handled through properties.
So fine, you need to do:

svn propset svn:ignore [files|dirs]* [target]

you can feel the pain, but even worse, when you run two in a row, it just takes the last (which makes sense because it’s “propset”, but please.

Like the dumbarse who put ?a=b&c=d in the W3 standard for links (& not &), not having standard control for ignore is just crazy.

Here is my “fix”. File “svnignore”:

#!/bin/sh
#Usage svnignore [file|dir|pattern]+

if [ $# -eq 0 ]; then
        svn propget svn:ignore .
        exit 0;
fi
FILE="/tmp/svnignore.$$"
svn propget svn:ignore . > $FILE
i=0;
while [ $i -lt $# ]; do
        echo "$1" >> $FILE
        shift
done
sort -u $FILE | grep -v "^$" > $FILE.2
svn propset svn:ignore -F $FILE.2 .
svn propget svn:ignore .
/bin/rm -f $FILE $FILE.2

exit 0;

Example usage:

#ignore all files ending in .cgi (note the "s)
svnignore "*.cgi"

# just ignore the file mylog.out
svnignore mylog.out

#ignore the files file1.txt, blah.out and the subdirectory "mydir"
svnignore file1.txt blah.out mydir

ahh .. now I can easily ignore all the stuff I don’t want. Perhaps an alias for “svn propedit svn:ignore .” would also be handy…

Did I mention a nice interface for tags would also be good?

You can enable the debug menu by doing the following command:

Apps -> Utilities -> Terminal

Then type:

defaults write com.apple.Safari IncludeDebugMenu 1

and then restart safari.  Then you will get a develop menu which has “Show Error Console” and many other options.


Maybe I’m spoiled from the CVS integration into eclipse.  But certain things about subclipse are terrible (sorry I can’t compare to subversive since I didn’t try it yet).  But when I do team -> replace with -> latest from repository, then I expect it to say “are you sure” and then just do it.  Not complain, blah .. try cleanup .. blah .. it’s not a working copy.  Make it one. argghh…

(on the flip side, the command line interface seems since, but I like the graphical compare).

Okay .. one more gripe:

The best thing about svn so far is the ability to delete (which is *so* annoying in CVS), but, you have to mark it in svn ignore (which you can’t do at commit time .. annoying) *and* you have to do an update after the delete else it’s not a current version.  This is true when you either delete a file, or you add one to svnignore.

I had once considered moving from CVS to SVN for the previous business.  We taught many people how to use CVS through eclipse (perhaps 40-50 people, many not very technical).  But the things that go wrong with eclipse and SVN are such a pain, I wouldn’t recommend such a transition (and I was to do it again, I would have to think long about actually just starting with SVN).

okay, another gripe:

Need the feature: ignored resources (global ignore) inside eclipse (not sure if it exists outside svn).