Subclipse:有没有办法让团队>创建补丁使用相对路径?
我最近在工作中参与了一个 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
最新版本的 subclipse 能够执行您所说的操作。 可能我有与您相同的版本,因为 1.2.4(我的版本)默认使用文件系统作为补丁根,而版本 1.5.2 允许您在创建补丁文件之前选择补丁根(在项目、工作区或选择之间)。
好吧,抱歉,我读到您已经知道如何手动修补它,但我将其作为参考:
在升级之前,您可以手动打开补丁文件并编辑它:
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:
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.