Subversion:防止提交对一个文件的本地修改? [英] Subversion: prevent local modifications to one file from being committed?

查看:30
本文介绍了Subversion:防止提交对一个文件的本地修改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Subversion 工作副本,我在其中对一个文件进行了一些本地修改.修改只与我有关,我不想提交.(存储库中的版本包含一些适用于其他用户的默认值,只是不适合我,这就是我想在本地覆盖它们的原因.)

I have a Subversion working copy where I made some local modifications to one file. The modifications are only relevant to me, I do not want to commit them. (The version in the repository contains some default values which are suitable for the other users, just not for me, which is why I want to override them locally.)

请注意,虽然我不想提交更改,但我确实希望在我执行 svn update 时接收存储库中所做的任何更新.此外,只有在我的工作副本中,我不想提交对该文件的更改,其他用户不应该受到影响.所以 svn:ignore 或 commit hooks 不符合我的目的.

Note that although I do not want to commit my changes, I do want to receive any updates made in the repository when I do svn update. Also, it is only in my working copy that I do not want to commit the changes to that file, the other users should not be affected. So svn:ignore or commit hooks do not fit my purpose.

目前,我只是这样做:

svn commit file1 file2...

其中我明确指定有更改的文件排除我不想提交的特定文件.

where I specify explicitly the files that have changes excluding the particular file that I do not want to commit.

然而,我在工作的时候,有一个简单的写作习惯:

However, while I'm working, I have the habit of simply writing:

svn commit -m "Log of what I just did"

而且我担心在我不专心的时候使用上面的命令会在不经意间提交禁止"文件.

and I fear that I will inadvertently commit the "forbidden" file by using the above command at a moment when I'm not attentive.

简而言之,我正在寻找的只是一种在工作副本中标记"文件的方法,以防止 Subversion 提交该文件中的更改(它不必自动排除,即使我当我尝试提交所有文件时出现错误,这很好).有点像将文件标记为冲突"状态...

In short, what I'm looking for is simply a way of "marking" a file in a working copy which prevents Subversion from committing the changes in that file (it doesn't have to be automatic exclusion, even if I just get an error when I try to commit all files, it is fine). Sort of like marking files in a "conflict" state...

这种东西存在吗?

更新:akent,感谢您指出这一点非常相似的问题.

Update: akent, thanks for pointing out this very similar question.

推荐答案

已经有几个可行的答案:

There have been a few answers that can work:

  1. 创建一个预提交钩子脚本,在添加特定属性时拒绝提交.然后,您可以将此属性添加到工作副本中的文件以防止提交.
  2. TortoiseSVN 将排除特殊更改列表ignore-on-commit"中的文件.但是,SVN 命令行客户端不支持这一点.

CoverosGene 建议诸如 svn commit 之类的默认命令对默认更改列表进行操作,这样您可以在将文件分配给另一个更改列表时排除该文件,但我找不到任何参考在文档和我的测试中这不起作用.

CoverosGene suggested that the default commands such as svn commit operate on a default changelist, such that you can exclude a file if you assign it to another changelist, but I can't find any reference of that in the documentation, and in my testing this does not work.

由于SVN命令行客户端没有很好的解决方案,我开了一个增强请求此处.该请求表明命令行客户端也可以遵守提交时忽略"更改列表.

Since there is no good solution for the SVN command-line client, I've opened an enhancement request here. The request suggests that the command-line client could also honor the "ignore-on-commit" changelist.

更新:现在是 issue 2858 并且有一个 功能大纲 用 svn:hold<处理它/code> 属性.

Update: This is now issue 2858 and there is a feature outline to handle it with an svn:hold property.

这篇关于Subversion:防止提交对一个文件的本地修改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆