Mercurial > hg > mercurial-source
diff hgext/largefiles/overrides.py @ 23898:5ce8dcd05dc4
largefiles: enable subrepo support for add
The --large, --normal and --lfsize args couldn't be passed to a subrepo before,
and files in the subrepos would be added silently (if -v wasn't specified) as
normal files. As an added bonus, 'hg add --dry-run' no longer prints that
largefiles would also be added as normal files as well.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Mon, 12 Jan 2015 21:44:43 -0500 |
parents | ec2c2e1400f0 |
children | 054cfb7c33ae |
line wrap: on
line diff
--- a/hgext/largefiles/overrides.py +++ b/hgext/largefiles/overrides.py @@ -242,23 +242,25 @@ # -- Wrappers: modify existing commands -------------------------------- -# Add works by going through the files that the user wanted to add and -# checking if they should be added as largefiles. Then it makes a new -# matcher which matches only the normal files and runs the original -# version of add. def overrideadd(orig, ui, repo, *pats, **opts): normal = opts.get('normal') if normal: if opts.get('large'): raise util.Abort(_('--normal cannot be used with --large')) - return orig(ui, repo, *pats, **opts) - matcher = scmutil.match(repo[None], pats, opts) - added, bad = addlargefiles(ui, repo, False, matcher, **opts) - installnormalfilesmatchfn(repo[None].manifest()) - result = orig(ui, repo, *pats, **opts) - restorematchfn() + return orig(ui, repo, *pats, **opts) + +def cmdutiladd(orig, ui, repo, matcher, prefix, explicitonly, **opts): + # The --normal flag short circuits this override + if opts.get('normal'): + return orig(ui, repo, matcher, prefix, explicitonly, **opts) - return (result == 1 or bad) and 1 or 0 + ladded, lbad = addlargefiles(ui, repo, False, matcher, **opts) + normalmatcher = composenormalfilematcher(matcher, repo[None].manifest(), + ladded) + bad = orig(ui, repo, normalmatcher, prefix, explicitonly, **opts) + + bad.extend(f for f in lbad) + return bad def cmdutilremove(orig, ui, repo, matcher, prefix, after, force, subrepos): normalmatcher = composenormalfilematcher(matcher, repo[None].manifest())