FoxPro class to generate SCCText for all files in a Project

Version control for FoxPro source code

If you want to place your FoxPro source code files in a Source Code Repository of some sort, you usually need to generate text file versions of your table-based FoxPro files like SCX, VCX, and FRX. These text versions of the binary FoxPro files are necessary for the versioning features of code repository tools work properly. FoxPro is unique in having binary source code files in a projects, whereas most other languages use raw text for all of their code files.

We’ve long had a tool to generate these text versions of our Forms, Classlibs, and Reports (see the updated SCCText app here: However, using this file is still a tedious way to get your SCC files generated if you try to do it by hand. Sure, the FoxPro IDE can hook into this app if you set it all up and are working on one of the source control systems that VFP was natively designed to work with. But VFP is getting kind of old, and there are many options that exist today the VFP simply cannot work with out of the box.

I recently wanted to use the Mercurial source control repository to manage the development of my GoFish 4 Code Search project. I set up a free project hosting account on and installed the Tortiose Hg software on my Windows machine, and then I was able to commit code changes to this magic repo in the sky and share it with the whole world.

Sadly, VFP does not have support for this newer Distributed Version Control System, so I can’t “hook up” FoxPro to use SCCText and then “check in” my code in the VFP way.

VFP Version Control with Mercurial

Rick Borup presented a session at SWFox 2011 on using Mercurial version control with FoxPro source code. You can get a free PDF copy of the whitepaper here:

The CreateSCCText Class

To automate creation of the SCC files, I have created a custom class with a method that recursively calls SCCText for each file in a VFP Project. It’s a snap to use this simple class in a PRG and run it each time right before you commit  changes up to your repo. You can also create a ProjectHook class and include a call this class in the AfterBuild(). It will then automatically create updated SCC files every time you build your VFP project.

It’s DateTime aware for each file, so it will only re-generate the SCC files if the date of the VFP source file is newer than the existing SCC file. This way, when you post your commits, you’re only pushing up SCC files that have changed since the last push. There is also support for skipping over certain files that you may not want to process with SCCText.

I owe a lot of credit to Paul for getting me started on that SCCTextGeneration stuff.  He gave me some helpful code in a UT message when I asked a question about running a process on every file in a Project.  He basically gave me the code to do it in his reply (see message# 1507894).  I just bundled it all up in a class/module and made some noise about it.

You can get the source code for this simple class here:

Other sources for getting and using SccTextX

*UPDATE*  Here’s newer way that I’ve begun to automate the generation of text files from the FoxPro binaries – *before each commit*, I run this code below which calls a Thor Procedure to generate the text files from the pass project (I wrote this Thor Proc and passed it on to Jim and he included it in Thor.)  You can get Thor Tool Manager for FoxPro from the VFPx site. It adds lots of great developer tools to the Visual FoxPro IDE.



Basically, you pass in your project path, and it generates the text files by calling a slightly modified-for-Thor verison of SccTextX that we’ve included with Thor.

5 thoughts on “FoxPro class to generate SCCText for all files in a Project”

    1. It’s starting to look like that’s gonna be a popular question to ask about any tool, old or new. I’ll let Jim Nelson decide.

  1. Indeed great job here. We’re planning on switching VSS to Kiln/Mecurial very soon and I need to way to allow VFP to use Kiln and here we are.

    What’s needed though is for a way for team member to update their SCC files and turn them back into Forms/Classes etc.

    Any thoughts on that? Cheers

  2. Very interesting, Matt. I suppose you send the binary files to the repository too, in case you lose your local files. Am I correct?

Leave a Reply

Your email address will not be published. Required fields are marked *