English 中文(简体)
除了 SVN 的文件外, 除了 SVN 的文件如何全部加密?
原标题:How commit all files except one with SVN

我要除一个使用 Subversion 的文件外, 全部修改过的文件 。

情况是这样的:

$ svn st
M    file1
M    file2
M    file3
M    file4

我可以做这样的事:

svn ci -m "Commit 1" file1 file2 file3
svn ci -m "Commit 2" file4

但是,当大量文件的时候, 我试图简化我的工作:

svn ci -m "Commit 1" `svn st | awk  {print $2}  | grep -v file4`
svn ci -m "Commit 2" file4

这种解决办法非常脆弱,因为这种设想方案行不通:

$ svn st
M    file1
M    file2
D    file3
A +  file4

我认为SVN没有办法解决我的问题,但我不确定。还有别的办法吗?

最佳回答

备选案文1, AWK:

svn ci -m "Commit 1" `svn st | awk  {print $NF}  | grep -v file4`
svn ci -m "Commit 2" file4

备选2,目标:

svn ci -m "Commit 1" --targets filesToCommit.txt
svn ci -m "Commit 2" file4

备选3, -- -- 更改列表:

svn changelist my-changelist file1 file2 file3
svn ci -m "Commit 1" --changelist my-changelist
svn ci -m "Commit 2" file4
问题回答

你可以做到这一点:

svn diff file4 > tmp.patch
svn revert file4
svn ci -m "Commit 1"
svn patch tmp.patch

此时所有文件均被提交, 但 file4 除外

提交除使用更改列表的单子外的所有文件 :

svn changelist my-list -R .
svn changelist --remove file4
svn ci -m "Commit 1" --changelist my-list
svn ci -m "Commit 2" file4

虽然我敢肯定,你可以想出一个解决方案, 就像你建议的那样, 使用更复杂的 awk 命令线, 因为我们只谈论一个文件, 为什么不呢?

  1. Copy the file to a temporary location
  2. svn revert the modified file to get the original back
  3. Commit the whole repository
  4. Copy the modified file back

简单,简单,快。

您可以在 < a href=> 中添加包含脚本的文件到 < a href=> http://svnbook.red-bean.com/en/1.7/svn.advanced. changelists.html" rel=“nofollow” >change list 并承诺执行。 您可以检查列表, 以确保列表在承诺前包含正确的项目 。

svn changelist -- help -changelist 选项,载于 svn ci -- help

仅执行过滤过的文件列表 。

svn ci `ls | grep -v file4`




相关问题
Best practices for Subversion and Visual Studio projects

I ve recently started working on various C# projects in Visual Studio as part of a plan for a large scale system that will be used to replace our current system that s built from a cobbling-together ...

Changing username in SVN+SSH URI on the fly in working copy

I am using SVN+SSH to check out a working copy of repository from an SVN server on which all developers are members of a developer group and have full read/write permissions on the repository ...

ASP.NET MVC: How should it work with subversion?

So, I have an asp.net mvc app that is being worked on by multiple developers in differing capacities. This is our first time working on a mvc app and my first time working with .NET. Our app does not ...

How to search for file in subversion server?

Is there a way to search for a file in a subversion repository? Something similar to Unix find command, with which I can find the location of a file in a repository. I know there is svn list, but ...

热门标签