subversion-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Roghair, Frank" <frank.rogh...@philips.com>
Subject Retrieve pristine version of a replaced file via the svn api
Date Wed, 13 Jun 2012 11:59:14 GMT
Hi All,

Developers in our organization need to have their changes reviewed before the commit is allowed.
For this purpose a customized tool was created called createReviewChangeSet.exe.
The tool does create a zip file containing a text file "changeSet.txt" which contains the
change list with a explanation why the changes are needed.
Beside this file two directories "old" and "new" are part of the zip file.
The old directory contains the previous version of the file and the new directory contains
the new version of the file.
The complete file path is part of the zip file.

Structure changeset.zip
                New
                        <dir>
                                <file>
                Old
                         <dir>
                                <file>
Changeset.txt

This tool was created for subversion 1.6 and based on the internals of subversion.
Basically what happened the tool copied the new file and the file.svn-base to a directory
and afterwards that directory is zipped.
In case of a replaced file the copy is slightly different because the file.svn-revert was
used.

                Modified file : actions   copy <new file> -> New/<di>r/<file>
 and copy <file>.svn-base -> Old/<dir>/<file>
                Replaced file : actions   copy <new file> -> New/<di>r/<file>
 and copy <file>.svn-revert -> Old/<dir>/<file>

Currently the preparations are ongoing to move to subversion 1.7.
The tool which was based on the internals of the working copy didn't work anymore.
Decided was to rewrite the tool using sharpsvn, meaning use the API and don't depend on the
subversion internals anymore.
The new tool does work except for replaced files, I am unable to find a method to retrieve
the pristine copy in that case.

The following code is used
FileInfo fileInfo = new FileInfo(targetOld);
       Directory.CreateDirectory(fileInfo.Directory.ToString());
       SvnExportArgs svnExportArgs = new SvnExportArgs();
       svnExportArgs.Revision = SvnRevision.Base;
       svnClient.Export(fileName, targetOld, svnExportArgs);

filename is the changed file including path in the working copy.
targetOld is the location where the file will end up in the exported directory structure.

The above code does work fine for modified files.
Unfortunate for a replaced file SvnRevision.Base doesn't return the pristine version.

Is there something like SvnRevision.Pristine ?

I did have contact with Bert Huijben, according to him this functionality is not available
in the subversion API and therefore also not in the sharpsvn API.
Did I miss something or can this be handled as a change request for a future release?

Thanks in advance.

With kind regards,

Frank Roghair

________________________________
The information contained in this message may be confidential and legally protected under
applicable law. The message is intended solely for the addressee(s). If you are not the intended
recipient, you are hereby notified that any use, forwarding, dissemination, or reproduction
of this message is strictly prohibited and may be unlawful. If you are not the intended recipient,
please contact the sender by return e-mail and destroy all copies of the original message.

Mime
View raw message