Wednesday Apr 30, 2008

OpenSearch plugin for Apache JIRA

If you are an Apache user or developer and find yourself searching through the JIRA at the ASF very often, it is useful to have the search built-in right into your browser. The solution is to install an OpenSearch plugin that sends the right search query to Apache's JIRA. The following Javascript link will just do that:

Install OpenSearch plugin

For the curious, look at the OpenSearch XML file.

You can now enter your favorite search terms. The search will be the same as the "Quick Search" in the upper right of the JIRA interface. Try for example mod_proxy, "JCR persistence" (which will detect the project shortcut "JCR" and search only the respective Jackrabbit project) or JCR-123 (it will detect issue identifiers and jump right to the issue).

Monday Apr 21, 2008

links for 2008-04-20

Thursday Apr 17, 2008

Bash history

history|awk '{a[$2]++} END{for(i in a){printf "%5d\t%s \n",a[i],i}}'|sort -rn|head
  118	svn 
91 curl
63 find
42 ls
28 cd
20 mate
15 rm
10 diff
8 vim
7 tail

Sorry, I had to follow the hype ;-) But this list changes every day anyway - the top command "svn" for example is there because I did a lot of "svn st" piping to "grep" before a large checkin.

Wednesday Apr 16, 2008

SVN: Commit replaced directories

Problem

Although there is the Mindquarry Desktop Client, which stores the Subversion metadata (hence the .svn subdirectories) not inside the working directory, I still very much use the standard SVN command line client. Which sometimes brings up the following problem: if a tool replaces an entire directory - examples are Apple Keynote or Eclipse re-compiling code and replacing the classes folder (yes, I know, you shouldn't do it, but sometimes you just have to put it under version control...) - well, if it replaces the directory, the .svn subfolder is lost and you get this ugly status message:

~   subfolder

Which means subversion knows about it (the current folder contains an entry like "directory: subfolder"), but the directory itself is not a working directory (no .svn folder present in subfolder). That status is called "~ replaced"; unfortunately the description in the SVN manual is incomplete: "Item is versioned as a directory, but has been replaced by a file, or vice versa." It should better read: "Item is versioned as a directory, but has been replaced by a file with the same name, or vice versa. It could also indicate that it is versioned as a directory, but has been replaced by a directory of the same name without the important .svn folder inside."

Solution

It's normally a three step process on a standard UNIX command line:

mv subfolder subfolder-temp
svn up subfolder
cp -R subfolder-temp/* subfolder

Note that subfolder-temp is just a temporary name which must not exist yet. The important step is the copy with -R and *, which under UNIX means to copy the tree below subfolder-temp into the existing tree under subfolder. This is technically a simple forward merge. And here is the tricky part: it works for added and modified files, but not for deleted files. You will have to manually delete them. To find out which files are actually deleted, you can use the diff command in recursive and brief mode:

diff -rq subfolder subfolder-temp

For each file it says "Only in subfolder/: foobar", you can delete it:

svn del subfolder/foobar

To make sure everything is correct now, check the status:

svn st subfolder

You should probably also run your (test) code on this "rebuilt" directory or check the files with whatever program is using them. If everything is ok, you can commit it and throw away the temporary copy:

svn ci subfolder
rm -rf subfolder-temp

Quite a long workaround, but somewhat systematic. It's probably possible to write a script that does it, but when I think about it, I would probably never trust the script to not accidentally throw away the local changes ;-).

Update: Martin Probst has such a script (called svnrecover), but it works in a different fashion.

Saturday Apr 12, 2008

links for 2008-04-11

Friday Mar 21, 2008

links for 2008-03-20