export all the files added or modified in a given version in svn

I am working on a python script to export all the files added or modified in a given version in svn.

Using Popen method, calling the command line utilities.

script is working fine in my machine and when run in the realtime, wow, it throws error as following.

[shrini@cu136 tmp]# python export-files-from-svn.py
Enter the Repository URL : https://w.x.y.z./svn/repos/tools
Enter the revision no : 38
Enter the username : shrinivasan
Getting the changeset
Traceback (most recent call last):
  File “export-files-from-svn.py”, line 25, in ?
    change = subprocess.Popen(["svn","diff",repo,"-c" + revision,"--summarize","--username",username],stdout=subprocess.PIPE)
  File “/usr/lib64/python2.4/subprocess.py”, line 543, in __init__
    errread, errwrite)
  File “/usr/lib64/python2.4/subprocess.py”, line 975, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

hmmm. google does not give much answer on this question.

Analysed the command and executed the command as a standalone command.

[shrini@cu136 tmp]# svn diff https://w.x.y.z/svn/repos/tools -c 38 –summarize –username shrinivasan
-bash: svn: command not found

Wow. Got the error.
SVN commandline client is not installed in the machine.

After installing the subversion commandline client, the script is working fine.

Will release the code after testing it well.

Posted in collabnet, subversion, svn | Leave a comment

An Introduction to GCC

Subversion code consists the following languages.

C -         58%
Python – 20%
C++ -    5%
Others – 17%

Source : http://www.ohloh.net/p/subversion/analyses/latest

C, is the language which I have tons of fears to touch, after living happy life with Ruby and Python. :-)

After my college first year, I did not coded in C. I was thinking that the real time C code will be so tough and C projects are written by angels and devils. But, when compiling the svn code, I just have a look through the C files. Hmm. The code is so neat and somewhat understandable even for me.

Sounds good.

I am looking the compilation texts. A lot of running, running and running texts.
Wanted to know what is happening behind the compilation. That search leads myself to learn the gcc.

Ordered the Book “An Introduction to GCC” here
http://fsm.co.in/site/product/an-introduction-to-gcc

The book is a great inspiration to learn the gcc. So far, I was thinking like GCC is for serious hackers.
This book gives a neat introduction to gcc and its capabilities.

Reading it makes me to know what is happening behind the running texts of make.

Posted in gcc, subversion, svn | Leave a comment

Restore deleted files from svn

Subversion, being a master storage for is repositories, it keeps everything inside it. Once if you give a file to the subversion repository, no matter on the user does with the file, it keeps records. Even if the user deleted the file. :-)

Yes, if you deleted a file in a version, and your repository grows a lot with many revision, you can always get the deleted file from its old revision.

For example, of you delete a file called “shrini.txt” in version 10 of a repository.
The repository grows well and now it is version 100.

Now, you need that old file “shrini.txt” which was in version 10.

You can easily get it from svn repo.
But, how to know that “shrini.txt” was in which revision ?

here comes the “svn log”

svn log –verbose

The above command explains the entire history of the repository from revision 1 to latest revision.
We can grep or analyse the output manually to get the revision no.

Yes. we find that shrini.txt was in revision 10.

Now, time to restore.
Go to your working copy of that revision and give the following command.

svn update -r 10 shrini.txt

This command will get the file shrini.txt from the version 10 of the repository.

Thats it. svn helps a lot of people in their hard times of worrying about deleted files. The only thing svn wants from the user is to believe svn and to keep all the files under a svn repo with committing.

svn gives another way for restoring deleted file.

svn export protocol://repo-path/file-path@old-revision-number relative-path-to-new-location

svn export http://svn.test.com/repos/shrini.txt@10 .

This will copy the file to the current folder.
In this method, no need to get a working copy of the entire repository.
We can just get the single file.

Posted in subversion, svn | Leave a comment

subtree mergeinfo in SVN

In subversion, when we merge the top level directories, the mergeinfo is set to the top level directories only.

sometime, it may happen to merge some sub directories. Now, the mergeinfo will reside with those sub directories. This is called “SubTree Merge Info”

After sometime, if we merge the top level directories, it will mark all the subdirectories, who have the subtree mergeinfo as “Modified”. We may panic that, even if have modified only only file, a lot of files and directories will be shown as “Modified”. Those are the directories, that we have made a sub directory merging in our history.

To get rid of this confusion, we have to do a record-only merge. Adding the option “–record-only” to the top level merge command will copy all the sub directory mergeinfo to the top level and remove all the sub directory mergeinfo. So, the further top level merges will show only the really modified changes.

Posted in subversion, svn | 1 Comment

Microsoft sponsors Apache Software Foundation

Just wondering to see the sponsors page of Apache Software Foundation, here.
http://www.apache.org/foundation/thanks.html

There is Yahoo, Google as Platinum sponsors.
Wondering to see the Microsoft as a Platinum sponsor.

For the very first time, looking this strange service by MS.

:-)

Facebook and HP are gold sponsors.

Basis Technology, Covalent, IONA and Matt Mullenweg are silver sponsors.

AirPlus International, BlueNog, Intuit, Joost, Two Sigma Investments are Bronze sponsors.

Thanks for the sponsors.

Posted in subversion, svn | Leave a comment

Issue tracker for subversion

Want to contribute to SVN?

Want the list of issues that are being worked?

Here is the tracker.
http://subversion.tigris.org/issue-tracker.html

Here is the Issue List

We can look on the existing issues and and read the discussions.

As, we can get the code, checkout the code and try to fix some issue.
Before start working on the code, you should read the community guide, here.
http://subversion.apache.org/docs/community-guide/

Posted in subversion, svn | Leave a comment

working with a single revision in svnrdump

To get a dump of a single revision, we can use <br />
svnadmin dump REPO_PATH -r[revision_no] > dump

for example,

svnadmin dump /home/shrinivasan/svn-repos/test -r1 > dump.file

The dump usage is
dump: usage: svnadmin dump REPOS_PATH [-r LOWER[:UPPER] [--incremental]]

We can use the -r LOWER[:UPPER]  option to get the dump of a repository between two particular repositories.

ex:
svnadmin dump /home/shrinivasan/svn-repos/test -r2:4 > dump.file

Now, checking the same functionality in svnrdump.

<br />~/svn-builds/1.6.12/bin/svnrdump  dump file:///home/shrinivasan/svn-repos/test/  -r5 | less<br />

Oh No.

It is not giving the log for the version 5.

general usage: svnrdump SUBCOMMAND URL [-r LOWER[:UPPER]]<br /><br />

It is giving the log from the version 5 to the HEAD.
I have 10 revisions.

It is giving the log from 5 – 10.

It is wrong.

How to fix it?

Checking the code.

It is the file, subversion/svnrdump/svnrdump.c

<br />SVNRDUMP_ERR(svn_ra_get_latest_revnum(opt_baton->session, &latest_revision, pool));<br />  if (opt_baton->start_revision == svn_opt_revision_unspecified)<br />    opt_baton->start_revision = 0;<br />  if (opt_baton->end_revision == svn_opt_revision_unspecified)<br />    opt_baton->end_revision = latest_revision;<br /> <br /><br />

In line 578, It is said that, if there is no end revision specified, take it as the “latest revision”.

It should be like, if there is no end revision specified, take it as the same revision.

So changing the code like the following.

SVNRDUMP_ERR(svn_ra_get_latest_revnum(opt_baton->session, &latest_revision, pool));<br />  if (opt_baton->start_revision == svn_opt_revision_unspecified)<br />    opt_baton->start_revision = 0;<br />  if (opt_baton->end_revision == svn_opt_revision_unspecified)<br />    opt_baton->end_revision = opt_baton->start_revision;<br /> <br />

Thats all. Now build the suversion again using the ./configure, make and make install.

Testing it now.

~/svn-builds/1.6.12-rdump/bin/svnrdump  dump file:///home/shrinivasan/svn-repos/test/  -r5 | less<br />

Good.

It is dumping the version 5.

Have to write test scripts for this and communicate this to the developers in dev@s.a.o

Update :
My friend vijayaguru send the patch to the developers. it accepted and committed at r993102 by ramkuar.


Posted in subversion, svn | 2 Comments