]> Cypherpunks repositories - gostls13.git/commitdiff
codereview: die if initialized twice
authorRuss Cox <rsc@golang.org>
Sun, 29 Jan 2012 17:33:13 +0000 (12:33 -0500)
committerRuss Cox <rsc@golang.org>
Sun, 29 Jan 2012 17:33:13 +0000 (12:33 -0500)
If this happens, something is misconfigured.
If we don't test for this explicitly, MatchAt ends
up calling itself recursively forever.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5576066

lib/codereview/codereview.py

index 5730bc2a8e637e5f98a8b25d827fc850d9a4b195..1957d7cbb77f8d97f639c4c1f4299bac359f911c 100644 (file)
@@ -2171,10 +2171,21 @@ def norollback(*pats, **opts):
        """(disabled when using this extension)"""
        raise hg_util.Abort("codereview extension enabled; use undo instead of rollback")
 
+codereview_init = False
+
 def reposetup(ui, repo):
        global codereview_disabled
        global defaultcc
        
+       global codereview_init
+       if codereview_init:
+               raise hg_util.Abort("codereview extension initialized twice")
+       codereview_init = True
+       
+       remote = ui.config("paths", "default", "")
+       if remote.find("://") < 0:
+               raise hg_util.Abort("codereview: default path '%s' is not a URL" % (remote,))
+
        # Read repository-specific options from lib/codereview/codereview.cfg or codereview.cfg.
        root = ''
        try: