vimdiff 和 CVS 集成

发布于 2024-07-04 12:41:34 字数 404 浏览 6 评论 0原文

我一直希望能够以一种相当优雅的方式让 vimdiff 处理 CVS 控制的文件。 我在互联网上发现了许多(有些黑客)脚本(最好的例子这里) 基本上将您正在编辑的文件从 CVS 检出到临时文件,然后 vimdiff 这两个文件。 这些都没有考虑到分支,并且总是假设你是从 MAIN 工作,这对我来说完全没用。

所以,我的问题是:有没有人找到一个比这个脚本更有效的解决方案?

或者如果做不到这一点,是否有人对如何实现这一点有任何想法,或者对您认为对于执行此操作至关重要的功能有什么建议? 我的意图是,如果没有人可以建议一个已经构建的解决方案来使用或构建,我们就从这里开始构建一个。

I've always wanted to be able to get a reasonably elegant way of getting vimdiff to work with a CVS controlled file. I've found numerous (somewhat hacky) scripts around the internet (best example here) that basically check out the file you are editing from CVS to a temp file, and vimdiff the two. None of these take into account branches, and always assume you're working from MAIN, which for me is completely useless.

So, my question is this: has anyone out there found a decent solution for this that does more than this script?

Or failing that, does anyone have any ideas of how they would implement this, or suggestions for what features you would consider vital for something that does this? My intention is that, if no one can suggest an already built solution to either use or build from, we start building one from here.

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

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

发布评论

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

评论(4

阳光下的泡沫是彩色的 2024-07-11 12:41:35

我一直在这里编写类似的脚本: http://github.com/ghewgill/vim-scmdiff (事实上,他们可能有相同的祖先)。 我没有将 scmdiff 与 cvs 一起使用,但它应该对您签出的分支进行比较。 您还可以指定要与特定修订版进行比较(使用 :D revision)。 希望这对您有所帮助,如果您有改进,请随时做出贡献!

I've been working on a similar script here: http://github.com/ghewgill/vim-scmdiff (in fact, they may have the same ancestry). I haven't used scmdiff with cvs, but it should do a diff against the branch you have checked out. You can also specify that you want to diff against a particular revision (with :D revision). Hopefully this helps, and feel free to contribute if you've got improvements!

未蓝澄海的烟 2024-07-11 12:41:35

@格雷格休吉尔:
谢谢你的剧本! 不过,我遇到了一些问题,所以这就是我要更改的内容:

第 21 行:

< map <silent> <C-d> :call <SID>scmToggle()<CR>
--
> map <silent> <C-h> :call <SID>scmToggle()<CR>

我使用 Ctrl-d 进行向下翻页(太懒了,无法移动所有内容)这样就转到了 PdDn),因此必须切换到 Ctrl-h。

第 112 行:

<         let cmd = 'cd ' . g:scmBufPath . ' && ' . g:scmDiffCommand . ' diff ' . g:scmDiffRev . ' ' . expand('%:p') . ' > ' . tmpdiff
--
> if g:scmDiffUseAbsPaths 
>     let cmd = 'cd ' . g:scmBufPath . ' && ' . g:scmDiffCommand . ' diff ' . g:scmDiffRev . ' ' . expand('%:p') . ' > ' . tmpdiff
> else
>     let cmd = g:scmDiffCommand . ' diff ' . g:scmDiffRev . ' ' . bufname('%') . ' > ' . tmpdiff
> endif

我遇到了无法在 CVS 中使用绝对路径的问题。 我不知道这是否是我们本地设置的奇怪之处,或者是否是全球 CVS 的问题。 因此,我创建了一个可配置变量,您可以将其放入 .vimrc 中以使用相对路径。

现在它似乎完全按照我想要的方式工作,所以我会继续努力,看看是否能找到其他有问题的地方,并随时发布修复程序。

编辑:忘记添加:如果您认为值得,请随时将这些更改添加到 github 上的脚本中。

@Greg Hewgill:
thanks for the script! I had a couple of issues with it though, so here's what I'd change:

line 21:

< map <silent> <C-d> :call <SID>scmToggle()<CR>
--
> map <silent> <C-h> :call <SID>scmToggle()<CR>

I use Ctrl-d for page-down (too lazy to move all that way over to PdDn), so had to switch to Ctrl-h.

line 112:

<         let cmd = 'cd ' . g:scmBufPath . ' && ' . g:scmDiffCommand . ' diff ' . g:scmDiffRev . ' ' . expand('%:p') . ' > ' . tmpdiff
--
> if g:scmDiffUseAbsPaths 
>     let cmd = 'cd ' . g:scmBufPath . ' && ' . g:scmDiffCommand . ' diff ' . g:scmDiffRev . ' ' . expand('%:p') . ' > ' . tmpdiff
> else
>     let cmd = g:scmDiffCommand . ' diff ' . g:scmDiffRev . ' ' . bufname('%') . ' > ' . tmpdiff
> endif

I had issues with not being able to use absolute paths with CVS. I don't know if this is a weirdness of our local set up here, or if it's a global CVS thing. So, I've made a configurable variable that you can put in your .vimrc to use relative path instead.

It now seems to work exactly how I wanted, so I'll keep bashing away and see if I can find anything else that breaks, posting fixes as I go.

Edit: Forgot to add: please feel free to add these changes to your script on github if you feel they're worthwhile.

东京女 2024-07-11 12:41:35

您可以更改对 cvs 的调用以考虑分支。 那应该不难。 更改整个函数并使您的工作分支成为变量(参数、会话、全局或其他)会有点困难。

You could change the call to cvs to take branches into account. That shouldn't be to hard. It bit harder would to change the whole function and make the branch your working a variable (argument, session, global or otherwise).

无声无音无过去 2024-07-11 12:41:35

VCSCommand 是另一个积极维护的用于 VCS 集成的 vim 脚本。 它支持 CVS/SVN/SVK/git。

我一直使用它进行 SVN,从未有过任何抱怨。 快捷方式使用 mapleader,所以不太可能它们将覆盖现有的映射。

VCSCommand is another actively maintained vim script for VCS integration. It has support for CVS/SVN/SVK/git.

I use it all the time for SVN and never had any complaints. The shortcuts use mapleader, so it is unlikely that they will overwrite existing mappings.

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