This repository has been archived by the owner on Jul 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
COEditCreateBranch.m
70 lines (58 loc) · 2.15 KB
/
COEditCreateBranch.m
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
#import "COEditCreateBranch.h"
#import <EtoileFoundation/Macros.h>
@implementation COEditCreateBranch : COEdit
static NSString *kCOBranchUUID = @"COBranchUUID";
static NSString *kCOOldBranchUUID = @"COOldBranchUUID";
static NSString *kCONewVersionToken = @"CONewVersionToken";
static NSString *kCOSetCurrent = @"COSetCurrent";
- (id) initWithOldBranchUUID: (ETUUID*)aOldBranchUUID
newBranchUUID: (ETUUID*)aNewBranchUUID
setCurrent: (BOOL)setCurrent
newToken: (CORevisionID *)newToken
UUID: (ETUUID*)aUUID
date: (NSDate*)aDate
displayName: (NSString*)aName
{
NILARG_EXCEPTION_TEST(aNewBranchUUID);
NILARG_EXCEPTION_TEST(newToken);
self = [super initWithUUID: aUUID date: aDate displayName: aName];
ASSIGN(oldBranch_, aOldBranchUUID);
ASSIGN(branch_, aNewBranchUUID);
setCurrent_ = setCurrent;
ASSIGN(newToken_, newToken);
return self;
}
- (id) initWithPlist: (id)plist
{
self = [super initWithPlist: plist];
ASSIGN(oldBranch_, [ETUUID UUIDWithString: [plist objectForKey: kCOOldBranchUUID]]);
ASSIGN(branch_, [ETUUID UUIDWithString: [plist objectForKey: kCOBranchUUID]]);
setCurrent_ = [[plist objectForKey: kCOSetCurrent] boolValue];
ASSIGN(newToken_, [CORevisionID revisionIDWithPlist: [plist objectForKey: kCONewVersionToken]]);
return self;
}
- (id)plist
{
NSMutableDictionary *result = [NSMutableDictionary dictionary];
[result addEntriesFromDictionary: [super plist]];
[result setObject: [branch_ stringValue] forKey: kCOBranchUUID];
[result setObject: [oldBranch_ stringValue] forKey: kCOOldBranchUUID];
[result setObject: [NSNumber numberWithBool: setCurrent_] forKey: kCOSetCurrent];
[result setObject: [newToken_ plist] forKey: kCONewVersionToken];
[result setObject: kCOEditCreateBranch forKey: kCOUndoAction];
return result;
}
- (COEdit *) inverseForApplicationTo: (COPersistentRootInfo *)aProot
{
assert(0);
return nil;
}
- (void) applyToPersistentRoot: (COPersistentRootInfo *)aProot
{
assert(0);
}
+ (BOOL) isUndoable
{
return YES;
}
@end