パッチをgrepしてMercurialで変更セットを見つける 質問する

パッチをgrepしてMercurialで変更セットを見つける 質問する

ログ メッセージやファイル名ではなく、編集時にパターン (変更されたコード) を指定して変更を見つける方法を Mercurial で実現できますか?

「hg help revsets」を徹底的に調べましたが、これを行う良い方法はないと思います。私が思いついた最善のハックはこれですが、私が見逃した機能があるか、誰かがもう少し良い方法を見つけてくれることを願っています。

hg log -M -u goldberg -p | grep '(^changeset:\|<pattern>)' | grep -C 1 '<pattern>'

(その後、手動でリビジョン番号を選択し、後でそれらのリビジョンで作業します)

ベストアンサー1

ぜひ見てみてくださいhg grep

Search revisions of files for a regular expression.

This command behaves differently than Unix grep. It only accepts
Python/Perl regexps. It searches repository history, not the working
directory. It always prints the revision number in which a match appears.

By default, grep only prints output for the first revision of a
file in which it finds a match. To get it to print every revision that
contains a change in match status ("-" for a match that becomes a non-match, 
or "+" for a non-match that becomes a match), use the --all flag.

Returns 0 if a match is found, 1 otherwise.

さらに詳しい情報を入力すると表示されますhg grep --help

おすすめ記事