-
Notifications
You must be signed in to change notification settings - Fork 395
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #61 from bewebste/master
[NEW] Brian Webster's contributed template to help diff .xcdatamodels.
- Loading branch information
Showing
2 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
contributed templates/Brian Webster/Diff template readme.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
Diff mogenerator template | ||
------------------------- | ||
This template was created for the use case of merging two versions of a .xcdatamodel file, | ||
e.g. when doing a merge in a version control system. Since data model files are stored as | ||
binary data, there is no way to directly diff them. Additionally, since it's an undocumented | ||
format, even if we're able to diff them, there still isn't any way to automatically apply those diffs. | ||
|
||
The template itself basically just dumps the relevant properties and relationships for each | ||
entity in the data model into a pseudo plist looking format, with each relevant attribute put | ||
on its own line. In order to merge two versions of a data model, you would perform the following | ||
steps: | ||
|
||
1. Run mogenerator on each of the two versions of the data model and put the results into two | ||
different directories. | ||
2. Use your favorite diff tool to diff the two resulting directories | ||
3. Look at the changes in each class, then use the data model editor in Xcode to manually apply | ||
each change to one of the two versions of the data model, so that they match | ||
4. Once you've gone through and made all the changes, you can re-run mogenerator on the edited | ||
version, re-diff them, and double check that you didn't miss anything | ||
|
||
The one major caveat here is that only entites in the data model are currently handled, so if | ||
your model has any fetch request templates in it, those will not be included in the output. | ||
If anyone wants to add them to the output, feel free. :) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
name = <$name$>, | ||
managedObjectClassName = <$managedObjectClassName$>, | ||
renamingIdentifier = <$renamingIdentifier$>, | ||
isAbstract = <$isAbstract$>, | ||
userInfo = <$userInfo$>, | ||
relationships = ( | ||
<$foreach Relationship noninheritedRelationships do$> | ||
{ | ||
name = <$Relationship.name$>, | ||
isIndexed = <$Relationship.isIndexed$>, | ||
isTransient = <$Relationship.isTransient$>, | ||
isOptional = <$Relationship.isOptional$>, | ||
userInfo = <$Relationship.userInfo$>, | ||
destinationEntity = <$Relationship.destinationEntity.name$>, | ||
inverseRelationship = <$Relationship.inverseRelationship.name$>, | ||
deleteRule = <$Relationship.deleteRule$>, | ||
maxCount = <$Relationship.maxCount$>, | ||
minCount = <$Relationship.minCount$>, | ||
isToMany = <$Relationship.isToMany$> | ||
} | ||
<$endforeach do$> | ||
) | ||
attributes = ( | ||
<$foreach Attribute noninheritedAttributes do$> | ||
{ | ||
name = <$Attribute.name$>, | ||
isIndexed = <$Attribute.isIndexed$>, | ||
isTransient = <$Attribute.isTransient$>, | ||
isOptional = <$Attribute.isOptional$>, | ||
userInfo = <$Attribute.userInfo$>, | ||
attributeType = <$Attribute.attributeType$>, | ||
attributeValueClassName = <$Attribute.attributeValueClassName$>, | ||
defaultValue = <$Attribute.defaultValue$>, | ||
valueTransformerName = <$Attribute.valueTransformerName$> | ||
} | ||
<$end> | ||
) | ||
} |