Subclipse:有没有办法让团队>创建补丁使用相对路径?

发布于 2024-07-07 22:36:55 字数 681 浏览 7 评论 0原文

我最近在工作中参与了一个 Java 项目:我们使用 MyEclipse 作为 IDE,使用 Subclipse 进行源代码控制集成。 由于我是该项目的新手,因此我目前正在将所做的任何更改作为补丁提交,以便其他团队成员更轻松地查看我的更改并决定是否将它们提交到主干。 但是,当我使用“团队”菜单中的“创建补丁”选项创建补丁时,生成的补丁包含已更改文件的绝对路径。 由于我希望能够通过电子邮件将这些补丁发送给其他团队成员,并让他们简单地将补丁应用到他们自己的工作文件夹中,因此我希望生成仅包含相对文件路径的补丁(我正在 Ubuntu 上运行,目前我的工作副本位于我的主文件夹中,因此绝对路径特别烦人)。

有没有办法配置 Eclipse/Subclipse 来做到这一点? 我搜索了 Eclipse Preferences 并单击了 Create Patch 向导几次,但我找不到任何看起来可以执行此操作的内容。 目前,我正在使用文本编辑器手动编辑补丁文件,将绝对文件路径转换为相对路径。 如果 Subclipse 不能做到这一点,我愿意接受其他建议。

编辑:我知道当您从 Eclipse 中应用补丁时,可以选择忽略文件名路径中的一定数量的段,但我很好奇是否有办法避免这种情况减少应用补丁所涉及的步骤数。 通过手动编辑路径以使它们相对于项目的根文件夹,最终用户只需确保在根项目文件夹级别应用补丁即可。 我希望拥有这种简单性,而无需手动编辑补丁文件。

I recently got involved in a Java project at work: we're using MyEclipse for the IDE, and Subclipse for source control integration. Since I am new to the project, I am currently submitting any changes I make as patches, to make it easier for the other team members to review my changes and decide whether or not to commit them to the trunk. However, when I create a patch using the Create Patch option in the Team menu, the resulting patch contains absolute paths to the files that have changed. Since I want to be able to e-mail these patches to other team members and have them simply apply the patches to their own working folder, I would like to produce patches that contain only relative file paths (I'm running on Ubuntu and currently my working copy is in my home folder, so the absolute paths are especially annoying).

Is there a way to configure Eclipse/Subclipse to do this? I searched the Eclipse Preferences and clicked through the Create Patch wizard a few times, but I couldn't find anything that looks like it will do this. Currently, I'm manually editing the patch files with a text editor to convert the absolute file paths to relative paths. If Subclipse can't do this, I'm open to other suggestions.

EDIT: I know that there is the option to ignore a certain number of segments in file name paths when you go to apply the patch from within Eclipse, but I was curious if there was a way to avoid this to reduce the number of steps involved in applying patches. By manually editing the paths to make them relative to the project's root folder, an end-user just has to be sure to apply the patch at the root project folder level. I'd like to have that simplicity without having to manually edit the patch files.

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

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

发布评论

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

评论(2

一腔孤↑勇 2024-07-14 22:36:55

最新版本的 subclipse 能够执行您所说的操作。 可能我有与您相同的版本,因为 1.2.4(我的版本)默认使用文件系统作为补丁根,而版本 1.5.2 允许您在创建补丁文件之前选择补丁根(在项目、工作区或选择之间)。

好吧,抱歉,我读到您已经知道如何手动修补它,但我将其作为参考:

在升级之前,您可以手动打开补丁文件并编辑它:

  1. 右键单击-> 打开-> 文本编辑器,
  2. 查找所有出现的 /home/user/projectfiles/project/ 并将其替换为空白...
  3. 记住在“Index:”和文件名之间仅保留一个空格,例如“Index: .classpath” ,否则你的补丁将无法在基于Windows的Eclipse中使用

The newest versions of subclipse are able to do what you say. Probably I have your same version because the 1.2.4 (my version) by default uses the filesystem as a patch root, while version 1.5.2 allows you to select the Patch Root (between project, workspace or selection) before creating the patchfile.

Well, sorry, I read after that you already knew how to patch it by hand, but I am leaving this out as reference:

Before you upgrade you can open the patchfile by hand and edit it:

  1. right click -> open with -> Text Editor,
  2. Find and replace all the occurrences of /home/user/projectfiles/project/ with a blank...
  3. remember to leave out only a single space between the "Index:" and the filename, like "Index: .classpath", otherwise your patch will not be usable in Windows-based Eclipse
浅听莫相离 2024-07-14 22:36:55

Subversion API 在 1.5 中得到增强,允许将相对路径位置传递给 API。 如果您安装 Subclipse 1.4.x(使用 Subversion 1.5),则补丁将具有相对路径。 还有许多其他与补丁相关的增强功能,包括多项目补丁以及选择补丁中包含哪些文件的功能。

The Subversion API was enhanced in 1.5 to allow the relative path location to be passed to the API. If you install Subclipse 1.4.x (which uses Subversion 1.5) then the patches will have relative paths. There are a number of other patch related enhancements including multi-project patches and the ability to select which files are included in the patch.

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