[PATCH 3 of 3] remove: add progress support

Anton Shestakov engored at ya.ru
Mon Mar 21 01:01:16 EDT 2016


21.03.2016, 12:25, "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 1d7704a6d5dfd1a1a09cc337fe57cd4c41e3a27d
> # Parent 47a0e2e459081990c948408b268bd3d01e077290
> 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'))

This one unit is still singular.


More information about the Mercurial-devel mailing list