Bug 1277134 - Add built-in fsmonitor support for Mercurial version>=3.8. r=gps
authorJeremy Chen <jeremychen@mozilla.com>
Wed, 01 Jun 2016 16:40:55 +0800
changeset 339047 c77f5610b2a890c8f4abfa23418521c9b52bf616
parent 339046 24bd574ecbf0c8630290fc81f76e6a928d3ee8dd
child 339048 394039f1525288b070565eec43e384c37ef76aa7
push id6249
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 13:59:36 +0000
treeherdermozilla-beta@bad9d4f5bf7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs1277134
milestone49.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1277134 - Add built-in fsmonitor support for Mercurial version>=3.8. r=gps The hgwatchman project has been renamed to fsmonitor and has been moved into Mercurial core, as of version 3.8. Accordingly, for Mercurial >= 3.8, we shall skip installing hgwatchman but just set fsmonitor in hgrc file instead. DONTBUILD (NPOTB) MozReview-Commit-ID: 426rla5riCM
tools/mercurial/hgsetup/wizard.py
--- a/tools/mercurial/hgsetup/wizard.py
+++ b/tools/mercurial/hgsetup/wizard.py
@@ -221,29 +221,29 @@ Example Usage:
 is in.)
 
 (Relevant config options: alias.wip, revsetalias.wip, templates.wip)
 
 Would you like to install the `hg wip` alias?
 '''.strip()
 
 HGWATCHMAN_MINIMUM_VERSION = LooseVersion('3.5.2')
+FSMONITOR_MINIMUM_VERSION = LooseVersion('3.8')
 
-HGWATCHMAN_INFO = '''
-The hgwatchman extension integrates the watchman filesystem watching
+FSMONITOR_INFO = '''
+Filesystem monitor integrates the watchman filesystem watching
 tool with Mercurial. Commands like `hg status`, `hg diff`, and
 `hg commit` that need to examine filesystem state can query watchman
 and obtain filesystem state nearly instantaneously. The result is much
 faster command execution.
 
-When installed, the hgwatchman extension will launch a background
-watchman file watching daemon for accessed Mercurial repositories. It
-should "just work."
+When enabled, the filesystem monitor tool will launch a background
+watchman file watching daemon for accessed Mercurial repositories.
 
-Would you like to install hgwatchman
+Would you like to enable filesystem monitor tool
 '''.strip()
 
 FILE_PERMISSIONS_WARNING = '''
 Your hgrc file is currently readable by others.
 
 Sensitive information such as your Bugzilla credentials could be
 stolen if others have access to this file/machine.
 '''.strip()
@@ -352,35 +352,42 @@ class MercurialSetupWizard(object):
 
         self.prompt_native_extension(c, 'histedit',
             'Would you like to enable the histedit extension to allow history '
             'rewriting via the "histedit" command (similar to '
             '`git rebase -i`)')
 
         # hgwatchman is provided by MozillaBuild and we don't yet support
         # Linux/BSD.
+        # Note that the hgwatchman project has been renamed to fsmonitor and has
+        # been moved into Mercurial core, as of version 3.8. So, if your Mercurial
+        # version is modern enough (>=3.8), you could set fsmonitor in hgrc file
+        # directly.
         if ('hgwatchman' not in c.extensions
             and sys.platform.startswith('darwin')
             and hg_version >= HGWATCHMAN_MINIMUM_VERSION
-            and self._prompt_yn(HGWATCHMAN_INFO)):
-            # Unlike other extensions, we need to run an installer
-            # to compile a Python C extension.
-            try:
-                subprocess.check_output(
-                    ['make', 'local'],
-                    cwd=self.updater.hgwatchman_dir,
-                    stderr=subprocess.STDOUT)
+            and self._prompt_yn(FSMONITOR_INFO)):
+            if (hg_version >= FSMONITOR_MINIMUM_VERSION):
+                c.activate_extension('fsmonitor')
+            else:
+                # Unlike other extensions, we need to run an installer
+                # to compile a Python C extension.
+                try:
+                    subprocess.check_output(
+                        ['make', 'local'],
+                        cwd=self.updater.hgwatchman_dir,
+                        stderr=subprocess.STDOUT)
 
-                ext_path = os.path.join(self.updater.hgwatchman_dir,
-                                        'hgwatchman')
-                if self.can_use_extension(c, 'hgwatchman', ext_path):
-                    c.activate_extension('hgwatchman', ext_path)
-            except subprocess.CalledProcessError as e:
-                print('Error compiling hgwatchman; will not install hgwatchman')
-                print(e.output)
+                    ext_path = os.path.join(self.updater.hgwatchman_dir,
+                                            'hgwatchman')
+                    if self.can_use_extension(c, 'hgwatchman', ext_path):
+                        c.activate_extension('hgwatchman', ext_path)
+                except subprocess.CalledProcessError as e:
+                    print('Error compiling hgwatchman; will not install hgwatchman')
+                    print(e.output)
 
         if 'reviewboard' not in c.extensions:
             if hg_version < REVIEWBOARD_MINIMUM_VERSION:
                 print(REVIEWBOARD_INCOMPATIBLE % REVIEWBOARD_MINIMUM_VERSION)
             else:
                 p = os.path.join(self.vcs_tools_dir, 'hgext', 'reviewboard',
                     'client.py')
                 self.prompt_external_extension(c, 'reviewboard',