使用 Subversion 直接在存储库上工作
一段时间以来,我一直在与 Subversion 作斗争,认为初学者的问题会得到解决。尽管今天我一直在思考它,并意识到问题在于它嵌入客户端文件的方式,并且您通过这些嵌入文件在服务器数据库上工作。
所以我想知道:
- 直接对存储库进行操作是否同样容易,但命令“更加隐藏”(流行书籍中未提及)?
- 是否有任何 GUI 客户端可以在没有这些嵌入文件的情况下工作。(2 月 16 日:以一种很难或很难弄清楚的方式使用 Subversion)
- 是否有 Subversion 的亲戚在这方面“更好”?
之前我使用VSS客户端GUI应用程序,而且它更容易 (尽管我确实想转向更现代的东西)。 举个例子,我安装了 Drupal,其中大部分文件都是我需要跟踪的第三方文件。首先,我需要检查所有内容,然后再检查。 大多数更改都是 Drupal 项目的新版本。 (我知道有脚本可以处理第三方代码,但我仍然认为这一定很麻烦,尤其是当此代码分布在多个目录中时)。
我过去经常做的另一件事是在多个 VSS 数据库中拥有相同的源文件。 (2 月 16 日:这在 Subversion 中会很困难,因为嵌入的 .svn 目录引用一个目录)
**2 月 13 日 ** 看来有些人不太明白,所以: 主要问题是,如果您在不使用 svn 命令的情况下进行了大量更改,尤其是当您替换 3d 方代码时替换目录时,那么您会丢失 .svn 目录。
如果您提前计划,您可以使用 svn_load_dirs.pl,如下所述 http://svnbook.red-bean.com/en/ 1.5/svn.advanced.vendorbr.html 尽管我想要的是能够对我的文件执行任意操作,然后比较并提交到存储库。我不知道如何使用 tortoise 或 svn 命令来做到这一点。
2 月 16 日:我认为许多人在开始使用 Subversion 时遇到的另一个问题是,如果您不想进行“初始检查”——假设您想在生产站点上进行更改。
I have been struggling with Subversion for some time, thinking it was beginners problems that would go over. Though today I have been thinking through it, and realize that the problem is the way it is embedded with the client files, and that you work on the server db through these embedded files.
So I wonder if:
- Is it perhaps just as easy to work directly towards the repository, but that the commands are "more hidden" (not mentioned in popular books)?
- Are the any GUI clients that can work without these embedded files.(16Feb: Using Subversion in a way that would difficult or hard to figure out otherwise)
- Are there perhaps any relatives of Subversion that is "better" in this respect?
Before I used the VSS client GUI application, and it was much easier
(though I do want to move on to something more modern).
To take an example I have a Drupal installation where most of the files are third party files that I need to keep track of. To get started I needed to check everything in and then out.
Most changes are new versions from the Drupal project. (I know there are scripts to handle third party code, but I still think it must be cumbersome, especially when this code is spread in several directories).
Another thing I often has done in the past is to have the same source files in several VSS databases. (16feb:Which would be difficult in Subversion because the embedded .svn directories refers to one directory)
**13 Feb **
Seems some people don't quite understand, so:
The main problem is if you do a lot of changes without using the svn commands, especially when you replace directories as when you replace 3d party code, since then you loose the .svn directories.
If you plan ahead you can use svn_load_dirs.pl as described in
http://svnbook.red-bean.com/en/1.5/svn.advanced.vendorbr.html
Though what I want is to be able o do arbitrary things with my files, and then diff and commit towards the repository. I can't see how to do this with tortoise or svn commands.
16Feb: Another problem that I think many people are running into when they start with Subversion is if you don't want to do the "initial checkout" - say you want to do changes on a production site.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
我已经使用 CVS 一段时间了,厌倦了它并且想要更好的东西。我开始使用 SVN,但后来发现了 Bazaar。它是初学者和高级用户的最佳工具,具有出色的 GUI 和命令行。它支持许多不同的工作流程,您可以在有或没有服务器的情况下单独使用它或在命令中使用它。 快,跨平台,与launchpad 代码托管集成a>,支持 subversion 存储库 和大量其他 功能 和 插件。 Ubuntu、MySQL、Emacs 和许多其他都使用它。 Bazaar 是 Canonical 推出的免费开源软件,也是 GNU 项目的一部分。有关更多详细信息,请参阅“为什么切换到 Bazaar?”和Bazaar 主页。
I've used CVS for a while, tired of it and wanted something better. I've started to use SVN but then discovered Bazaar. It's the best tool for both beginners and advanced users with both great GUI and command line. It supports many different workflows and you can use it with or without a server, alone or in a command. It's fast, cross platform, integrates with launchpad code hosting, supports subversion repositories and tons of other features and plugins. It's used by Ubuntu, MySQL, Emacs and many others. Bazaar is a free and open source software by Canonical, and a part of the GNU Project. For more details see "Why Switch to Bazaar?" and Bazaar home page.
我建议使用 Git、Bazaar 或其他 VCS,它们在移动源代码时不需要您告诉它。我最了解 Git,所以我会说,当您移动文件时,您不需要告诉它,也不需要在您自己的每个目录中维护 VCS 特定的目录。您可以做很多复杂的事情,但您不必让自己暴露在复杂的情况下:)。
I would recommend using Git, Bazaar, or another VCS which doesn't require you to tell it when you move sources around. I know Git best, so I'll say regarding it that you don't need to tell it when you've moved files and you don't need to maintain VCS-specific directories in each of your own directory. There are lots of complicated things you can do, but you don't have to expose yourself to the complicated bits :).
SVN 由两部分组成:
svn 操作的一部分是服务器端操作,其他操作是在工作副本上操作。
通常,服务器端命令操作存储库的 URL 和本地(工作副本)命令
以本地路径作为参数。
您不一定需要工作副本来执行服务器端操作,如下所示:
- 浏览存储库
- 查看日志历史记录
- 预览单个文件或文件夹
- 差异分支
- 预览属性
- 等等,
您可以使用 svn 命令行客户端或任何 SVN GUI 客户端 -
Tortoise Svn http://tortoisesvn.tigris.org/ 是 Windows 上最流行的一个 - 执行
服务器端和客户端操作。
假设您的存储库 URL 为 http://yoursvnserver/repo,命令将如下所示:
SVN consists of two parts:
Part of svn operations are server side operations, others are operating on working copy.
Normally, server side commands operate repository's URL and local (working copy) commands
take a local path as an argument.
You don't mandatory need a working copy, to perform server side operations, as:
- browse repository
- view log history
- preview individual files or folders
- diff branches
- preview properties
- etc.
you can use either svn command line client or any SVN GUI client -
Tortoise Svn http://tortoisesvn.tigris.org/ is the most popular one for Windows - to perform
both server side and client side operations.
given your repository URL is http://yoursvnserver/repo, the commands would look like:
如果您尝试从 Visual Studio 执行这些“任意操作”,您可以使用 AnkhSVN (VS 集成,如 VSS)或 < a href="http://www.visualsvn.com/" rel="nofollow noreferrer">VisualSVN (使用 TortoiseSVN 进行大多数存储库操作,并在此基础上在 VS 中添加自己的功能)。
请参阅 AnkhSVN 与 VisualSVN 和 AnkhSVN 与 VisualSVN。 (对我来说似乎是重复的答案)
稍后添加 哪个您愿意使用:VisualSVN 还是 AnkhSVN?。
If you try to do these 'arbitrary things' from Visual Studio you could use AnkhSVN (VS integration like VSS) or VisualSVN (Uses TortoiseSVN for most repository operation and adds its own features in VS on top of that).
See AnkhSVN vs VisualSVN and AnkhSVN versus VisualSVN. (Looks like a duplicate answer to me)
Added later Which would you rather use: VisualSVN or AnkhSVN?.
我不完全确定我理解你的问题,但如果你需要 Subversion 的客户端 gui 工具,请查看 Tortoise Svn http://tortoisesvn.tigris.org/
I am not completely sure that I understand your question, but if it is client gui tools for Subversion you need, have a look at Tortoise Svn http://tortoisesvn.tigris.org/
就工作副本与“服务器”的关系而言,SVN 是一个不同的野兽。以下是我如何从这个角度按照对“服务器”的依赖顺序对一些修订系统进行分组:
SVN is a different beast in the sense how working copy relates to the 'server'. Here is how I would group some revision systems in this perspective in order of reliance on the 'server':
似乎使用
--force
选项和add
可以解决大多数问题。如果
.svn
文件丢失,我认为最好的解决方案是将它们放回(例如从存储库),但我还没有找到有关此技术的讨论或脚本支持。Seems using the
--force
option withadd
can resolve most issues.If
.svn
files are lost I think the best solution is to put them back (from the repository for example), but I haven't found discussion on or script-support for this technique.如果您使用 Subversion 1.7,则顶级工作目录中只有一个
.svn
目录,而不是将它们分散在所有子目录中。这使得 Subversion 与 git 和其他工具更加相似,并且可以让您更轻松地在子目录中移动内容。If you use Subversion 1.7, there is only one
.svn
directory in the top working directory, rather than having them spread out in all the subdirectories. This makes Subversion more similar to git and others, and may make it easier for you to move things around in the subdirectories.如果您热衷于使用 Subversion,那么 Bazaar (
bzr
) 实际上是一个很棒的 Subversion 客户端。对于您的特定问题,它有一个可能有用的命令:bzr mv --auto,即使您手动移动内容,它也会尝试跟踪更改。如果您可以选择使用您喜欢的任何工具,
git
可以很好地处理重命名,如果您只需执行git add -A
即可自动识别重命名,这会添加任何新文件并删除自上次签入以来所有已删除的文件。If you are tied to using Subversion, then Bazaar (
bzr
) is actually great as a Subversion client. For your particular problem, it has a command that may be useful:bzr mv --auto
, which tries to track changes even as you move things around manually.If you have the choice to use whatever tool you like,
git
handles renames well, identifying renames automatically if you just dogit add -A
, which adds any new files and removes any removed files since last check-in.