Bug 1480187 - Move mach try again history file to topsrcdir.
MozReview-Commit-ID: 8uvo4AkFlwy
--- a/.hgignore
+++ b/.hgignore
@@ -181,8 +181,11 @@ subinclude:servo/.hgignore
# https://bz.mercurial-scm.org/show_bug.cgi?id=5322
^comm/
# Ignore various raptor performance framework files
^testing/raptor/.raptor-venv
^testing/raptor/raptor-venv
^testing/raptor/raptor/tests/.*.json
^testing/raptor/webext/raptor/auto_gen_test_config.js
+
+# Ignore the cache history for mach try again.
+^.try_task_configs.json
--- a/tools/tryselect/push.py
+++ b/tools/tryselect/push.py
@@ -3,17 +3,16 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import absolute_import, print_function
import json
import os
import sys
-from mozboot.util import get_state_dir
from mozbuild.base import MozbuildObject
from mozversioncontrol import get_repository_object, MissingVCSExtension
GIT_CINNABAR_NOT_FOUND = """
Could not detect `git-cinnabar`.
The `mach try` command requires git-cinnabar to be installed when
pushing from git. For more information and installation instruction,
@@ -39,31 +38,29 @@ UNCOMMITTED_CHANGES = """
ERROR please commit changes before continuing
""".strip()
MAX_HISTORY = 10
here = os.path.abspath(os.path.dirname(__file__))
build = MozbuildObject.from_environment(cwd=here)
vcs = get_repository_object(build.topsrcdir)
-history_path = os.path.join(get_state_dir()[0], 'history', 'try_task_configs.json')
+history_path = os.path.join(vcs.path, '.try_task_configs.json')
def write_task_config(try_task_config):
config_path = os.path.join(vcs.path, 'try_task_config.json')
with open(config_path, 'w') as fh:
json.dump(try_task_config, fh, indent=2, separators=(',', ':'))
fh.write('\n')
return config_path
def write_task_config_history(msg, try_task_config):
if not os.path.isfile(history_path):
- if not os.path.isdir(os.path.dirname(history_path)):
- os.makedirs(os.path.dirname(history_path))
history = []
else:
with open(history_path, 'r') as fh:
history = fh.read().strip().splitlines()
history.insert(0, json.dumps([msg, try_task_config]))
history = history[:MAX_HISTORY]
with open(history_path, 'w') as fh: