SVN 原子提交操作方法
我在哪里:Linux命令行
我现在遇到的问题:
有时我无法进行原子提交(包含一个特定票证/任务所需的所有修改),因为我们在存储库中有一些文件,其内容在本地开发时有所不同环境。
例如:database.xml
(数据库名称、用户名、密码等)。 我在本地环境中修改此文件,每次需要进行提交/签入时,我都会手动列出提交所需的所有文件/文件夹(不包括本地修改的文件)。
也许这是一个错误的设计决策,必须从存储库中删除 database.xml
并更改为 database.xml.template
(存储在 SVN 中),因此该文件获胜除非您手动执行 svn add ,否则不会被包含到提交中? 也许这是错误的方法 - 将所有这些与环境相关的信息存储在存储库中 - 在这种情况下,我们可以通过提交修改后的配置来破坏所有内容,例如......
据我了解, svn:ignore 属性在这种情况下无能为力,因为它只能用于未存储在存储库中的文件。
这个问题如何解决?
PS:我使用的是 Ubuntu,并且主要使用 SVN 的纯命令行。
Where I am: Linux command line
The problem I have now:
Sometimes I couldn't make atomic commits (consisting all the modifications required for one particular ticket/task), because we have some files in the repository, which contents vary at local development environments.
For example: database.xml
(dbname, username, password, etc.). I modify this file in my local environment, and every time I need to make a commit/checkin I have manually list all the required files/folders for the commit (excluding this locally modified files).
Maybe it is a wrong design decision and database.xml
has to be deleted from the repository and changed for database.xml.template
(stored in SVN), so this file won't be included to commit until you manually execute svn add
for it? Maybe it is wrong approach - to store all this environment dependent information in the repository - in that case we can break everything by commiting a modified configuration, for example..
As I understand it, svn:ignore
property couldn't help in this situation, because it can be used only for files which isn't stored in the repository..
How can this problem be solved?
P.S.: I'm using Ubuntu and mostly pure command line for SVN.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
“标准”过程是这样的(原谅 SVN 语法,我一直在使用 Bazaar 最近):
然后在每个人的开发机器上:
当他们提交时,
database.xml
文件不会被添加到 Subversion。The "standard" procedure for this is something like this (forgiving the SVN syntax, I've been using Bazaar lately):
Then on each person's development machine:
And when they commit,
the
database.xml
file won't be added to Subversion.您应该在存储库中存储模板,而不是需要在本地修改的实际文件。
这样,如果需要,您可以重建原始文件,而不必冒险将文件存储到不应该存在的存储库中。
不, svn:ignore 在这里不会帮助你。
You should store a template in the repository, but not the actual file that you need to modify locally.
This way you can rebuild a pristine file, if you need to, without risking storing a file into the repository that shouldn't be there.
And no, svn:ignore won't help you here.
我的 2 美分:首先,您需要确保是否有任何(简单)方法来协调参与项目的所有开发人员的路径。 这可能是相同的相对目录结构或应用程序中支持某些 shell 变量的某个薄层,例如 $home、%USERPROFILE% 等。随着时间的推移,这比让每个开发人员处理自己的未版本化配置要方便得多这也是 IDE 试图提供的功能。
一般来说,版本控制配置文件对我来说非常适合,这只是开发人员花在设置上的时间,不应该意外丢失。
My 2 cents: First of all you need to make sure if there's any (easy) way to harmonize your paths for all devs involved to your project. This may be the same relative directory structure or some thin layer in your application which supports some shell vars or such like $home, %USERPROFILE% etc. This would be much more convenient over time than letting each dev deal with it's own unversioned configuration and that's what IDEs trying to provide as well.
In general, versioning config files is perfectly fine for me, it's simply time a dev spent to set things up and shouldn't get lost by accident.