изменить свойство файла SVN на лету с svnkit - PullRequest
1 голос
/ 30 сентября 2011

Мне нужно на лету изменить значение версионного настраиваемого свойства файла в репозитории svn.Я не хочу изменять какой-либо контент, просто измените значение свойства уже существующего файла.Я использую svnkit в Java.

Как мне это сделать?

example: 
http:://svnserver.com/example/directorya/file1.txt   ... has svn property: myproperty = abc

after the operation:
http:://svnserver.com/example/directorya/file1.txt   ... has svn property: myproperty = def

Это то, что я пытался, но это не работает.Вместо изменения свойства файла он добавляет фиксацию ко всему репо, не касаясь файла file1.txt.

    SVNRepository repository = SVNRepositoryFactory.create(url);       

    ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager(user,password);
    repository.setAuthenticationManager(authManager);

    ISVNEditor editor = repository.getCommitEditor("comment" , null);
    editor.openRoot(-1);
    editor.openFile("file1.txt", -1);
    editor.changeFileProperty("file1.txt", "mypropertyname", SVNPropertyValue.create("myvalue"));
    editor.closeEdit();

1 Ответ

3 голосов
/ 05 октября 2011

я не вызывал closeFile (), и мне нужно было "/" перед именем файла, теперь оно работает

SVNRepository repository = SVNRepositoryFactory.create(url);       

ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager(user,password);
repository.setAuthenticationManager(authManager);

ISVNEditor editor = repository.getCommitEditor("comment" , null);
editor.openRoot(-1);
editor.openFile("/file1.txt", -1);
editor.changeFileProperty("/file1.txt", "mypropertyname", SVNPropertyValue.create("myvalue"));
editor.closeFile("/file1.txt",null);
editor.closeEdit();
...