开发者

Ignore specific line in files

开发者 https://www.devze.com 2023-01-19 02:09 出处:网络
My question is very similar to this one. I have the files under Mercurial version control and each file have a string:

My question is very similar to this one.

I have the files under Mercurial version control and each file have a string:

<modified-time>some time</modified-time>

This line have created the an external tool, and the tool change this line periodically. I don't want to know about changes in this line and want to ignore the changes in this开发者_Go百科 line when I doing 'diff', 'commit' and 'status' commands.

  1. So, if a file has only one change and the change is that line I need to skip this file in the output of 'hg status' command.
  2. If the file has another changes in the other lines I need to get this file in the output of 'hg status' command.

If I commit the file I need to commit all the changes.


(UPDATE sorry to misread the question and mislead OP.)

If all your files are generated by the external tool, track the source files instead.

If not, and if you can modify the generator, make it use the date keyword as with the bundled keyword extension.

If not (OP's comment indicated so), you could use pre-* hooks to ignore the time change (when it's the only change). It'd be a pain, though, since you have to have a hook for every command that would see the file difference.

Or as OP's comment suggested, revert the file when it has only time change, either manually or automatically (on a timer or subscribe to file system notification).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号