|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
Updates with SVNKitGreetings Everyone,
I am a noob in SVNKit and after reading the documentation, forums and online examples, there is still something I can't quite grasp regarding handling updates in SVNKit. I am updating files from SVN to custom java objects in a db using SVNKit. I am using repository.diff with regards to updating text, adding and deleting my java objects. I start with my applyTextDelta, public void applyTextDelta(String path, String baseCheckSum) throws SVNException { try{ InputStream baseIs = new ByteArrayInputStream(mytext.getBytes("UTF-8")); myDeltaProcessor.applyTextDelta(baseIs, baos, true); } catch(Exception e){ throw new IllegalStateException(e); } } @Override public OutputStream textDeltaChunk(String path, SVNDiffWindow diffWindow) throws SVNException { long origStartPos = diffWindow.getSourceViewOffset(); long origEndPos = origStartPos + diffWindow.getSourceViewLength(); ByteBuffer x = ByteBuffer.wrap(new byte[diffWindow.getNewDataLength()+100]); diffWindow.writeNewData(x, 0, diffWindow.getNewDataLength()); myDeltaProcessor.textDeltaChunk( diffWindow ); return null; } but I become a little lost how SVNKit's diffwindow gives me back the changes (mydata is a private attribute in diffWindow) and how they can be applied to mytext... Can anyone clarify this for me? |
|
|
Re: Updates with SVNKitHello,
SVNDiffWindow.myData contains instructions to apply to source\target\new data streams to get the resultant text as well as new data that comes from the server. It should not be used by users. The main idea is to pass your source\target streams to SVNDeltaProcessor.applyTextDelta() in ISVNEditor.applyTextDelta(), and then pass all windows to the SVNDeltaProcessor.textDeltaChunk() in ISVNEditor.textDeltaChunk() method, you do not have to edit window's data as it already contains the necessary data to apply changes to your streams. ---- Alexander Sinyushkin, TMate Software, http://svnkit.com/ - Java [Sub]Versioning Library! slamice wrote: > Greetings Everyone, > > I am a noob in SVNKit and after reading the documentation, forums and > online examples, there is still something I can't quite grasp regarding > handling updates in SVNKit. > > I am updating files from SVN to custom java objects in a db using SVNKit. I > am using repository.diff with regards to updating text, adding and deleting > my java objects. I start with my applyTextDelta, > > public void applyTextDelta(String path, String baseCheckSum) throws > SVNException { > try{ > InputStream baseIs = new ByteArrayInputStream(mytext.getBytes("UTF-8")); > myDeltaProcessor.applyTextDelta(baseIs, baos, true); > } catch(Exception e){ > throw new IllegalStateException(e); > } > } > > @Override > public OutputStream textDeltaChunk(String path, SVNDiffWindow diffWindow) > throws SVNException { > long origStartPos = diffWindow.getSourceViewOffset(); > long origEndPos = origStartPos + diffWindow.getSourceViewLength(); > > ByteBuffer x = ByteBuffer.wrap(new > byte[diffWindow.getNewDataLength()+100]); > diffWindow.writeNewData(x, 0, diffWindow.getNewDataLength()); > myDeltaProcessor.textDeltaChunk( diffWindow ); > return null; > } > > but I become a little lost how SVNKit's diffwindow gives me back the changes > (mydata is a private attribute in diffWindow) and how they can be applied to > mytext... Can anyone clarify this for me? --------------------------------------------------------------------- To unsubscribe, e-mail: svnkit-users-unsubscribe@... For additional commands, e-mail: svnkit-users-help@... |
| Free embeddable forum powered by Nabble | Forum Help |