(I'm not cross-posting to users@.)
I think this is a valid enhancement request: to have an API to get the WC base tree (not what the UI calls "base", but the result of the last checkout/update, which is called BASE (usually with capital letters) in libsvn_wc). By "get the tree" I mean an API that covers getting the directory tree structure, text and properties, and also perhaps other relevant metadata such as revision numbers, last-changed info, etc.
We could of course just add one function that does the specific thing that you have found to be missing.
This does remind me of an area I'd like to improve. The current APIs have lots
of inconsistencies and differences in terminlogy and no single point of
definition for exactly what tree is referred to. I think we should develop a uniform API that provide access to any tree of Subversion data: a WC base tree, a WC "pristine" (otherwise known as "base" in the UI) tree, a WC "actual" tree, or a tree that exists at a given revision and path in a repository. In each case, I mean a complete tree, so for example a WC "actual" tree would not be just the set of nodes mentioned in the WC 'ACTUAL_NODE' table. This API would be analogous and complementary to the way that svn_delta_editor_t or svn_editor_t provides a uniform way to communicate a *change* to any tree without being tied to what particular tree it is. The "tree-read-api" branch I created a few months back was an exploration of this idea. I don't think what I put in that branch was a good API design, but I think it would be really useful to create something achieving that goal of a uniform API, with a small set of implementations that give
access to the specific kinds of tree that I mentioned.
- Julian
>________________________________
> From: "Roghair, Frank" <frank.roghair_at_philips.com>
>To: "users_at_subversion.apache.org" <users_at_subversion.apache.org>; "dev_at_subversion.apache.org" <dev_at_subversion.apache.org>
>Sent: Wednesday, 13 June 2012, 13:59
>Subject: Retrieve pristine version of a replaced file via the svn api
>
>
>
>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
>FileInfofileInfo = 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.
>
>
>
Received on 2012-06-13 16:33:57 CEST