Another sleepless night…
It has been a while after I wrote the post “Pitfall in using svn diff“… Reading it, you should know that it is not handy if you want to ‘diff’ 2 files in the repository. You need to type the full repository paths for both files in order to do so, which are some how difficult to remember. But what if we can made use of local paths (so, we can use the shell’s auto complete for the paths)?
Below is a simple script to do so:
#!/bin/bash
# this script diff the repository by giving local working dir pathif [ $# -lt 2 ];
then
echo “$0 <path1> <path2>”;
exit 1;
fispath=`cd $1; svn info | grep ‘^URL: ‘ | cut -d’ ‘ -f2-`
dpath=`cd $2; svn info | grep ‘^URL: ‘ | cut -d’ ‘ -f2-`echo “svn diff $spath $dpath”
svn diff $spath $dpath
basically, it made use of ’svn info’ to get the actual repository paths and run ’svn diff’ on them.
It is now 2 o’clock at night and I cannot sleep (probably due to the coffee I have during lunch…).
OK, lets write something then. I think many people have experience using the command diff in unix environment, but when it comes to ’svn diff’ the behavior is a bit unexpected (at least it happened to me).
First, the command ’svn diff file:///your_svn_repos_path/trunk/a_file file:///your_svn_repos_path/branches/branch_a/a_file’ work as expected. It shows the difference between the ‘a_file’ in ‘trunk’ and in ‘branch_a’. Nice, right?
However if we try to svn diff the ‘a_file’ by using the working copies’ path, i.e. ’svn diff your_working_folder_path/trunk/a_file your_working_folder_path/branches/branch_a/a_file’, It outputs nothing! (In this case, the files are different!)
So, what is wrong with ’svn diff’? By looking carefully at the syntax of ’svn diff’ (’svn help diff’), I noticed:
1) the number of file arguments to ’svn diff’ are not limited to 2!
2) when using 1 or zero working copy’s file path as argument to ’svn diff’, it output the difference of the file/folder against the copy in the repository.
My understanding is that when using working file copy as argument to ’svn diff’, what exactly svn does is to compare the working files with their corresponding copies in the repository, regardless the number of input is 1, 2, 3… or more! In my previous trail, both trunk and branch_a are up-to-date, so there is nothing different from the repository, and svn diff output nothing.
The behavior is really unexpected and took me a while to figure it out.
These days I got chance to setup and configure a bugzilla instance. I come across a requirement to add some prefixes to the title of email notifications sent by bugzilla (e.g. when bugs are created / modified).
It turns out to be not trivial, at least the bugzilla admin UI don’t have that supported. Google’d a bit and found the following steps:
Copy the file <bugzilla path>/template/en/default/email/newchangedmail.txt.tmpl to <bugzilla path>/template/en/custom/email/
Modify the custom/email/newchangedmail.txt.tmpl file. Basically, it is a email template with various variable substitution there. E.g.
[% product %] – will be substituted by the bugzilla product name (that the bug belongs to)
[% comp %] – will be substituted by the bugzilla component name
… etc
For my case, I just changed the “Subject:…” line.