List Info

Thread: check out a single file?




check out a single file?
user name
2008-02-27 09:23:18
hi

great library, thanks!

I wonder if there is a way to check out a single file? SVN
doesn't allow you
to do this AFAIK, so probably SVNKit doesn't either, but I
thought I'd ask
in case there's something I've missed...

(I'm building a wiki/CMS that uses SVNKit as the backend:
http://gatewiki.sf.net/,
and while users are editing we check out to a
staging area; at present I have to checkout all the files in
the directory
of the file being edited, but would prefer just to check out
one file

thanks again, best,

hamish

--
Prof. Hamish Cunningham
Department of Computer Science
University of Sheffield
Regent Court
211 Portobello St.
Sheffield  S1 4DP
United Kingdom
http://www.dcs.she
f.ac.uk/~hamish/
-- 
View this message in context: http://www.nabble.com/check-out-a-single-
file--tp15715505p15715505.html
Sent from the SVNKit - Users mailing list archive at
Nabble.com.


------------------------------------------------------------
---------
To unsubscribe, e-mail: svnkit-users-unsubscribesvnkit.com
For additional commands, e-mail: svnkit-users-helpsvnkit.com


Re: check out a single file?
user name
2008-02-27 09:39:51
I haven't really looked into it, but the next version of
subversion 
should have 'sparse' checkouts; so that helps. If I were you
I'd also 
take a look that the JCR specification, it seems to be much
more 
flexible as far as handling the kind of task you need
(although 
admittedly subversion has been around longer and has more
generic tools).

hcunningham wrote:
> hi
>
> great library, thanks!
>
> I wonder if there is a way to check out a single file?
SVN doesn't allow you
> to do this AFAIK, so probably SVNKit doesn't either,
but I thought I'd ask
> in case there's something I've missed...
>
> (I'm building a wiki/CMS that uses SVNKit as the
backend:
> http://gatewiki.sf.net/,
and while users are editing we check out to a
> staging area; at present I have to checkout all the
files in the directory
> of the file being edited, but would prefer just to
check out one file
>
> thanks again, best,
>
> hamish
>
> --
> Prof. Hamish Cunningham
> Department of Computer Science
> University of Sheffield
> Regent Court
> 211 Portobello St.
> Sheffield  S1 4DP
> United Kingdom
> http://www.dcs.she
f.ac.uk/~hamish/
>   


------------------------------------------------------------
---------
To unsubscribe, e-mail: svnkit-users-unsubscribesvnkit.com
For additional commands, e-mail: svnkit-users-helpsvnkit.com


Re: check out a single file?
user name
2008-02-27 09:51:16
thanks for that; co with --depth=empty then update on one
file would do the
trick. guess I'll need to wait for 1.5

I did look at the JCR but I like SVN's maturity and
stability, and the ease
of allowing other tools to access the repository, working
copies and so on

tnx

h


rrsIPOV wrote:
> 
> I haven't really looked into it, but the next version
of subversion 
> should have 'sparse' checkouts; so that helps. If I
were you I'd also 
> take a look that the JCR specification, it seems to be
much more 
> flexible as far as handling the kind of task you need
(although 
> admittedly subversion has been around longer and has
more generic tools).
> 
> hcunningham wrote:
>> hi
>>
>> great library, thanks!
>>
>> I wonder if there is a way to check out a single
file? SVN doesn't allow
>> you
>> to do this AFAIK, so probably SVNKit doesn't
either, but I thought I'd
>> ask
>> in case there's something I've missed...
>>
>> (I'm building a wiki/CMS that uses SVNKit as the
backend:
>> http://gatewiki.sf.net/,
and while users are editing we check out to a
>> staging area; at present I have to checkout all the
files in the
>> directory
>> of the file being edited, but would prefer just to
check out one file
>>
>> thanks again, best,
>>
>> hamish
>>
>> --
>> Prof. Hamish Cunningham
>> Department of Computer Science
>> University of Sheffield
>> Regent Court
>> 211 Portobello St.
>> Sheffield  S1 4DP
>> United Kingdom
>> http://www.dcs.she
f.ac.uk/~hamish/
>>   
> 
> 
>
------------------------------------------------------------
---------
> To unsubscribe, e-mail: svnkit-users-unsubscribesvnkit.com
> For additional commands, e-mail: svnkit-users-helpsvnkit.com
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/check-out-a-single-
file--tp15715505p15716084.html
Sent from the SVNKit - Users mailing list archive at
Nabble.com.


------------------------------------------------------------
---------
To unsubscribe, e-mail: svnkit-users-unsubscribesvnkit.com
For additional commands, e-mail: svnkit-users-helpsvnkit.com


Re: check out a single file?
user name
2008-02-27 12:09:07
Hello,

While sparse checkout feature is not yet available I'd
suggest you to 
use SVNRepository API to implement editing file.

To get file contents you may obviously use
SVNRepository.getFile(...) 
method. To commit modified version later, you may use the
following snippet:

     String parentDirURL =
"file:///c:/users/alex/sandbox/repos/dir";
     String fileName = "file.txt";
     byte[] newContents = new byte[] {'a', 'b', 'c'};
     InputStream is = new
ByteArrayInputStream(newContents);

     SVNDeltaGenerator generator = new SVNDeltaGenerator();
     SVNURL url = SVNURL.parseURIEncoded(parentDirURL);
     SVNRepository repos =
SVNRepositoryFactory.create(url);

     ISVNEditor commitEditor =
repos.getCommitEditor("message", null);
     try {
         commitEditor.openRoot(-1);
         commitEditor.openFile(fileName, -1);
         commitEditor.applyTextDelta(fileName, null);
         String checksum =
             generator.sendDelta(fileName, is, commitEditor,
true);
         commitEditor.closeFile(fileName, checksum);
         commitEditor.closeDir();
         SVNCommitInfo info = commitEditor.closeEdit();
         System.out.println(info);
         commitEditor = null;
     } finally {
         if (commitEditor != null) {
             commitEditor.abortEdit();
         }
         repos.closeSession();
     }


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

hcunningham wrote:
> hi
> 
> great library, thanks!
> 
> I wonder if there is a way to check out a single file?
SVN doesn't allow you
> to do this AFAIK, so probably SVNKit doesn't either,
but I thought I'd ask
> in case there's something I've missed...
> 
> (I'm building a wiki/CMS that uses SVNKit as the
backend:
> http://gatewiki.sf.net/,
and while users are editing we check out to a
> staging area; at present I have to checkout all the
files in the directory
> of the file being edited, but would prefer just to
check out one file
> 
> thanks again, best,
> 
> hamish
> 
> --
> Prof. Hamish Cunningham
> Department of Computer Science
> University of Sheffield
> Regent Court
> 211 Portobello St.
> Sheffield  S1 4DP
> United Kingdom
> http://www.dcs.she
f.ac.uk/~hamish/

------------------------------------------------------------
---------
To unsubscribe, e-mail: svnkit-users-unsubscribesvnkit.com
For additional commands, e-mail: svnkit-users-helpsvnkit.com


Re: check out a single file?
user name
2008-02-28 08:09:45
thanks alex, that looks good!

best

hamish



Alexander Kitaev-3 wrote:
> 
> Hello,
> 
> While sparse checkout feature is not yet available I'd
suggest you to 
> use SVNRepository API to implement editing file.
> 
> To get file contents you may obviously use
SVNRepository.getFile(...) 
> method. To commit modified version later, you may use
the following
> snippet:
> 
>      String parentDirURL =
"file:///c:/users/alex/sandbox/repos/dir";
>      String fileName = "file.txt";
>      byte[] newContents = new byte[] {'a', 'b', 'c'};
>      InputStream is = new
ByteArrayInputStream(newContents);
> 
>      SVNDeltaGenerator generator = new
SVNDeltaGenerator();
>      SVNURL url =
SVNURL.parseURIEncoded(parentDirURL);
>      SVNRepository repos =
SVNRepositoryFactory.create(url);
> 
>      ISVNEditor commitEditor =
repos.getCommitEditor("message", null);
>      try {
>          commitEditor.openRoot(-1);
>          commitEditor.openFile(fileName, -1);
>          commitEditor.applyTextDelta(fileName, null);
>          String checksum =
>              generator.sendDelta(fileName, is,
commitEditor, true);
>          commitEditor.closeFile(fileName, checksum);
>          commitEditor.closeDir();
>          SVNCommitInfo info =
commitEditor.closeEdit();
>          System.out.println(info);
>          commitEditor = null;
>      } finally {
>          if (commitEditor != null) {
>              commitEditor.abortEdit();
>          }
>          repos.closeSession();
>      }
> 
> 
> Alexander Kitaev,
> TMate Software,
> http://svnkit.com/ -
Java [Sub]Versioning Library!
> 
> hcunningham wrote:
>> hi
>> 
>> great library, thanks!
>> 
>> I wonder if there is a way to check out a single
file? SVN doesn't allow
>> you
>> to do this AFAIK, so probably SVNKit doesn't
either, but I thought I'd
>> ask
>> in case there's something I've missed...
>> 
>> (I'm building a wiki/CMS that uses SVNKit as the
backend:
>> http://gatewiki.sf.net/,
and while users are editing we check out to a
>> staging area; at present I have to checkout all the
files in the
>> directory
>> of the file being edited, but would prefer just to
check out one file
>> 
>> thanks again, best,
>> 
>> hamish
>> 
>> --
>> Prof. Hamish Cunningham
>> Department of Computer Science
>> University of Sheffield
>> Regent Court
>> 211 Portobello St.
>> Sheffield  S1 4DP
>> United Kingdom
>> http://www.dcs.she
f.ac.uk/~hamish/
> 
>
------------------------------------------------------------
---------
> To unsubscribe, e-mail: svnkit-users-unsubscribesvnkit.com
> For additional commands, e-mail: svnkit-users-helpsvnkit.com
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/check-out-a-single-
file--tp15715505p15737149.html
Sent from the SVNKit - Users mailing list archive at
Nabble.com.


------------------------------------------------------------
---------
To unsubscribe, e-mail: svnkit-users-unsubscribesvnkit.com
For additional commands, e-mail: svnkit-users-helpsvnkit.com


Re: check out a single file?
user name
2008-04-10 06:56:58
Neat!  I wonder, is there a way to do this without using the
local
filesystem?


To commit modified version later, you may use the following
snippet:

     String parentDirURL =
"file:///c:/users/alex/sandbox/repos/dir";
     String fileName = "file.txt";
    
-- 
View this message in context: http://www.nabble.com/check-out-a-single-
file--tp15715505p16608352.html
Sent from the SVNKit - Users mailing list archive at
Nabble.com.


------------------------------------------------------------
---------
To unsubscribe, e-mail: svnkit-users-unsubscribesvnkit.com
For additional commands, e-mail: svnkit-users-helpsvnkit.com


[1-6]

about | contact  Other archives ( Real Estate discussion Medical topics )