Deleted Added
sdiff udiff text old ( 8297:d57afdcf38f5 ) new ( 8336:3a2aebf01bf3 )
full compact
1# -*- mode:python -*-
2
3# Copyright (c) 2011 Advanced Micro Devices, Inc.
4# Copyright (c) 2009 The Hewlett-Packard Development Company
5# Copyright (c) 2004-2005 The Regents of The University of Michigan
6# All rights reserved.
7#
8# Redistribution and use in source and binary forms, with or without

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

194# If the M5 directory is a mercurial repository, we should do some
195# extra things.
196#
197########################################################################
198
199hgdir = main.root.Dir(".hg")
200
201mercurial_style_message = """
202You're missing the M5 style hook.
203Please install the hook so we can ensure that all code fits a common style.
204
205All you'd need to do is add the following lines to your repository .hg/hgrc
206or your personal .hgrc
207----------------
208
209[extensions]
210style = %s/util/style.py
211
212[hooks]
213pretxncommit.style = python:style.check_style
214pre-qrefresh.style = python:style.check_style
215""" % (main.root)
216
217mercurial_bin_not_found = """
218Mercurial binary cannot be found, unfortunately this means that we
219cannot easily determine the version of M5 that you are running and
220this makes error messages more difficult to collect. Please consider
221installing mercurial if you choose to post an error message
222"""
223
224mercurial_lib_not_found = """
225Mercurial libraries cannot be found, ignoring style hook
226If you are actually a M5 developer, please fix this and
227run the style hook. It is important.
228"""
229
230if hgdir.exists():
231 # Ensure that the style hook is in place.
232 try:
233 ui = None
234 if not GetOption('ignore_style'):
235 from mercurial import ui
236 ui = ui.ui()
237 except ImportError:
238 print mercurial_lib_not_found
239
240 if ui is not None:
241 ui.readconfig(hgdir.File('hgrc').abspath)
242 style_hook = ui.config('hooks', 'pretxncommit.style', None)
243
244 if not style_hook:
245 print mercurial_style_message
246 sys.exit(1)
247else:
248 print ".hg directory not found"
249
250###################################################
251#
252# Figure out which configurations to set up based on the path(s) of
253# the target(s).
254#
255###################################################
256
257# Find default configuration & binary.

--- 742 unchanged lines hidden ---