Mercurial用のinfo.pyを更新した

Mercurialには便利なモジュールが幾つか有るが、その中のお気に入りの一つは下記の情報表示用のものだ。これを使えば、複数のコマンド経由で取得して得られる情報を、一括して表示してくれるので有り難い。内部的には複数のコマンドを呼出しているだけのことだけど、こんな気の利いたツールは、かゆいところに手が届くので手放せない。きっと、作者の方も(ワタシと同じように)面倒臭いことが嫌いなのだろう。

リポジトリの情報を確認する
Subversionで提供されているsvn infoは便利です。 Gitではgit config --listで確認します。 そこでMercurialでもhg infoを実現するInfo Extensionが作られています。 これはデフォルトでバンドルされていないので、モジュール(info.py)をダウンロードして設定します。

[extensions]
info = /path/to/info.py
Git使いがMercurial使いに転職するとき設定しておくべきMercurial拡張 - TIM Labs

しかしながら、そんな便利なツールも、最近はエラーを吐き出すようになっていた。

$ hg info
** Unknown exception encountered with possibly-broken third-party extension info
** which supports versions unknown of Mercurial.
** Please disable info and try your action again.
** If that fixes the bug please report it to the extension author.

おそらくMercurialの新しいバージョンに対応できていないだろうと思いつつ、更新版を探したところ、現在の配布元である下記のサイトに情報が載っていた。

Martin H〓cker: Mercurial 3.8.1 now warns about the command not registered using the decorator, locally for me this patch works. Feel free to remove it from this page once it is applied. (See https://bitbucket.org/dwt/hg-info/ for someting easier to clone from)

InfoExtension - Mercurial

指示に従って、下記にアクセスすると、確かに更新版が配布されていた。

動作環境

導入方法

  • 既存のinfo.pyと置き換えるだけ。(新規導入の場合は、上記の情報を参照)

動作結果

  • 問題なし。更新前と同じように情報が表示された。
$ hg info
Repository: /Users/rabbit2go/projects/foo [hg root]
Base Hash: e91f351329d1c73501fd71d17fa61e3ebc08e116 [hg id -r0]
Revisions: 41 [hg tip --template "{rev}"]
Files: 50 [hg manifest | wc -l]
Cloned From: ssh://hg@bitbucket.org/rabbit2go/bar [hg paths default]

Readmeすら無い素っ気ないリポジトリだけど、修正版を出してくれている方に感謝したい。


関連