将文件夹更改提交到 subversion
我有一个目录,在自动化过程中,其文件每天可能会或可能不会更改。该目录包含一堆 oracle 仓库构建器 mdl 文件,它们代表单独的映射。自动 oracle 进程根据 oracle 模块中存在的映射创建 mdl 文件。在 oracle 进程运行之前,不可能知道该目录将包含哪些文件。
在进程填充文件夹后,我需要将目录中的所有文件提交到 subversion。如果昨天存在的文件已经消失(因为 oracle 映射不再存在),那么该文件也应该从 svn 中删除。如果在 oracle 中创建了新映射,并因此将新文件添加到该文件夹,则应将新文件添加到 svn。如果映射已更改并且因此修改了新文件,则应将修改提交给 svn。
所有这些都需要作为自动化过程的一部分发生,因此必须使用 svn 命令行指令将文件夹更改与 svn 同步。
是否有一个简单的 svn 命令(或命令序列)可以将文件夹而不是文件与 svn 存储库同步?
I have a directory whose files may or may not change every day, during an automated process. The directory contains a bunch of oracle warehouse builder mdl files which represent individual mappings. The automated oracle process creates the mdl files based on what mappings exist in an oracle module. It isn't possible to know what files the directory will contain until after the oracle process has run.
I need to commit all files in the directory to subversion after the process has populated the folder. If a file that existed yesterday has disappeared (because the oracle mapping no longer exists) then that file should be deleted from svn as well. If a new mapping was created in oracle and therefore a new file has been added to the folder, the new file should be added to svn. If a mapping has changed and the new file is therefore modified, the modification should be committed to svn.
All of this needs to happen as part of an automated process so svn command line instructions have to be used to sync the folder changes with svn.
Is there a simple svn command (or sequence of commands) that will sync a folder rather than a file with the svn repo?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
假设我们有一个像这样的文件夹树:
dailysnapshot/ 存储每天刷新的 mdl 文件。
workingcopy/ 是你的 Subversion 存储库的工作副本
请注意,此脚本只能提交工作副本下一级的更改,如果工作副本中有子文件夹,则需要改进脚本。
创建一个按照您想要调用 autocommit.sh 进行调度的 crontab
用法:
autocommit.sh [快照目录] [工作目录] [svn 用户名] [svn 密码]
autocommit.sh 源:
自定义以使其适合您的问题。
Assume that we have a folders tree like this:
dailysnapshot/ stores mdl files which refresh daily.
workingcopy/ is your working copy of your subversion repository
Note that this script only can commit changes which 1 level under the working copy, if there is sub-folder in working copy then you need to improve the script.
Make a crontab that is scheduled as you want to call autocommit.sh
Usage:
autocommit.sh [snapshot dir] [working dir] [svn username] [svn password]
autocommit.sh source:
Customize as far as to make it fit your problem.
没有一个简单的解决方案可用。然而,这是一个可以通过脚本来完成的任务(例如使用 bash)。
这个想法是,您将导出目录(从 oracle 导出 mdl 文件的位置)和 svn 工作副本放在不同目录中。更新需要 2 个步骤:
完成后,您提交这些更改(svn commit)。在脚本中实现这一点应该不会太难。
There is not a simple solution available. However this is a task which can be done with scripting (e.g. with bash).
The idea is that you have your export directory (where you export the mdl files from oracle) and your svn working copy in a different directory. Updating takes 2 steps:
After this is finished you commit these changes (svn commit). This shold not be too hard to implement in a script.
您可以尝试 WebDav 和 autoversioning - 即通过暴露的 subversion 存储库“网络共享”。写入和新文件将被添加到存储库中,我不确定是否也会处理删除,但期望这一点似乎不太不切实际。
您应该注意 WebDAV 的一些问题:它有点啰嗦,它不会一次性提交所有文件(因为每个文件都会单独写入),但您可能会从中获得足够的结果。
另一种选择是文件系统驱动程序,它以几乎相同的方式公开存储库。
You could try WebDav and autoversioning - ie the subversion repo exposed via a "network share". Writes and new files will be added to the repository, I'm not sure if deletes will be handled too but it wouldn't appear to be too unrealistic to expect that.
there are issues with WebDAV that you should be aware of: its a bit chatty, it won't commit all files in 1 go (as each will be written individually), but you might get adequate results from it.
An alternative is a filesystem driver that exposes the repo in much the same way.