Deleted Added
sdiff udiff text old ( 10294:b58f6afe14c5 ) new ( 10674:e2f9644a7738 )
full compact
1#! /usr/bin/env python
2# Copyright (c) 2014 ARM Limited
3# All rights reserved
4#
5# The license below extends only to copyright in the software and shall
6# not be construed as granting a license to any other intellectual
7# property including but not limited to intellectual property relating
8# to a hardware implementation of the functionality of the software

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

153class StdioUI(UserInterface):
154 def do_prompt(self, prompt, results, default):
155 return raw_input(prompt) or default
156
157 def write(self, string):
158 sys.stdout.write(string)
159
160class Verifier(object):
161 def __init__(self, ui, repo):
162 self.ui = ui
163 self.repo = repo
164
165 def __getattr__(self, attr):
166 if attr in ('prompt', 'write'):
167 return getattr(self.ui, attr)
168
169 if attr == 'wctx':
170 try:
171 wctx = repo.workingctx()
172 except:
173 from mercurial import context
174 wctx = context.workingctx(repo)
175 self.wctx = wctx
176 return wctx
177
178 raise AttributeError
179
180 def open(self, filename, mode):
181 filename = self.repo.wjoin(filename)
182
183 try:
184 f = file(filename, mode)
185 except OSError, msg:
186 print 'could not open file %s: %s' % (filename, msg)
187 return None
188
189 return f
190
191 def skip(self, filename):
192 filename = self.repo.wjoin(filename)
193
194 # We never want to handle symlinks, so always skip them: If the location
195 # pointed to is a directory, skip it. If the location is a file inside
196 # the gem5 directory, it will be checked as a file, so symlink can be
197 # skipped. If the location is a file outside gem5, we don't want to
198 # check it anyway.
199 if os.path.islink(filename):
200 return True
201 return lang_type(filename) not in self.languages

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

441 opt_no_ignore = opts.get('no_ignore', False)
442 ui = MercurialUI(hgui, hgui.verbose, opt_fix_white)
443
444 def prompt(name, func, regions=all_regions):
445 result = ui.prompt("(a)bort, (i)gnore, or (f)ix?", 'aif', 'a')
446 if result == 'a':
447 return True
448 elif result == 'f':
449 func(name, regions)
450
451 return False
452
453
454 # Import the match (repository file name matching helper)
455 # function. Different versions of Mercurial keep it in different
456 # modules and implement them differently.
457 try:

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

470 from mercurial import context
471 wctx = context.workingctx(repo)
472
473 files = [ (fn, all_regions) for fn in added ] + \
474 [ (fn, modregions(wctx, fn)) for fn in modified ]
475 else:
476 files = [ (fn, all_regions) for fn in added + modified + clean ]
477
478 whitespace = Whitespace(ui, repo)
479 sorted_includes = SortedIncludes(ui, repo)
480 for fname, mod_regions in files:
481 if not opt_no_ignore and check_ignores(fname):
482 continue
483
484 if whitespace.apply(fname, prompt, mod_regions):
485 return True
486
487 if sorted_includes.apply(fname, prompt, mod_regions):
488 return True
489
490 return False
491
492def do_check_format(hgui, repo, **args):
493 ui = MercurialUI(hgui, hgui.verbose, auto)
494
495 modified, added, removed, deleted, unknown, ignore, clean = repo.status()

--- 117 unchanged lines hidden ---