Skip to content

Converting subversion repositories to git

See How to convert from subversion to git by Paul Dowman.

When you use git-svn to clone a subversion repository to git, it converts svn tags to git remote branches. This behavior makes sense if you will continue to use the svn repository. However for permanent conversion I prefer converting them to git tags. The above link is the only howto I found which includes this step.

Here’s a script which echos the required commands to migrate the branches to tags:

for tag in $(git branch -r | grep tags | grep -v @) ; do
  echo git tag $t tags/$t^;
  echo git branch -r -d tags/$t;

To remove the final traces of git-svn:

git config --remove-section svn-remote.svn
rm -rf .git/svn
git branch -r -d trunk

Source code management for personal projects

After hearing all the buzz about distributed version control systems (DVCS), I was curious if they offered advantages over subversion for personal code management. The answer is a resounding yes, and I see no reason to ever go back. I considered three candidates: git, mercurial (hg), and bazaar-ng (bzr).

Continue reading ‘Source code management for personal projects’ »

ctags with bjam and eliminating user-config.jam

I added a rule to rebuild my tags file whenever the sources change. It took me way too long to figure this out – I was very surprised that a google search for ‘bjam ctags’ turned up nothing.

make tags : [ glob *.cc ] [ glob *.h ] [ glob lib/*.cc ] [ glob include/*.h ] : @ctags ;
actions ctags
    ctags $(>)
    cp tags $(<)

I can’t figure out how to make targets appear in the project root instead of the build dir. However bjam runs ctags in the project root, so ctags will do the right thing. I copy the generated tags file to the location bjam expects so versioning still works. Note that $(>) refers to the sources and $(<) to the target. See Chapter 5->Custom Command for more info. There is also a nofile rule, which runs a command unconditionally.

Meanwhile I discovered that I could get rid of my $HOME/user-config.jam. I moved it to project-root.jam in my project root, renamed my Jamroot to Jamfile, and then it worked as before. Interestingly I can also rename project-root.jam to Jamroot, so I have a Jamroot and Jamfile in my top level project directory. Maybe project-root.jam and Jamroot serve the same purpose? In any case I prefer this setup because it removes clutter in my homedir and those settings really are project specific.

Unit Testing with Boost.BuildV2/bjam

The official documentation neglects to mention that you must import the testing module for any of the testing rules to work. I put ‘using testing ;’ in my user-config.jam.

I had no trouble with the ‘unit-test’ rule, which has the same syntax as ‘exe’ but also runs the program and checks the exit status. However if you want to pass arguments or input files, you must use the ‘run’ rule, which has different syntax and seems fail if there is an exe rule for the same program. Here’s my run rule, and the corresponding exe and unit-test rules for reference:

Continue reading ‘Unit Testing with Boost.BuildV2/bjam’ »

Using vim like an IDE

I’ve been using The NERD tree for a file list and minibufexpl for tab-like buffer management. To close a buffer, select it in minibufexpl and hit the ‘d’ key. If you want to remap the :bd command so it does the same thing, check out these tips – otherwise :bd will delete the whole window, which is very annoying. There is also a vim tip about using vim like an IDE, which has another implementation of kwbd (keep window buffer delete).

SDL Windowed Fullscreen (no mouse trapping)

The fullscreen display mode in SDL traps the mouse on one X display, which can be undesirable if you are running dual head with separate X screens and using SDL for something other than games.

UPDATE: An even easier way of doing this is passing SDL_NOFRAME to SDL_SetVideoMode with width and height set to the full screen size.

To get fullscreen without mouse trapping, you can tell the window manager to set the fullscreen property on the SDL app’s window. I’ve created a simple demo app to experiement with this – see my Projects page for details.

make alternative for small C/C++ projects

Lately I’ve found maintaining Makefiles tedious, even for small projects. Much can be done with implicit rules, but header file dependencies must still be specified manually (or so I though – more on this later). For a small project, maybe you only have five or so of these rules. However there is no reason to manage these manually, and for small projects I am more lazy and feel more entitled to a completely hassle free build system. If it’s so simple, why should I be doing any work?

What I want is a build system that handles include dependencies automatically, allows me to build to a separate directory, and allows me to clean without specifying all the files that need to be deleted. I also really like compact and easy to understand syntax. Advanced features that are useful for large projects are also a plus – many large projects start out small.

I created build files for SCons, BJam/Boost.Build V2, and CMake. For each tool, I will list my build file(s) and discuss my impressions. Note that the analysis is necessarily shallow – I am mainly concerned with how well they work on small projects with very modest build needs, and I have spent very little time with each system. I also discuss a solution to the header dependency problem using GNU Make.

Continue reading ‘make alternative for small C/C++ projects’ »

Blocking Facebook ads in Firefox using AdBlock Plus

Look at the comments also. I used*(social_ad) and*(sponsors) – blocking the entire sidebar_ads messed up the horizontal alignment.

OpenWRT working on Buffalo WHR-G125 router

OpenWRT for the Buffallo WHR-G125 is listed as Work-In-Progress, with no install or config information on the wiki. However I just verified that the latest X-Wrt Kamakazi brcm-2.4 snapshots work, including wireless. WRT treats the left-most port, labeled “1”, as the WAN port instead of the “Internet” port, which I think is switched with the other lan ports. Also it crashed when I tried to enable SSL for the web-interface, during the install of libopenssl. I think this happens when it runs out of space on /jffs, which is very tight at 2MB.

Continue reading ‘OpenWRT working on Buffalo WHR-G125 router’ »

Recovering PPP password from Actiontec GT701

I have an Actiontec GT701 router for my Qwest DSL internet, and in the web-interface it masks the PPP password. Now I want to use the actiontec as a bridge and run PPPoE on my Buffalo WHR-G125 running Tomato, and I can’t find my PPP password anywhere. Here’s how I recovered my password:

Continue reading ‘Recovering PPP password from Actiontec GT701’ »