Question

I am attempting to use file patterns to limit push notifications to specific directories. The following glob patterns in [usersubs] are not triggering emails, though the basic patterns of asterix and double asterix work. OS: Windows XP.

**.sql
*.sql
one/*.sql
**.???
**/*.sql 

repos contents are:

.hg
root.sql
/one/one.sql

hgrc is:

[extensions]
notify =

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

[email]
from = me@company.com

[smtp]
host = 12.34.56.78

baseurl = 

[notify]
sources = serve push pull bundle
test = False
config = 

[usersubs]
me@company.com = **.sql

maxdiff = 300

Process used:
1) clone the repo with these settings
2) change the two sql files listed so they can be committed
3) hg commit -m "comment here"
4) hg push

Was it helpful?

Solution

The notify extension doesn't support using patterns to match particular files. From "hg help notify":

[usersubs] # key is subscriber email, value is a comma-separated list of repo patterns user@host = pattern

[reposubs] # key is repo pattern, value is a comma-separated list of subscriber emails pattern = user@host

A "pattern" is a "glob" matching the absolute path to a repository, optionally combined with a revset expression. A revset expression, if present, is separated from the glob by a hash.

The patterns listed in the question are being treated as patterns to match the absolute path to a repository.

Possible alternatives:

  • Split the files that you desire notification for into a separate repository (which should then be supported by the notify extension)
  • In Mercurial 2.4, try using a revset reposubs pattern, such as "#file('.sql')=me@company.com".
  • Write a custom hook to perform your desired notification based on detection of per-file changes
  • Instead of using notifications, have the recipients watch for changes on per-file RSS feeds provided by hgweb (suggested by mpm on IRC)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top