SVN:如何返回到之前的版本?

发布于 2024-10-18 14:50:36 字数 139 浏览 3 评论 0原文

我正在做的一个项目中犯了一系列错误。我如何恢复到已知的工作修订版并在此基础上进行构建?假设我现在处于修订版 15,但我想回到修订版 10,并继续处理版本 10 及以后的版本。我正在使用 Zend Studio。

我可以删除 SVN 中存在的修订吗?

A series of mistakes were made in a project I am working on. How do I revert back to a known working revision and build on top of that? Say I am at revision 15, but I want to go back to revision 10 -- and work on 10 onwards. I'm using Zend Studio.

Can I delete revisions that exist in SVN?

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

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

发布评论

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

评论(4

灯角 2024-10-25 14:50:36

从命令行:

svn up -r [revision_number]

其中 [revision_number] 是您要恢复到的修订版本。

不,您不能删除 SVN 中已存在的修订。

From the command line:

svn up -r [revision_number]

Where [revision_number] is the revision you want to revert to.

And no, you cannot delete revisions that already exist in SVN.

じ违心 2024-10-25 14:50:36

您可以简单地使用以下命令对修订版进行更新,

svn up -r 10

但正如 Christoph 所建议的那样,这将不允许您提交更改,因为 SVN 需要您将工作副本更新为 HEAD,然后才能提交。你可以做的是

svn merge -r HEAD:10 yourFile
svn ci yourFile -m "Reverting back to rev 10"

You can simply do an update to revision using

svn up -r 10

But as Christoph has suggested this will not let you commit the changes as SVN needs you to update your working copy to HEAD before you can commit. What you can do instead is

svn merge -r HEAD:10 yourFile
svn ci yourFile -m "Reverting back to rev 10"
霞映澄塘 2024-10-25 14:50:36

三个选项:

反向合并:(最快,保留错误修订版,添加新修订版)

svn merge $(REPO)@$(GOODREV) $(WC)

SVN 转储:(完全删除错误修订版)

svnadmin dump $(REPO) -r 1:$(GOODREV) > dumpfile
svnadmin load $(NEWREPO) < dumpfile
# Now delete $(REPO), and use $(NEWREPO)

手动编辑:(删除错误的修订,不安全,最后的手段)

您可能需要此操作的唯一原因是,如果由于某种原因您具有文件级访问权限存储库,但没有 shell 访问权限。请注意,这仅在 SVN 1.6 和 1.7 上进行了测试。

  1. 将您的工作副本更新为 $(GOODREV) (如果保留在 HEAD 中,完成后它将无法使用。)
  2. 采取任何措施来保护存储库免受外部访问。如果它连接到 Web 服务器,请立即断开连接。在此过程中第三方访问存储库可能会损坏它。
  3. 备份您的存储库。 (不会有什么坏处,以防万一出现问题。)
  4. db/current 中的数字更改为 $(GOODREV)。请确保不要更改 LF 行结尾。
  5. 删除 db/revs/*/*db/revprops/*/* 中所有 > 编号的文件(不是文件夹) $(GOODREV)
  6. 删除 db/rep-cache.db
  7. 将工作副本更新为 HEAD,它现在应等于 $ (GOODREV)

请注意,如果您使用 TortoiseSVN,您还必须完成以下步骤:

  1. 删除 %APPDATA%\ 中的所有文件TortoiseSVN\logcache\*
  2. 通过任务管理器杀死所有实例 TSVNCache.exe。 (通常有一个,但由于 UAC 安全性,在 WinVista+ 上可能为 2 个,这会阻止提升的应用程序与未提升的 TSVNCache.exe 交互。第一次打开时来自提升的应用程序的另存为...对话框,将生成提升的TSVNCache.exe。)

这将修复由于TortoiseSVN的缓存与新的回购状态。

Three options:

Reverse merge: (fastest, keeps bad revisions, adds new revision)

svn merge $(REPO)@$(GOODREV) $(WC)

SVN dump: (removes bad revisions entirely)

svnadmin dump $(REPO) -r 1:$(GOODREV) > dumpfile
svnadmin load $(NEWREPO) < dumpfile
# Now delete $(REPO), and use $(NEWREPO)

Hand editing: (removes bad revisions, unsafe, last resort)

The only reason you might need this is if for some reason you have file-level access to the repository, but no shell access. Note that this has only been tested on SVN 1.6 and 1.7.

  1. Update your working copy to $(GOODREV) (If left at HEAD, it will be unusuable after we finish.)
  2. Take any steps to secure the repo from outside access. If it's attached to a web server, disconnect it now. Third-party accesses to the repo during this process can damage it.
  3. Back up your repo. (Never hurts, just in case something goes wrong.)
  4. Change the number in db/current to the $(GOODREV). Be sure not to alter the LF line ending.
  5. Delete all numbered files (not folders) in db/revs/*/* and db/revprops/*/* that are > $(GOODREV)
  6. Delete db/rep-cache.db
  7. Update your working copy to HEAD, which should now be equal to $(GOODREV).

Note that if you are using TortoiseSVN, you must also complete these steps:

  1. Delete all files in %APPDATA%\TortoiseSVN\logcache\*
  2. Kill all instances TSVNCache.exe via the Task Manager. (There's usually one, but could be 2 on WinVista+ due to UAC security, which prevents elevated applications from interacting with a non-elevated TSVNCache.exe. The first time you open a Save As... dialog from an elevated application, an elevated TSVNCache.exe will spawn.)

This will fix the weird log display caused by TortoiseSVN's cache being in conflict with the new repo state.

终弃我 2024-10-25 14:50:36

从 TortoiseSVN 办公站点获取文档。

  1. 使用修订日志对话框
  2. 使用合并对话框

我使用方法 2 并且在我这边工作得很好。

https://tortoisesvn.net/docs/nightly/TortoiseSVN_en/tsvn- howto-rollback.html

Get the docs from TortoiseSVN office site.

  1. Use the revision log dialog
  2. Use the merge dialog

I use method 2 and work fine on my side.

https://tortoisesvn.net/docs/nightly/TortoiseSVN_en/tsvn-howto-rollback.html

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