[PATCH 2 of 2 v2] remove: add progress support

Anton Shestakov engored at ya.ru
Fri Mar 18 10:58:49 EDT 2016


18.03.2016, 22:48, "timeless" <timeless at mozdev.org>:
> # HG changeset patch
> # User timeless <timeless at mozdev.org>
> # Date 1458248602 0
> # Thu Mar 17 21:03:22 2016 +0000
> # Node ID b59885f726092f8288bc70324e7d5072c10520df
> # Parent 5c624c08cd0ecdb725a407f4ad87c538a955fb56
> remove: add progress support
>
> diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
> --- a/mercurial/cmdutil.py
> +++ b/mercurial/cmdutil.py
> @@ -2407,7 +2407,10 @@
>      else:
>          warn = False
>
> - for subpath in sorted(wctx.substate):
> + subs = sorted(wctx.substate)
> + total = len(subs)
> + count = 0
> + for subpath in subs:
>          def matchessubrepo(matcher, subpath):
>              if matcher.exact(subpath):
>                  return True
> @@ -2416,7 +2419,10 @@
>                      return True
>              return False
>
> + count += 1
>          if subrepos or matchessubrepo(m, subpath):
> + ui.progress(_('searching'), count, total=total, unit=_('subrepos'))
> +
>              sub = wctx.sub(subpath)
>              try:
>                  submatch = matchmod.subdirmatcher(subpath, m)
> @@ -2426,16 +2432,22 @@
>              except error.LookupError:
>                  warnings.append(_("skipping missing subrepository: %s\n")
>                                 % join(subpath))
> + ui.progress(_('searching'), None)
>
>      # warn about failure to delete explicit files/dirs
>      deleteddirs = util.dirs(deleted)
> - for f in m.files():
> + files = m.files()
> + total = len(files)
> + count = 0
> + for f in files:
>          def insubrepo():
>              for subpath in wctx.substate:
>                  if f.startswith(subpath):
>                      return True
>              return False
>
> + count += 1
> + ui.progress(_('deleting'), count, total=total, unit=_('file'))

Missed this one (could be changed in-flight?).

I'll look into automating this somehow.


More information about the Mercurial-devel mailing list