简体   繁体   中英

Updating SVN in OSX command line project

I need to run and SVN commit using Objective C The code to run SVN command is like this using an command line application

NSString *command = @"svn add folder; svn commit -m \"Test Add\""
NSArray *arguments = [NSArray arrayWithObjects:@"-c",command, nil];
NSTask *task = [[NSTask alloc] init];
[task setLaunchPath:@"/bin/sh"];
[task setArguments:arguments];

NSPipe *pipe = [NSPipe pipe];
[task setStandardOutput:pipe];
NSFileHandle *file = [pipe fileHandleForReading];
[task launch];
NSData *data = [file readDataToEndOfFile];
NSString *output = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSLog(@"Output %@",output);

but I am getting this error

svn: E155021: This client is too old to work with the working copy at ...
You need to get a newer Subversion client. For more details, see
  http://subversion.apache.org/faq.html#working-copy-format-change

I tried updating the command line tools but didnt work

On initial stages I tried SVN commit using terminal but it also showed the same error so based on this link I have updated the SVN using terminal too but it still shows the error on running the code

I also updated /bin/sh with new SVN but doest work (Also tried with /bin/bash )

Any suggestion to avoid this error and commit it to repository ??

Finally got the solution

I used the which svn command to find where the svn was installed now, while running the command from run button in Xcode it was giving the location as /Applications/Xcode.app/Contents/Developer/usr/bin/svn

but the terminal was using the location /usr/local/bin/svn

So under Xcode goto Products folder and copy the Application Name.app file and paste it to desktop and double click to run it and now it will work fine

But if you need a work around this is what I did

Do it at your own risk

  1. Goto /Applications/Xcode.app/Contents/Developer/usr/bin/ and copy all files starting with svn title and keep it as backup.(Please remember the files that you copy)

  2. Goto /usr/local/bin/svn and copy and replace svn files from here to /Applications/Xcode.app/Contents/Developer/usr/bin/

  3. Now run it and you will not get any version error

Cheers !!! :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM