1

I have a text file that I need to maintain slightly different versions of for a handful of client users. The contents of the file are not hugely relevant, but I will share anyway. The file contains a SQL script (along with some other stuff), which my clients load into their local third-party software (which is not my company's, and we have no control over that software). The purpose of the script is to allow that other software to output a report.

Each of the clients needs a slightly different version of the script. At a minimum, the file name will be different (containing the name of the client), and the report name (which is text within the file) will be different. For some of them, the SQL is slightly modified to accommodate their environment.

How can I maintain this? What if I want to release an enhancement to all of my clients? Currently I'm doing it manually, so that I have to edit each file and make the enhanced change.

I've considered using version control software, with one branch per client, and then I could merge any updates in to each branch - but I don't have confidence that the merge will be accurate enough, and would therefore not save me any time and just cause more headaches. Also, would that be able to handle the different file names in each branch?

Any ideas are welcome.

Update: Two simplified examples are below.

Filename: sql_abcclient_system2.txt

//Title
ABCClient Report
//end Title
SELECT site.name, site.phone
FROM site
WHERE site.type IN (1, 2, 3)

Filename: sql_xyzclient_system3.txt

//Title
XYZClient Report
//end Title
SELECT site.name, isnull(site.phone, 'no-phone'), site.status
FROM site
WHERE site.type IN (1, 2)

Also, it sounds reasonable to store certain parameters in a database or config file, like the client name. But I'm not sure if that would be feasible for the other in-file modifications, like changes to the SQL.

  • Some example with fakes names would help understand your problem. Meanwhile try to figure out if you can database & pattern-ize your file contents. `%name-%version.txt` could auto-compile individual files – Mikhail Jan 24 '12 at 19:41

2 Answers2

1

This is for a hook to manage.

You need to version:

  • a template
  • a value file (with all the different values for each client in it)
  • a script able to generate the final file, with the right name and content, depending on the execution environment (so it can detect and extract the user name, for instance, and use that information to retrieve the correct values from the values file, generating the correct final file).

For example, with Git the hook would be a 'smudge' script, part of content filter driver, executed automatically on checkout of a Git repo.

content filter driver

So no multiple branch to manage, and any common update immediately available for all clients (by updating the template and/or the script).

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
0

Concerning the merging of the files, I don't think that they can be done automatically.

E.g. if you used ClearCase and you wanted to merge only what you consider as an update, the merging process would detect that there are other differences in the files as well and will try to figure out how to merge those too.

In the end you would have to "help" the merge by manually selecting which portion to keep during merge for each file.
So much for automatic merge.

As for the naming of the files I am not sure.Because each file will have each own line and you want to merge among different lines.It is like merging directories I think.

If I got what you are trying to do, the procedure via source control I believe will be very tedious

Cratylus
  • 52,998
  • 69
  • 209
  • 339