-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSVNImport.mm
74 lines (63 loc) · 1.88 KB
/
SVNImport.mm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#import "SVNImport.h"
#import "SVNProgress.h"
#import "main.h"
//------------------------------------------------------------------------------
// SVNimport
//------------------------------------------------------------------------------
@implementation SVNImport
-(id)init {
if (self = [self initWithWindowNibName:@"SVNImport"]) {
[self setShouldCascadeWindows:NO];
[self setWindowFrameAutosaveName:@"SVNImport"];
[self setLogo];
svn = new SVNcontext;
}
return self;
}
-(void)dealloc {
[super dealloc];
[paths release];
}
-(void)windowDidLoad {
[super windowDidLoad];
NSArray *array = [SVNService getLRU:@"repository"];
[repo addItemsWithObjectValues:array];
}
-(void)windowWillClose:(NSNotification*)notification {
[self release];
}
- (IBAction)ok_pressed:(id)sender {
SVNProgress *prog = [[SVNProgress alloc] initWithTitle:@"Import"];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^ {
NSString *dest = [repo stringValue];
NSString *log = [message stringValue];
svn_error_t *err = 0;
for (NSString *srce in paths) {
NSString *dest2 = [NSString stringWithFormat:@"%@/%@", dest, [srce lastPathComponent]];
if ([srce isDir]) {
if ((err = svn->MakeDir(prog, dest2, log)))
break;
if ((err = svn->Checkout(prog, dest2, srce)))
break;
NSError *error = nil;
for (NSString *file in [[NSFileManager defaultManager] contentsOfDirectoryAtPath:srce error:&error]) {
if ([file hasPrefix:@"."])
continue;
if ((err = svn->Add(prog, [srce stringByAppendingPathComponent:file])))
break;
}
}
// if ((err = svn->Import(prog, srce, [NSString stringWithFormat:@"%@/%@", dest, [srce lastPathComponent]], log)))
// break;
}
[prog finishedWithError:err];
});
[self close];
}
- (IBAction)cancel_pressed:(id)sender {
[self close];
}
-(void)svn_import:(NSArray*)_paths {
paths = [_paths retain];
}
@end