Random thing that I figured out, after having some unsuccessful google searches. Here's hoping this little tidbit will save someone some time some day.
For those using Subversion and Xcode, this may be particularly relevant. And that'll be my example, though I'm sure there are plenty of other times that this could come up, as well.
When creating a new project (let's call it "Foo") in Xcode, a bunch of stuff is created. for example, when I create a new iPhone application project called Foo, I get the following hierarchy of files:
Foo/Classes/
Foo/Classes/FooAppDelegate.h
Foo/Classes/FooAppDelegate.m
Foo/Foo-Info.plist
Foo/Foo-Info.plist.orig
Foo/Foo.xcodeproj/
Foo/Foo.xcodeproj/TemplateInfo.plist.orig
Foo/Foo.xcodeproj/lindes.mode1v3
Foo/Foo.xcodeproj/lindes.pbxuser
Foo/Foo.xcodeproj/project.pbxproj
Foo/Foo_Prefix.pch
Foo/MainWindow.xib
Foo/build/
Foo/build/Foo.build/
Foo/build/Foo.build/Foo.pbxindex/
Foo/build/Foo.build/Foo.pbxindex/categories.pbxbtree
Foo/build/Foo.build/Foo.pbxindex/cdecls.pbxbtree
Foo/build/Foo.build/Foo.pbxindex/decls.pbxbtree
Foo/build/Foo.build/Foo.pbxindex/files.pbxbtree
Foo/build/Foo.build/Foo.pbxindex/imports.pbxbtree
Foo/build/Foo.build/Foo.pbxindex/pbxindex.header
Foo/build/Foo.build/Foo.pbxindex/protocols.pbxbtree
Foo/build/Foo.build/Foo.pbxindex/refs.pbxbtree
Foo/build/Foo.build/Foo.pbxindex/strings.pbxstrings/
Foo/build/Foo.build/Foo.pbxindex/strings.pbxstrings/control
Foo/build/Foo.build/Foo.pbxindex/strings.pbxstrings/strings
Foo/build/Foo.build/Foo.pbxindex/subclasses.pbxbtree
Foo/build/Foo.build/Foo.pbxindex/symbols0.pbxsymbols
Foo/main.m
Of these, there are a few things I don't want:
- The entire Foo/build/ hierarchy.
- the lindes.pbxuser and lindes.mode1v3 files under Foo/Foo.xcodeproj. (I'm actually not 100% sure there's no useful information in these files, but they sure do change a lot, and I think most of the important stuff is in project.pbxproj, so... here's hoping these are safe to ignore. If anyone knows more about that, please feel free to point me at an authoritative reference or give me the skinny in the comments.)
If I do just svn add Foo, though, I get those things. I want to ignore them.
Well, I can do svn propset svn:ignore build Foo after my add, but build has already been added, so it's still going to go into the repository if I don't do something about it. (And then I'd do the same thing (but most likely using svn propedit) for *.pbxuser and *.mode1v3 under the xcodeproj directory.)
So what I was looking for was an option for telling svn add to ignore certain things during the add process. As far as I was able to determine, there is no option to svn add that will do this. But there is a way to get basically what I want! It's called "svn revert". With appropriate options, it will make svn forget you ever added something, without otherwise modifying anything.
Here's an example set of commands that would do the trick:
: $; svn add Foo
: $; cd Foo
: $; svn revert -R build
: $; svn propset svn:ignore build .
: $; cd Foo.xcodeproj
: $; svn revert *.pbxuser *.mode1v3
: $; svn propset svn:ignore "*.pbxuser
*.mode1v3" .
: $; cd ..
: $; svn status
(Couple quick notes: (1) my shell prompt is ': $; ' (and the text actually typed is in bold), (2) in that second svn propset, I actually hit return inside the quotes. In my shell (zsh), I get a second-level prompt of 'dquote> ' when I do this, but I didn't want to confuse the text above with that.)
And that does the trick. If I now do an svn status, I get:
A .
A Foo.xcodeproj
A Foo.xcodeproj/TemplateInfo.plist.orig
A Foo.xcodeproj/project.pbxproj
A main.m
A Foo-Info.plist.orig
A Foo-Info.plist
A Foo_Prefix.pch
A Classes
A Classes/FooAppDelegate.h
A Classes/FooAppDelegate.m
A MainWindow.xib
No "?" lines, no build or its contents, and no pbxuser or mode1v3 files. Perfect!
(Well, OK, it might be useful to do something with TemplateInfo.plist.orig, but... that's something to figure out another day. :-)
No comments:
Post a Comment