如何直接从Linux内核GIT存储库中区分文件? [英] How to Diff Files Directly from the Linux Kernel GIT Repository?

查看:125
本文介绍了如何直接从Linux内核GIT存储库中区分文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够直接从Linux Kernel GIT存储库中区分文件/目录,而无需下载完整源代码。



具体而言,我很感兴趣有两种可能的解决方案:


  1. 通过网络浏览器执行diff的功能(firefox)

  2. 一个用于Ubuntu的GUI实用程序,可以执行远程比较。
  3. 教程如何设置选项#2

编辑



作为我正在寻找的示例,我曾使用 CrossVC ,用于CVS回购上述任务。 在kernel.org上 Gitweb 允许查看任意提交之间的差异,请参阅例如以下用于v2.6.32-rc6和v2.6.32-rc7之间差异的链接:

http://git.kernel.org/?p= linux / kernel / git / torvalds / linux-2.6.git; a = commitdiff; hp = refs / tags / v2.6.32-rc6; h = refs / tags / v2.6.32-rc7
(使用 patch 链接以获得可以应用的纯文件补丁),以及任意版本的文件/任意版本的任意文件之间,例如: diff to current 链接 history view。



不幸的是官方的gitweb版本(与Git一起发布) ,也不是由kernel.org使用的fork在任意提交之间生成链接,所以你必须手动(手工创建)URL来给gitweb。在 commitdiff view(action)的情况下,您需要的参数是'h'(散列)和'hp'(hash parent);在 blobdiff 视图的情况下,它们是'hb '(散列基数)和'hpb '(hash parent base),还有'f'(filename)和'fp '(file parent)。

模板





请注意,核心gitweb(但不是kernel.org使用的分支,目前)可以使用path_info版本,例如:

http:// repo。 or.cz/w/git.git/blobdiff/ A .. <强>乙:/ <文件名>


如何找到它


  1. 在Web界面中查找合并提交的提交,例如

    https://git.kernel.org/cgit/linux/kernel/git/t orvads / linux.git / commit /?id = 1c5aefb5b12a90e29866c960a​​57c1f8f75def617

  2. 找到一个提交与第二个父代之间的区别链接,例如< br>
    https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/diff/?id=1c5aefb5b12a90e29866c960a​​57c1f8f75def617&id2=54a217887a7b658e2650c3feff22756ab80c7339


  3. 将比较提交的SHA-1替换为要比较的修订名称或修订标识符,例如在v3.15-rc8和v3.15-rc7之间生成差异

    https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/diff/?id=v3.15-rc8&id2=v3.15-rc7



    或基因( rawdiff

    https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/rawdiff/ ?id = v3.15-rc8& id2 = v3.15-rc7



I'd like to be able to diff files / directories directly from the Linux Kernel GIT repository without having to download full source.

Specifically, I'm interested in two potential solutions:

  1. The ability to do diff's via a web browser ( firefox )
  2. A GUI utility for Ubuntu that can do remote diffs.
  3. A tutorial how to setup option #2

Edit

As an example of what I'm looking for, I used to use CrossVC for the above tasks on a CVS repo.

解决方案

Gitweb at kernel.org allows to view diff between arbitrary commits, see for example the following link for diff between v2.6.32-rc6 and v2.6.32-rc7:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;hp=refs/tags/v2.6.32-rc6;h=refs/tags/v2.6.32-rc7 (use patch link to get plain patch that you can apply), and between arbitrary versions of file / between arbitrary versions of arbitrary files, e.g.: diff to current link in history view.

Unfortunately neither official gitweb version (distributed together with Git itself), nor the fork used by kernel.org generates links between arbitrary commits, so you would have to handcraft (create by hand) URLs to give to gitweb. In the case of commitdiff view (action) the iparameters you need are 'h' (hash) and 'hp' (hash parent); in the case of blobdiff view they are 'hb' (hash base) and 'hpb' (hash parent base), and also 'f' (filename) and 'fp' (file parent).

Templates

Note that core gitweb (but not the fork used by kernel.org, currently) you can use path_info version, e.g.:
http://repo.or.cz/w/git.git/blobdiff/A..B:/<filename>


How to find it

  1. Find in a web interface a commit which is a merge commit, for example
    https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=1c5aefb5b12a90e29866c960a57c1f8f75def617

  2. Find a link to diff between a commit and a second parent, for example
    https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/diff/?id=1c5aefb5b12a90e29866c960a57c1f8f75def617&id2=54a217887a7b658e2650c3feff22756ab80c7339

  3. Replace SHA-1 of compared commits with revision names or revision identifiers you want to compare, for example to generate diff between v3.15-rc8 and v3.15-rc7
    https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/diff/?id=v3.15-rc8&id2=v3.15-rc7

    or to generate patch (rawdiff)
    https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/rawdiff/?id=v3.15-rc8&id2=v3.15-rc7

这篇关于如何直接从Linux内核GIT存储库中区分文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆