Provide an option to disable the SQLite database
authorGregory Szorc <>
Wed, 08 Jan 2014 19:09:31 -0800
changeset 91 3605ab6652f4
parent 90 59159168b2c9
child 92 45ce73b8f29e
push id66
push date2014-01-09 03:09 +0000
Provide an option to disable the SQLite database It is a hacky implementation and isn't complete.
--- a/
+++ b/
@@ -254,16 +254,20 @@ mozext.ircnick
    When this boolean flag is true, the code critic hook will not run
    during commit and qrefresh operations.
    When this boolean flag is true, the code critic hook will run on merges.
    By default, the hook does not run on merges.
+   When this boolean flag is true, the local SQLite database indexing
+   useful lookups (such as bugs and pushlog info) is not enabled.
    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
@@ -585,24 +589,32 @@ def syncpushinfo(ui, repo, tree=None, **
     """Synchronize the pushlog information for all known Gecko trees.
     The pushlog info contains who, when, and where individual changesets were
     After running this command, you can query for push information for specific
+    if not repo.changetracker:
+        ui.warn('Local database appears to be disabled.')
+        return 1
     for i, tree in enumerate(sorted(REPOS)):
         ui.progress('pushlogsync', i, total=len(REPOS))
     ui.progress('pushlogsync', None)
 def print_changeset_pushes(ui, repo, rev, all=False):
+    if not repo.changetracker:
+        ui.warn('Local database appears to be disabled.')
+        return 1
     ctx = repo[rev]
     node = ctx.node()
     pushes = repo.changetracker.pushes_for_changeset(node)
     pushes = [p for p in pushes if all or p[0] in RELEASE_TREES]
     if not pushes:
         ui.warn('No pushes recorded for changeset: ', str(ctx), '\n')
         return 1
@@ -651,16 +663,20 @@ def changesetpushes(ui, repo, rev, all=F
 @command('buginfo', [
     ('a', 'all', False, _('Show all trees, not just release trees.'), ''),
     ('', 'reset', False, _('Wipe and repopulate the bug database.'), ''),
     ('', 'sync', False, _('Synchronize the bug database.'), ''),
     ], _('hg buginfo [BUG] ...'))
 def buginfo(ui, repo, *bugs, **opts):
+    if not repo.changetracker:
+        ui.warning('Local database appears to be disabled')
+        return 1
     if opts['sync']:
     if opts['reset']:
@@ -1261,16 +1277,18 @@ def reposetup(ui, repo):
     class remotestrackingrepo(repo.__class__):
         def remoterefs(self):
             return remoterefs(self)
         def changetracker(self):
+            if ui.configbool('mozext', 'disable_local_database'):
+                return None
                 return ChangeTracker(self.join('changetracker.db'))
             except Exception as e:
                 raise util.Abort(e.message)
         # Resolve remote ref symbols. For some reason, we need both lookup
         # and findtags implemented.
         def lookup(self, key):
@@ -1293,23 +1311,24 @@ def reposetup(ui, repo):
             old_rev = len(self)
             res = orig_pull(remote, *args, **kwargs)
             lock = self.wlock()
                 tree = resolve_uri_to_tree(remote.url())
                 if tree:
                     self._update_remote_refs(remote, tree)
-                    self.changetracker.load_pushlog(tree)
+                    if self.changetracker:
+                        self.changetracker.load_pushlog(tree)
                 # Sync bug info.
                 for rev in self.changelog.revs(old_rev + 1):
                     ctx = self[rev]
                     bugs = parse_bugs(ctx.description())
-                    if bugs:
+                    if bugs and self.changetracker:
             return res
@@ -1444,20 +1463,26 @@ def reposetup(ui, repo):
                 ancestors = set(self.changelog.findmissingrevs(
                     common=seen, heads=[version_rev]))
                 d[version] = ancestors
                 seen |= ancestors
             return d
         def reset_bug_database(self):
+            if not self.changetracker:
+                return
         def sync_bug_database(self):
+            if not self.changetracker:
+                return
             for rev in self:
                 ui.progress('changeset', rev, total=len(self))
                 ctx = self[rev]
                 bugs = parse_bugs(ctx.description())
                 if bugs: