Hello,

I'm apologize for delay with the answer - we had mailing list issues
and it looked like replies were sent while they were not :(

You may use SVNTranslator.getTranslatingOutputStream method to wrap
your ouput stream into the one that will (optionally) expand keywords
and eols. You may take code in SVNWCClient.doGetFileContents as an
example:

Map keywordsMap =
   SVNTranslator.computeKeywords(keywords,
repos.getLocation().toString(), author, cmtDate, cmtRev, null);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
OutputStream translatingStream =
SVNTranslator.getTranslatingOutputStream(baos, null, null, false,
keywordsMap, true);

this.getRepository().getFile(i_sPath, i_nRevision, null, baos);
..

"keywords" is a value of file's svn:keywords property, and to get
file's properites call:

SVNProperties properties = new SVNProperties();
repos.getFile(i_sPath, i_nRevision, properties, null);
String keywords = properties.getStringValue(SVNProperty.KEYWORDS);
...

Alexander Kitaev,
TMate Software,
http://svnkit.com/ - Java [Sub]Versioning Library!
http://hg4j.com/ - Java Mercurial Library!
http://sqljet.com/ - Java SQLite Library!


On 5 September 2011 09:51, myflasher <[email protected]> wrote:
>
> Hi, First of all, thank you very much for this excellence java library. I 
> love it. I am fighting with the expansion of subversion keyword. I found a 
> lot of useful code snippets, but up to now keywords are not replaced. This is 
> the code of my getFileContent() method:
>
>       public ByteArrayOutputStream getFileContent(String i_sPath, long 
> i_nRevision) throws SVNException {
>               SVNNodeKind nodeKind = this.getRepository().checkPath( i_sPath, 
> i_nRevision );
>
>               if( nodeKind == SVNNodeKind.NONE ) {
>                       System.err.println("There is no entry at '" + i_sPath + 
> "'.");
>                       System.exit(1);
>               }
>               else if( nodeKind == SVNNodeKind.DIR ) {
>                       System.err.println("The entry at '" + i_sPath + "' is a 
> directory while a file was expected.");
>                       System.exit(1);
>               }
>
>               SVNProperties fileProperties = new SVNProperties();
>               ByteArrayOutputStream baos = new ByteArrayOutputStream();
>               this.getRepository().getFile(i_sPath, i_nRevision, 
> fileProperties, baos);
>
>               return baos;
>       }
>
> I am working with the low level api directly on the subversion server and 
> without a local repository checkout. Can I use the SVNTranslator class? If 
> yes how can I replace the keywords? Thank's for your help.
> ________________________________
> View this message in context: Keywords expansion
> Sent from the SVNKit - Users mailing list archive at Nabble.com.

Reply via email to