Deleted Added
sdiff udiff text old ( 11811:83677ded6358 ) new ( 11887:f08918a690cf )
full compact
1# -*- mode:python -*-
2
3# Copyright (c) 2013, 2015, 2016 ARM Limited
4# All rights reserved.
5#
6# The license below extends only to copyright in the software and shall
7# not be construed as granting a license to any other intellectual
8# property including but not limited to intellectual property relating

--- 254 unchanged lines hidden (view full) ---

263
264
265style_message = """
266You're missing the gem5 style hook, which automatically checks your code
267against the gem5 style rules on %s.
268This script will now install the hook in your %s.
269Press enter to continue, or ctrl-c to abort: """
270
271mercurial_style_message = style_message % ("hg commit and qrefresh commands",
272 ".hg/hgrc file")
273git_style_message = style_message % ("'git commit'",
274 ".git/hooks/ directory")
275
276mercurial_style_upgrade_message = """
277Your Mercurial style hooks are not up-to-date. This script will now
278try to automatically update them. A backup of your hgrc will be saved
279in .hg/hgrc.old.
280Press enter to continue, or ctrl-c to abort: """
281
282mercurial_style_hook = """
283# The following lines were automatically added by gem5/SConstruct

--- 87 unchanged lines hidden (view full) ---

371 try:
372 gitdir = Dir(readCommand(
373 ["git", "rev-parse", "--git-dir"]).strip("\n"))
374 except Exception, e:
375 print "Warning: Failed to find git repo directory: %s" % e
376 return
377
378 git_hooks = gitdir.Dir("hooks")
379 git_pre_commit_hook = git_hooks.File("pre-commit")
380 git_style_script = File("util/git-pre-commit.py")
381
382 if git_pre_commit_hook.exists():
383 return
384
385 print git_style_message,
386 try:
387 raw_input()
388 except:
389 print "Input exception, exiting scons.\n"
390 sys.exit(1)
391
392 if not git_hooks.exists():
393 mkdir(git_hooks.get_abspath())
394
395 # Use a relative symlink if the hooks live in the source directory
396 if git_pre_commit_hook.is_under(main.root):
397 script_path = os.path.relpath(
398 git_style_script.get_abspath(),
399 git_pre_commit_hook.Dir(".").get_abspath())
400 else:
401 script_path = git_style_script.get_abspath()
402
403 try:
404 os.symlink(script_path, git_pre_commit_hook.get_abspath())
405 except:
406 print "Error updating git pre-commit hook"
407 raise
408
409# Try to wire up git to the style hooks
410if not ignore_style and main.root.Entry(".git").exists():
411 install_git_style_hooks()
412
413###################################################
414#
415# Figure out which configurations to set up based on the path(s) of
416# the target(s).

--- 1155 unchanged lines hidden ---