就地编辑、版本控制 - 您的解决方案是什么?

发布于 2024-07-10 07:18:46 字数 451 浏览 5 评论 0原文

我正在使用 SVN 进行开发任务,但仍然有许多使用 RCS 管理的文件,因为在我的私有 SVN 存储库工作副本中编辑它们似乎不合理(因为它们通常只是配置文件,最好就地测试)。 在有文件置于 SVN 控制之下的地方拥有存储库的工作副本似乎也不合理,因此我只使用 RCS 来代替。

对于理想情况下不应移动/就地编辑和测试的文件,您的管理方法是什么?

更准确地说:我希望拥有相当于

  • 写保护的 file.txt
  • 的命令,例如“co -l file.txt”(RCS),使其可编辑,
  • 能够就地编辑并测试它立即
  • 使用“ci -u file.txt”(RCS)之类的命令来记录更改,添加注释并再次使其只读
  • 其他用户也应该能够在同一位置执行此操作
  • ,但是版本信息应该消失到一个安全的地方(大概是 svn 代表),在不同的服务器上

I am using SVN for development tasks, but still have many files managed with RCS, because it does not seem reasonable to edit them in my private SVN repository working copy (since they're often just configuration files that are also best tested in-place). It also doesn't seem reasonable to have a working copy of the repository wherever there are files to put under SVN control, so I just use RCS instead.

What is your approach for managing files that should ideally not be moved around / are edited and tested in-place?

To be more precise: I'd like to have the equivalent of

  • having a write-protected file.txt
  • a command like "co -l file.txt" (RCS) to make it editable
  • the ability to edit it in place and test it immediately
  • a command like "ci -u file.txt" (RCS) to record the change, add a comment and make it read-only again
  • other users should also be able to do this in the same place
  • but, the version info should go to a safe place (the svn rep presumably), on a different server

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

江南烟雨〆相思醉 2024-07-17 07:18:46

我使用写时复制文件系统 (CoW),例如 Ext3cow (免责声明,我是其贡献者之一)来管理很多东西。 例如:

  • 使用快照回滚整个存储库,无论哪种存储库。 例如,如果我完全搞砸了 git 树,我可以 cp -dpfR ./@123456789 ./ ,它将我的工作存储库替换为文件,就像它们在纪元 123456789 一样。
  • 使用版本控制/快照作为其自己的不可变 VCS,理想对于 /etc 和其他东西。 由于过去的文件无法删除或修改,因此每个快照都是单个文件或整个树在时间上的不可变修订。

通常,我使用 Git 或 Mercurial 而不是 Subversion,因为我更喜欢分布式 VCS,但我现在坚持将我的存储库保留在本地版本控制 FS 上。

对于 Windows 用户,我相信有一些完全用 python 完成的相同的可移植实现......但不太确定。

I use copy on write file systems (CoW) such as Ext3cow (disclaimer, I'm one of its contributors) to manage a lot of stuff. For instance:

  • Using snapshots to roll back entire repositories, no matter what kind. For instance, if I completely screw up a git tree, I can cp -dpfR ./@123456789 ./ , which replaces my working repo with files just as they were at epoch 123456789.
  • Using versioning/snapshots as its own immutable VCS, ideal for /etc and other things. As files in the past can not be deleted or modified, each snapshot is an immutable revision of a single file or the whole tree in time.

Typically, I use Git or Mercurial over Subversion because I prefer a distributed VCS, but I now insist on keeping my repositories on a versioning FS locally.

For Windows users, I believe that there are some portable implementations of the same done completely in python ... but not really sure.

素手挽清风 2024-07-17 07:18:46

正如之前所说,您尝试使用 SVN 来完成应该使用 DVCS(如 git 或 Mercurial)的操作。

每个人都可以拥有自己的存储库,然后将其与mais中央存储库(如SVN存储库)同步。

这实际上是我在自己的项目中使用的。

我唯一不明白的是为什么你需要锁。 文件不必是只读的。 您可能会这样想,因为 SVN 进行合并的方式(您几乎总是必须手动完成)。 Git 确实很神奇[1],并且大多数合并都无需人工干预。

[1] 好吧,这不是魔法。 SVN 关心文件,而 Git 关心代码块。 这样,只要您不更改完全相同的代码块,它就可以合并同时更改两次的文件。

As said before you are trying to use SVN for something that should be using a DVCS like git or Mercurial.

Everyone can have their own repository, and then sync it with the mais central repo (like the SVN repo).

This is actually what I use in my own projects.

The only thing I didn't get is why you need locks. A file doesn't have to be read-only. You are probably thinking that way because of the way SVN does merges (you almost always have to do it by hand). Git really does magic[1] and the majority of merges goes without human intervention.

[1] Ok, it's not magic. While SVN cares about files, Git cares about chunks of code. This way it can merge a file changed twice at the same time, as long as you don't change exactly the same chunk of code.

眼波传意 2024-07-17 07:18:46

现代分布式版本控制系统(如 Git、Mercurial 或 Bazaar)是这种情况下的最佳工具。 不是因为分布式方面(这显然在这里并不重要),而是因为就地创建存储库非常容易。

在 Mercurial 中你只需要做:

cd ~/directory
hg init

使用 Git 也是如此:

cd ~/directory
git init
git add .

每个工作副本都是一个完整的存储库,如果你愿意,你可以将其推送到远程服务器作为备份。 此外,所有存储库数据都存储在一个隐藏目录中,因此您可以避免到处都有大量 .svn 目录的问题。

我使用 Mercurial 来管理服务器上的 /etc,我发现它非常方便。 需要注意的一件事是,它不会将您的文件标记为只读(如 RCS),但我认为这是一个优势。

Modern distributed version control systems like Git, Mercurial or Bazaar are the best tool in a situation like this. Not because of the distributed aspect (which is clearly not crucial here), but because it is extremely easy to create a repository in-place.

In Mercurial you just have to do:

cd ~/directory
hg init

With Git is is similar:

cd ~/directory
git init
git add .

Every working copy is a complete repository, and you can push it to remote server as a backup if you like. Moreover all the repository data is stored in a single hidden directory, so you avoid the issue of having tons of .svn directories all around the place.

I use Mercurial to manage /etc on my servers and I find it extremely convenient. One thing to note, it will not mark your file read-only (like RCS), but I consider this an advantage.

欲拥i 2024-07-17 07:18:46

您需要意识到 SVN 存储库是免费的。 您可以创建任意多个。

您还需要意识到您不必签出整个存储库。 你说:

这似乎也不合理
拥有存储库的工作副本
凡是有文件可放置的地方
SVN控制

我不确定你真正想要做什么,但我的印象是你以一种特殊的方式使用 SVN。

You need to realize that SVN repositories are free. You can create as many as you want.

You also need to realize that you don't have to check out a whole repository. You said:

It also doesn't seem reasonable to
have a working copy of the repository
wherever there are files to put under
SVN control

I'm not sure what you're really trying to do, but I'm under the impression that you use SVN in a peculiar way.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文