如何为不同的客户端用户维护多个版本的测试文件?

发布于 2024-12-28 20:44:03 字数 950 浏览 0 评论 0原文

我有一个文本文件,需要为少数客户端用户维护略有不同的版本。该文件的内容并不是很相关,但无论如何我都会分享。该文件包含一个 SQL 脚本(以及一些其他内容),我的客户将其加载到他们本地的第三方软件(不是我公司的,我们无法控制该软件)。该脚本的目的是允许其他软件输出报告。

每个客户端都需要稍微不同的脚本版本。至少,文件名会不同(包含客户端的名称),并且报告名称(文件内的文本)也会不同。对于其中一些,SQL 会稍微修改以适应他们的环境。

我该如何维护这个?如果我想向我的所有客户端发布增强功能怎么办?目前我正在手动执行此操作,因此我必须编辑每个文件并进行增强的更改。

我考虑过使用版本控制软件,每个客户端一个分支,然后我可以将任何更新合并到每个分支中 - 但我不相信合并将足够准确,因此不会节省我任何时间只会引起更多的头痛。另外,这是否能够处理每个分支中的不同文件名?

欢迎任何想法。

更新:下面是两个简化的示例。

文件名:sql_abcclient_system2.txt

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

文件名: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)

另外,将某些参数(例如客户端名称)存储在数据库或配置文件中听起来很合理。但我不确定这对于其他文件内修改是否可行,例如对 SQL 的更改。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

静待花开 2025-01-04 20:44:03

这是为了管理一个钩子。

您需要版本控制:

  • 模板
  • 值文件(其中包含每个客户端的所有不同值)
  • 能够生成最终文件的脚本,具有正确的名称和内容,具体取决于执行环境(以便它可以检测和提取例如,用户名,并使用该信息从值文件中检索正确的值,生成正确的最终文件)。

例如,对于 Git,挂钩将是一个“smudge”脚本,是 内容过滤器驱动程序,在签出 Git 存储库时自动执行。

内容过滤驱动程序

因此无需管理多个分支,并且任何常见更新立即可供所有客户端使用(通过更新模板和/或脚本)。

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).

拧巴小姐 2025-01-04 20:44:03

关于文件的合并,我认为它们不能自动完成。

例如,如果您使用 ClearCase 并且您只想合并认为是更新的内容,则合并过程会检测到文件中还存在其他差异,并会尝试弄清楚如何合并它们。

最后,您必须通过手动选择在合并每个文件期间保留的部分来“帮助”合并。
自动合并就这么多。

至于文件的命名,我不确定。因为每个文件都有自己的行,并且您想在不同的行之间合并。我认为这就像合并目录。

如果我得到你想要做的事情,我相信通过源代码控制的过程将非常乏味

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文