Details
Details
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
| hg-reviewers |
| Automatic diff as part of commit; lint not applicable. |
| Automatic diff as part of commit; unit tests not applicable. |
| Path | Packages | |||
|---|---|---|---|---|
| M | mercurial/cmdutil.py (49 lines) |
| Status | Author | Revision | |
|---|---|---|---|
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz |
| if warnings is None: | if warnings is None: | ||||
| warnings = [] | warnings = [] | ||||
| warn = True | warn = True | ||||
| else: | else: | ||||
| warn = False | warn = False | ||||
| subs = sorted(wctx.substate) | subs = sorted(wctx.substate) | ||||
| total = len(subs) | progress = ui.makeprogress(_('searching'), total=len(subs), | ||||
| count = 0 | unit=_('subrepos')) | ||||
| for subpath in subs: | for subpath in subs: | ||||
| count += 1 | |||||
| submatch = matchmod.subdirmatcher(subpath, m) | submatch = matchmod.subdirmatcher(subpath, m) | ||||
| if subrepos or m.exact(subpath) or any(submatch.files()): | if subrepos or m.exact(subpath) or any(submatch.files()): | ||||
| ui.progress(_('searching'), count, total=total, unit=_('subrepos')) | progress.increment() | ||||
| sub = wctx.sub(subpath) | sub = wctx.sub(subpath) | ||||
| try: | try: | ||||
| if sub.removefiles(submatch, prefix, after, force, subrepos, | if sub.removefiles(submatch, prefix, after, force, subrepos, | ||||
| dryrun, warnings): | dryrun, warnings): | ||||
| ret = 1 | ret = 1 | ||||
| except error.LookupError: | except error.LookupError: | ||||
| warnings.append(_("skipping missing subrepository: %s\n") | warnings.append(_("skipping missing subrepository: %s\n") | ||||
| % join(subpath)) | % join(subpath)) | ||||
| ui.progress(_('searching'), None) | progress.update(None) | ||||
| # warn about failure to delete explicit files/dirs | # warn about failure to delete explicit files/dirs | ||||
| deleteddirs = util.dirs(deleted) | deleteddirs = util.dirs(deleted) | ||||
| files = m.files() | files = m.files() | ||||
| total = len(files) | progress = ui.makeprogress(_('deleting'), total=len(files), | ||||
| count = 0 | unit=_('files')) | ||||
| for f in files: | for f in files: | ||||
| def insubrepo(): | def insubrepo(): | ||||
| for subpath in wctx.substate: | for subpath in wctx.substate: | ||||
| if f.startswith(subpath + '/'): | if f.startswith(subpath + '/'): | ||||
| return True | return True | ||||
| return False | return False | ||||
| count += 1 | progress.increment() | ||||
| ui.progress(_('deleting'), count, total=total, unit=_('files')) | |||||
| isdir = f in deleteddirs or wctx.hasdir(f) | isdir = f in deleteddirs or wctx.hasdir(f) | ||||
| if (f in repo.dirstate or isdir or f == '.' | if (f in repo.dirstate or isdir or f == '.' | ||||
| or insubrepo() or f in subs): | or insubrepo() or f in subs): | ||||
| continue | continue | ||||
| if repo.wvfs.exists(f): | if repo.wvfs.exists(f): | ||||
| if repo.wvfs.isdir(f): | if repo.wvfs.isdir(f): | ||||
| warnings.append(_('not removing %s: no tracked files\n') | warnings.append(_('not removing %s: no tracked files\n') | ||||
| % m.rel(f)) | % m.rel(f)) | ||||
| else: | else: | ||||
| warnings.append(_('not removing %s: file is untracked\n') | warnings.append(_('not removing %s: file is untracked\n') | ||||
| % m.rel(f)) | % m.rel(f)) | ||||
| # missing files will generate a warning elsewhere | # missing files will generate a warning elsewhere | ||||
| ret = 1 | ret = 1 | ||||
| ui.progress(_('deleting'), None) | progress.update(None) | ||||
| if force: | if force: | ||||
| list = modified + deleted + clean + added | list = modified + deleted + clean + added | ||||
| elif after: | elif after: | ||||
| list = deleted | list = deleted | ||||
| remaining = modified + added + clean | remaining = modified + added + clean | ||||
| total = len(remaining) | progress = ui.makeprogress(_('skipping'), total=len(remaining), | ||||
| count = 0 | unit=_('files')) | ||||
| for f in remaining: | for f in remaining: | ||||
| count += 1 | progress.increment() | ||||
| ui.progress(_('skipping'), count, total=total, unit=_('files')) | |||||
| if ui.verbose or (f in files): | if ui.verbose or (f in files): | ||||
| warnings.append(_('not removing %s: file still exists\n') | warnings.append(_('not removing %s: file still exists\n') | ||||
| % m.rel(f)) | % m.rel(f)) | ||||
| ret = 1 | ret = 1 | ||||
| ui.progress(_('skipping'), None) | progress.update(None) | ||||
| else: | else: | ||||
| list = deleted + clean | list = deleted + clean | ||||
| total = len(modified) + len(added) | progress = ui.makeprogress(_('skipping'), | ||||
| count = 0 | total=(len(modified) + len(added)), | ||||
| unit=_('files')) | |||||
| for f in modified: | for f in modified: | ||||
| count += 1 | progress.increment() | ||||
| ui.progress(_('skipping'), count, total=total, unit=_('files')) | |||||
| warnings.append(_('not removing %s: file is modified (use -f' | warnings.append(_('not removing %s: file is modified (use -f' | ||||
| ' to force removal)\n') % m.rel(f)) | ' to force removal)\n') % m.rel(f)) | ||||
| ret = 1 | ret = 1 | ||||
| for f in added: | for f in added: | ||||
| count += 1 | progress.increment() | ||||
| ui.progress(_('skipping'), count, total=total, unit=_('files')) | |||||
| warnings.append(_("not removing %s: file has been marked for add" | warnings.append(_("not removing %s: file has been marked for add" | ||||
| " (use 'hg forget' to undo add)\n") % m.rel(f)) | " (use 'hg forget' to undo add)\n") % m.rel(f)) | ||||
| ret = 1 | ret = 1 | ||||
| ui.progress(_('skipping'), None) | progress.update(None) | ||||
| list = sorted(list) | list = sorted(list) | ||||
| total = len(list) | progress = ui.makeprogress(_('deleting'), total=len(list), | ||||
| count = 0 | unit=_('files')) | ||||
| for f in list: | for f in list: | ||||
| count += 1 | |||||
| if ui.verbose or not m.exact(f): | if ui.verbose or not m.exact(f): | ||||
| ui.progress(_('deleting'), count, total=total, unit=_('files')) | progress.increment() | ||||
| ui.status(_('removing %s\n') % m.rel(f)) | ui.status(_('removing %s\n') % m.rel(f)) | ||||
| ui.progress(_('deleting'), None) | progress.update(None) | ||||
| if not dryrun: | if not dryrun: | ||||
| with repo.wlock(): | with repo.wlock(): | ||||
| if not after: | if not after: | ||||
| for f in list: | for f in list: | ||||
| if f in added: | if f in added: | ||||
| continue # we never unlink added files on remove | continue # we never unlink added files on remove | ||||
| repo.wvfs.unlinkpath(f, ignoremissing=True) | repo.wvfs.unlinkpath(f, ignoremissing=True) | ||||