Make extension require IRC nickname definition; document config options
authorGregory Szorc <>
Thu, 07 Nov 2013 15:48:00 -0800
changeset 53 fa45c8eeb4ecad836cd9e39f8fe4e65805944ca3
parent 52 218c65fe5456f87fecb591cd02822d11d8f16939
child 54 825f8368425de6b04fd30f7875168f0fe4bdc19e
push id36
push dateThu, 07 Nov 2013 23:48:14 +0000
Make extension require IRC nickname definition; document config options
--- a/
+++ b/
@@ -104,16 +104,55 @@ Once pushlog data is synced, you can use
 information for a specific changeset.
 Bug Info
 Information about bugs is extracted from commit messages as changesets are
 introduced into the repository. You can look up information about specific
 bugs via `hg buginfo`.
+Config Options
+This extension consults the following config options.
+   Indicates that this extension is running in *headless* mode. *headless*
+   mode is intended for server operation, not local development.
+   Your Mozilla IRC nickname. This string value will be used to look for
+   your reviews and patches.
+   When this boolean flag is true, the code critic hook will not run
+   during commit and qrefresh operations.
+   This boolean is used to enable a ``prepushkey`` hook that prevents
+   pushes to keys (bookmarks, tags, etc) whose name is prefixed with that
+   of an official Mozilla repository.
+   This hook is useful for servers exposing a monolithic repository where
+   each separate Mozilla repository is exposed through bookmarks and where
+   the server does not want to allow external users from changing the
+   *canonical* refs.
+   For example, with this flag set, pushes to bookmarks ``central/default``
+   and ``inbound/foobar`` will be rejected because they begin with the names
+   of official Mozilla repositories. However, pushes to the bookmark
+   ``gps/test`` will be allowed.
+   If enabled, this boolean flag will cause remote keys to be added to
+   the local repository's bookmarks during push and pull operations. This
+   is most useful on servers, as remote keys/refs are typically only
+   created dynamically at run-time via a mechanism independent of
+   bookmarks.
 import datetime
 import errno
 import os
 import re
 import shutil
 import sys
@@ -784,15 +823,20 @@ def reposetup(ui, repo):
                              )''', re.I | re.X)
         def _bugs_in_description(self, desc):
             return [int(m[1]) for m in self.BUG_RE.findall(desc)]
     repo.__class__ = remotestrackingrepo
+    headless = ui.configbool('mozext', 'headless')
+    if not ui.config('mozext', 'ircnick') and not headless:
+        raise util.Abort(_('Set "[mozext] ircnick" in your hgrc to your '
+            'Mozilla IRC nickname to enable additional functionality.'))
     if not ui.configbool('mozext', 'noautocritic'):
         ui.setconfig('hooks', 'commit.critic', critic_hook)
         ui.setconfig('hooks', 'qrefresh.critic', critic_hook)
     if ui.configbool('mozext', 'reject_pushes_with_repo_names', default=False):
         ui.setconfig('hooks', 'prepushkey.reject_repo_names',