进行'diff/st'并忽略第一行(如果它与特定条件匹配) [英] Doing a 'diff/st' and ignoring the first line if it matches a specific criterion

查看:75
本文介绍了进行'diff/st'并忽略第一行(如果它与特定条件匹配)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一个著名的开源项目的存储库中,所有文件都包含一个带有时间戳的版本字符串作为其第一行:

In a repository for a well known open source project, all files contain a version string with a timestamp as their first line:

<?php  // $Id: index.php,v 1.201.2.10 2009-04-25 21:18:24 stronk7 Exp $

即使我真的不太明白为什么要这么做(因为文件已经在版本控制下了),我也必须忍受这个.

Even if I don't really understand why they do this - since the files are already under version control -, I have to live with this.

主要问题是,如果我尝试对某个发行版进行"st"或"diff"了解上一个版本的更改,则存储库中包含的每个文件显然都标记为已修改,并且diff变为无法阅读和管理.

The main problem is that if I try to 'st' or 'diff' a release to get an idea of what was changed from the previous one, every single file contained in the repository is obviously marked as modified and the diffs become unreadable and unmanageable.

我想知道是否有一种方法可以在匹配正则表达式时忽略前几行的diff/st.

I'm wondering if there's a way to ignoring the first lines doing a diff/st when they match a regexp.

该项目位于cvs下-cvs,是的,您已经正确阅读-并包含在更大的Mercurial存储库中.

The project is under cvs - cvs, yes, you've read correctly - and included in a bigger mercurial repository.

推荐答案

我不了解cvs,但是通过hg,您可以将任何外部diff工具与捆绑的

I don't know about cvs, but with hg you can use any external diff tool with the bundled extdiff extension, and any modern tool should have the ability to let you ignore diffs that match certain patterns.

我发誓超越比较,它允许任意语法定义.

I swear by Beyond Compare, which allows arbitrary syntax definition.

kdiff3具有预处理器命令,您可以通过管道传递输入.

kdiff3 has preprocessor commands that you can pipe the input through.

这篇关于进行'diff/st'并忽略第一行(如果它与特定条件匹配)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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