Commit 0f759153 authored by Martijn Pieters's avatar Martijn Pieters
Browse files

ui: add a progress bar

parent 4ca33fa60a5c
......@@ -127,17 +127,19 @@
# files to be formatted
matcher = scmutil.match(wctx, pats, opts)
# perform actual formatting
for filepath in wctx.matches(matcher):
flags = wctx.flags(filepath)
if 'l' in flags:
# links should just be skipped
ui.warn(_('Skipping symlink, %s\n') % filepath)
continue
newcontent = run_tools(ui, repo.root, tool, shell_tool, filepath, filepath)
# XXX we could do the whole commit in memory
with repo.wvfs(filepath, 'wb') as formatted_file:
formatted_file.write(newcontent)
wctx.filectx(filepath).setflags(False, 'x' in flags)
with ui.makeprogress(_('formatting'), unit=_('files')) as progress:
for filepath in wctx.matches(matcher):
progress.increment(item=filepath)
flags = wctx.flags(filepath)
if 'l' in flags:
# links should just be skipped
ui.warn(_('Skipping symlink, %s\n') % filepath)
continue
newcontent = run_tools(ui, repo.root, tool, shell_tool, filepath, filepath)
# XXX we could do the whole commit in memory
with repo.wvfs(filepath, 'wb') as formatted_file:
formatted_file.write(newcontent)
wctx.filectx(filepath).setflags(False, 'x' in flags)
# update the storage to mark formated file as formatted
with repo.wvfs(file_storage_path, mode='ab') as storage:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment