2

私はhttp中央のMercurialリポジトリを設定し、プッシュするたびにメールを送信しようとしています。Mercurialページおよびhttp://morecode.wordpress.com/2007/08/03/setting-up-mercurial-to-e-mail-on-a-commit/の指示に従います。

プッシュは正常に機能しますが、通知メッセージがまったく表示されません。私を助けてください。

クライアントのリポジトリフォルダにある.hg/hgrcは次のようになります

[extensions]
hgext.notify= 

[hooks]
changegroup.notify = python:hgext.notify.hook

[email]
from = what@gmail.com

[smtp]
host = smtp.gmail.com
username = what@gmail.com
password = ohyea
port = 587
tls = true

[web]
baseurl = http://1.1.1.1/repo_name

[notify]
sources = serve push pull bundle

# set this to False when you're ready for mail to start sending
test = False

config = /home/myhome/something/subscription.conf

template = \ndetails:   {baseurl}{webroot}/rev/{node|short}\nchangeset:{rev}:node|short}\nuser:      {author}\ndate:      {date|date}\ndescription:\n{desc}\n

maxdiff = 300

私の/home/myhome/something/subscription.confは次のようになります

[reposubs]
# key is glob pattern, value is comma-separated list of subscriber emails
* = sometestemail@gmail.com

保存すると、結果は次のようになります。通知メッセージがまったく表示されないことに気付いた場合

pushing to http://1.1.1.1/repo_name
searching for changes
remote: adding changesets
remote: adding manifests
remote: adding file changes
remote: added 2 changesets with 7376 changes to 7376 files

[アップデート:]

システムにhgextフォルダがないことがわかりました。そのため、hgバージョンに一致するソースを手動でダウンロードし、以下のようにhgrcを更新しましたが、それでも機能しません。助けてください。

[extensions]
notify= /path/to/notify.py

[更新2:]

ありがとうRy4an-私はそれを試しましたが、それでも運がありません。

私のウェブサーバーで

/ var/wwwと/var/ www / hgの下に.hgrcファイルを作成しましたが、どちらが自分のWebルートかわからないため、両方の場所でコンテンツを作成しました

[trusted]
users=user_name

このユーザー名は、リポジトリにプッシュしようとしているクライアントのユーザー名です。

私のクライアントで

リポジトリの.hg/hgrcに、信頼できるセクションを追加しました

[trusted]
users=user_name

上記の手順は役に立ちませんでした

2番目のアプローチ

私のクライアントでは、

私のレポの.hgの下で、私はしました

chown www-data:www-data hgrc

プッシュしようとすると、プッシュ中にメッセージが表示されました。

sending capabilities command
capabilities: changegroupsubset stream lookup pushkey unbundle=HG10GZ,HG10BZ,HG10UN branchmap
sending heads command
searching for changes
common changesets up to 6ef19c49143a
sending branchmap command
ignoring untrusted configuration option hooks.changegroup.notify = python:hgext.notify.hook

この無視コマンドは最初のアプローチでは表示されません。hgrcの所有権を変更した後でのみ、これがポップアップ表示されます。

4

2 に答える 2

0

信頼の問題である可能性がありますが、最初に他のいくつかのことを考えてみましょう。

A)拡張負荷を次のように切り替えます。

[extensions]
notify=

hgext部分は不要になりましたが、問題はありません。将来の更新の場合、拡張機能へのフルパスを与えることはより脆弱です。notify=Mercurialに付属し、notifyが常に行う拡張機能には、生の構文で十分です。

B)に切り替えると、test = falseこれtest = trueをデバッグするのに役立ちます。これにより、電子メールがStdoutに送信されます。これは便利です。

さて、これら2つは完了しました。信頼を見てみましょう。Mercurialの信頼システムは、誰もがコードを実行できるようにするだけではないという考えに基づいて構築されています。.hg/hgrcリポジトリのファイルに次のようなセクションが含まれている場合を想像してみてください。

[hooks]
pre-push = rm -rf ~

プッシュすると、ホームディレクトリが削除されます。それは私をやっつけます。これを回避するために、Mercurialは信頼するhgrcファイルのみをロード/実行し、hgrcのセクションで何を信頼するかを指示[trusted]ます。sshをプッシュオーバーすると、リモートマシンに効果的にログインし、実行する他のhgrcファイルを示すのは自分自身です。~/.hgrc

ただし、HTTPは特別です。認証している場合でも、リモートシステムでMercurialを自分自身として実行していない可能性があります。Webサーバーの構成方法に応じて、おそらくwww-datawwwapache、またはnooneのような一部の非ユーザーユーザーであるため、そのリポジトリを.hg/hgrc' owned (or group-owned) by an user (or group) that the webserver user trusts. To achieve that you can eitherchwown the.hg / hgrc file over to the web server user, or find the web server's home directory (often/ var / ) and create awww.hgrc file in there with a[にする必要があります。信頼できる] block saying that the web server user trusts whomever it is that owns the repo's.hg/hgrc`ファイル。

何が起こっているのかが正しければ、ウェブサーバーのエラーログに「誰かが所有する/path/to/repo/.hg/hgrcを信頼していません」などのメッセージがたくさん表示されます。

TL; DR:.hg/hgrc Webサーバーユーザーがフックを指定しているの所有者を(hgrcの意味で)信頼していることを確認してください。

于 2011-09-11T02:26:26.520 に答える
0

これは、ExchangeServerと通信するときに機能しました。

[hostfingerprints]
<my exchange FQDN> = 2a:f3:89:69:13:b2:1e:3a:c2:fe:f9:7f:de:b3:39:e7:82:8e:99:93

[extensions]
notify =

[hooks]
changegroup.notify = python:hgext.notify.hook

[email]
from = Mercurial Notification <noreply@mydomain>

[smtp]
host = <exchange FQDN>
tls = true

[notify]
sources = serve push pull bundle
test = False
maxdiff = 300

[reposubs]
* = Cameron Rich <cameron.rich@mydomain.com>

上記をリポジトリのhgrcファイルに入れます。

例:C:\ repository \ test.hg \ hgrc

于 2013-10-28T22:25:23.673 に答える