if file_type(filename) in format_types:
return True
- return False
+ return True
def checkwhite_line(line):
match = lead.search(line)
if args.get('auto', False):
result = 'f'
else:
- result = ui.prompt("(a)bort, (i)gnore, or (f)ix?", "^[aif]$", "a")
+ while True:
+ result = ui.prompt("(a)bort, (i)gnore, or (f)ix?", default='a')
+ if result in 'aif':
+ break
+
if result == 'a':
return True
- elif result == 'i':
- pass
elif result == 'f':
fixwhite(repo.wjoin(name), args['tabsize'], fixonly)
- else:
- raise util.Abort(_("Invalid response: '%s'") % result)
return False
if prompt(fname):
return True
- wctx = repo.workingctx()
+ try:
+ wctx = repo.workingctx()
+ except:
+ from mercurial import context
+ wctx = context.workingctx(repo)
+
for fname in modified:
if skip(fname):
continue
mod_lines = modified_lines(pctx[0].data(), file_data, len(lines))
if len(pctx) == 2:
m2 = modified_lines(pctx[1].data(), file_data, len(lines))
- mod_lines = mod_lines & m2 # only the lines that are new in both
+ # only the lines that are new in both
+ mod_lines = mod_lines & m2
else:
mod_lines = xrange(0, len(lines))
if prompt(fname, fixonly):
return True
-def check_whitespace(ui, repo, hooktype, node, parent1, parent2):
+def check_whitespace(ui, repo, hooktype, node, parent1, parent2, **kwargs):
if hooktype != 'pretxncommit':
raise AttributeError, \
"This hook is only meant for pretxncommit, not %s" % hooktype
args = { 'tabsize' : 8 }
- do_check_whitespace(ui, repo, **args)
+ return do_check_whitespace(ui, repo, **args)
-def check_format(ui, repo, hooktype, node, parent1, parent2):
+def check_format(ui, repo, hooktype, node, parent1, parent2, **kwargs):
if hooktype != 'pretxncommit':
raise AttributeError, \
"This hook is only meant for pretxncommit, not %s" % hooktype