views:

756

answers:

6

If you are working in PHP (or I guess any programming language...) and using subversion as your source control, is there a way to take your project (for example):

C:\Projects\test\.svn
C:\Projects\test\docs\
C:\Projects\test\faq.php
C:\Projects\test\guestbook.php
C:\Projects\test\index.php
C:\Projects\test\test.php

and build/copy/whatever it so it weeds out certain files and becomes:

C:\Projects\test\faq.php
C:\Projects\test\guestbook.php
C:\Projects\test\index.php

automagically? I'm getting tired of making a branch, and then going through the branch and deleting all of the ".svn" folders, the docs directory, and my prototyping files. I know I could probably use a .bat file to only copy the specific files I want, but I was hoping there was some way with subversion to sort of pseudo ignore a file, to where it will still version it, but where you could make a snapshot of the project that ignores the files you told it to psuedo ignore.

I know I read online somewhere about some functionality that at least lets you copy without the .svn folders, but I can't find it now...

+2  A: 

Here's a wacky gum-and-shoestring idea:

Copy all the files manually or using your existing method for the first time. Then, since I take it you're on a Windows platform, install SyncToy and configure it in the subscribe method, which would effectively one-way copy only the changes made since the last pseudo-commit to production for files already in production. If you want to add a file you can just copy it manually and resume the SyncToy operation.

saint_groceon
+6  A: 

If you use TortoiseSVN, you can use the export feature to automatically strip out all of the .svn files. I think other svn things have the same feature.

Right click the root project folder, TortoiseSVN > Export and tell it where you want the .svn free directory.

Grant
The export feature *should* work with any client but namely the command line client; it is a standard feature.
Frank V
+1  A: 

Copy all the files manually or using your existing method...

@saint_groceon: I like it. It is wacky gum-and-shoestring, but it's intriguing...

TortoiseSVN > Export

Ok, I think that's the method I must have been reading about online. Thanks!

cmcculloh
+1  A: 

Ok, so my final solution is this:

Use the export command to export to a folder called "export" in the same directory as a file called "deploy.bat", then I run the deploy script (v1 stands for version 1, which is what version I am currently on in this project) This script utilizes 7-Zip, which I have placed on my system path so I can use it as a command line utility:

rem replace the v1 directory with the export directory
rd /s /q v1
move /y export\newIMS v1
rd /s /q export

rem remove the prepDocs directory from the project
rd /s /q v1\prepDocs

rem remove the scripts directory from the project
rd /s /q v1\scripts

rem remove individual files from project
del v1\.project
rem del v1\inc\testLoad.html
rem del v1\inc\testInc.js

SET /P version=Please enter version number:

rem zip the file up with 7-Zip and name it after whatever version number the user typed in.
7z a -r v%version%.zip v1

rem copy everything to the shared space ready for deployment
xcopy v%version%.zip /s /q /y /i "Z:\IT\IT Security\IT Projects\IMS\v%version%.zip"
xcopy v1 /s /q /y /i "Z:\IT\IT Security\IT Projects\IMS\currentVersion"

rem keep the window open until user presses any key
PAUSE

I didn't have time to check out the SyncToy solution, so don't take this as me rejecting that method. I just knew how to do this, and didn't have time to check that one out (under a time crunch right now).

Sources:

http://commandwindows.com/command2.htm
http://www.ss64.com/nt/

cmcculloh
A: 

Ok, so my final solution is this:...

Can you version the deploy.bat itself? Then you can have it self distruct when it's done. That's always fun.

Grant
A: 

Can you version the deploy.bat itself? Then you can have it self distruct when it's done. That's always fun.

lol. Actually, the deploy.bat file sits inside of the "branches" directory in my project. I export the main copy that is under "trunk" into the "export" folder in "branches" (I know, technically I should be putting them in "tags" not "branches", that will be a slight tweak for the next project). So anyways, yes, the deploy.bat file is versioned...

I guess what would make this all complete is somehow making a "export.bat" file that called the "export" command in tortoise and told it where to export to, and then called the "deploy.bat" file. Then I would have a one step build and deploy process for my project :)

cmcculloh