Friday, April 30, 2010

How to convert cvs to svn

There are many posts available online about how to convert cvs to svn, however some steps seem to have been skipped. I did the conversion on Ubuntu, using the famous cvs2svn. 
If you have to convert the code in Windows, see this: convert cvs to svn using Cygwin

Here are some dummy steps:


1. Download and install cvs2svn, for more information (ie requirements, etc), see http://cvs2svn.tigris.org/cvs2svn.html.
Ideally you shall have a unix/linux environment with Python, cvs, svn installed.

2. install cvs, svn and svnserve

3. Create a folder (namely CVS) at your desired location

4. Set CVSROOT to this folder, you need to set with aboslute path. ie, export CVSROOT=/home/guest/CVS

5. then run "cvs init", now CVS has been set as a cvs repository, you will see a CVSROOT folder under CVS

6. run "cvs2svn --fallback-encoding=ansii -s SVN_PATH CVS", where SVN_PATH is the path for your SVN repository. "--fallback-encoding=ansii" is needed in case cvs2svn fails to convert the log messages into UTF8(default).

7. go to SVN/conf, update svnserve.conf - uncomment out
# anon-access = read
# auth-access = write
# password-db = passwd

update passwd, ie,
[users]
leon=theprogrammer
guest=1234

DO NOT leave space in the name and password, otherwise your SVN clients may deny your credentials.

8. start svnserve to the SVN repository. run "svnserve -d -r SVN", where SVN is the path of your SVN repository.

9. Point your svn client to svn://servername/SVN, you shall be prompted to log in, then you shall see the repository.



This book might be helpful: Pragmatic Guide to Subversion



ReadDirectoryChangesW returns ERROR_BAD_NET_RESP (error code 58)


A recent project is about folder monitoring. The folder can be on a local hard drive or a network. We use the standard win32 api call: ReadDirectoryChangesW.
The function works perfectly on a remote WinNT system but occasionally fails on mornitoring a folder in a remote Unix system. At the beginning we suspect if a correct (or high enough) version of samba is install on that Unix machine, but confirmation is positive. Besides the function call does not fail consistently, which really bothers us. However, the last error code from ReadDirectoryChangesW is always 58 – ERROR_BAD_NET_RESP (The specified server cannot perform the requested operation).
I suspect it is an unsupported isssue, the latest Samba patch does not full support ReadDirectoryChangesW yet. There are few articles can be found from google, links:
The solution
The loop to check ReadDirectoryChangesW does not break if last error is ERROR_BAD_NET_RESP, continue process directory changes if it fails. The interesting thing is the next ReadDirectoryChangesW call could succeed following previous failure. So eventually we capture the directory changes and process it approprietly.
The ideal solution is a samba fully support ReadDirectoryChangesW

The power of habit

A friend of mine recommended this book 'The power of habit' (习惯的力量). I love it, although the one I read is in Chinese. We act upon our habit in as much as 90% of time daily, if we can keep good habits, abandon bad ones, we will be surely moving forward to success sooner.

An interesting book to read indeed, highly recommended. The Power of Habit: Harnessing the Power to Establish Routines that Guarantee Success in Business and in Life