Mercurial > public > mercurial-scm > hg-stable
diff hgext/largefiles/overrides.py @ 37153:335e19c6b7fa
remove: add dry-run functionality
author | Sushil khanchi <sushilkhanchi97@gmail.com> |
---|---|
date | Wed, 21 Mar 2018 23:36:11 +0530 |
parents | 08890706366e |
children | 14cd5290c4e6 |
line wrap: on
line diff
--- a/hgext/largefiles/overrides.py Sat Mar 17 01:53:44 2018 -0400 +++ b/hgext/largefiles/overrides.py Wed Mar 21 23:36:11 2018 +0530 @@ -178,7 +178,7 @@ added = [f for f in lfnames if f not in bad] return added, bad -def removelargefiles(ui, repo, isaddremove, matcher, **opts): +def removelargefiles(ui, repo, isaddremove, matcher, dryrun, **opts): after = opts.get(r'after') m = composelargefilematcher(matcher, repo[None].manifest()) try: @@ -223,11 +223,11 @@ name = m.rel(f) ui.status(_('removing %s\n') % name) - if not opts.get(r'dry_run'): + if not dryrun: if not after: repo.wvfs.unlinkpath(f, ignoremissing=True) - if opts.get(r'dry_run'): + if dryrun: return result remove = [lfutil.standin(f) for f in remove] @@ -271,10 +271,12 @@ bad.extend(f for f in lbad) return bad -def cmdutilremove(orig, ui, repo, matcher, prefix, after, force, subrepos): +def cmdutilremove(orig, ui, repo, matcher, prefix, after, force, subrepos, + dryrun): normalmatcher = composenormalfilematcher(matcher, repo[None].manifest()) - result = orig(ui, repo, normalmatcher, prefix, after, force, subrepos) - return removelargefiles(ui, repo, False, matcher, after=after, + result = orig(ui, repo, normalmatcher, prefix, after, force, subrepos, + dryrun) + return removelargefiles(ui, repo, False, matcher, dryrun, after=after, force=force) or result def overridestatusfn(orig, repo, rev2, **opts): @@ -1238,7 +1240,8 @@ matchfn = m.matchfn m.matchfn = lambda f: f in s.deleted and matchfn(f) - removelargefiles(repo.ui, repo, True, m, **pycompat.strkwargs(opts)) + removelargefiles(repo.ui, repo, True, m, opts.get('dry_run'), + **pycompat.strkwargs(opts)) # Call into the normal add code, and any files that *should* be added as # largefiles will be added, bad = addlargefiles(repo.ui, repo, True, matcher,