Mercurial > public > mercurial-scm > hg-stable
diff mercurial/cmdutil.py @ 37153:335e19c6b7fa
remove: add dry-run functionality
author | Sushil khanchi <sushilkhanchi97@gmail.com> |
---|---|
date | Wed, 21 Mar 2018 23:36:11 +0530 |
parents | be3f33f5e232 |
children | 6ff8bd691fb8 |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Sat Mar 17 01:53:44 2018 -0400 +++ b/mercurial/cmdutil.py Wed Mar 21 23:36:11 2018 +0530 @@ -2083,7 +2083,7 @@ return ret -def remove(ui, repo, m, prefix, after, force, subrepos, warnings=None): +def remove(ui, repo, m, prefix, after, force, subrepos, dryrun, warnings=None): join = lambda f: os.path.join(prefix, f) ret = 0 s = repo.status(match=m, clean=True) @@ -2108,7 +2108,7 @@ sub = wctx.sub(subpath) try: if sub.removefiles(submatch, prefix, after, force, subrepos, - warnings): + dryrun, warnings): ret = 1 except error.LookupError: warnings.append(_("skipping missing subrepository: %s\n") @@ -2188,13 +2188,14 @@ ui.status(_('removing %s\n') % m.rel(f)) ui.progress(_('deleting'), None) - with repo.wlock(): - if not after: - for f in list: - if f in added: - continue # we never unlink added files on remove - repo.wvfs.unlinkpath(f, ignoremissing=True) - repo[None].forget(list) + if not dryrun: + with repo.wlock(): + if not after: + for f in list: + if f in added: + continue # we never unlink added files on remove + repo.wvfs.unlinkpath(f, ignoremissing=True) + repo[None].forget(list) if warn: for warning in warnings: