Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
mercurial
format-source
Commits
0f75915355fe
Commit
0f759153
authored
Oct 14, 2018
by
Martijn Pieters
Browse files
ui: add a progress bar
parent
4ca33fa60a5c
Changes
1
Hide whitespace changes
Inline
Side-by-side
hgext3rd/formatsource.py
View file @
0f759153
...
...
@@ -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
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment