This fixes two of sparse tests which were failing on Python 3.
- skip-blame because just r'' prefixes
indygreg |
hg-reviewers |
This fixes two of sparse tests which were failing on Python 3.
Automatic diff as part of commit; lint not applicable. |
Automatic diff as part of commit; unit tests not applicable. |
def ctxmatch(rev): | def ctxmatch(rev): | ||||
ctx = repo[rev] | ctx = repo[rev] | ||||
return any(f for f in ctx.files() if sparsematch(f)) | return any(f for f in ctx.files() if sparsematch(f)) | ||||
revs = revs.filter(ctxmatch) | revs = revs.filter(ctxmatch) | ||||
return revs | return revs | ||||
extensions.wrapfunction(logcmdutil, '_initialrevs', _initialrevs) | extensions.wrapfunction(logcmdutil, '_initialrevs', _initialrevs) | ||||
def _clonesparsecmd(orig, ui, repo, *args, **opts): | def _clonesparsecmd(orig, ui, repo, *args, **opts): | ||||
include_pat = opts.get('include') | include_pat = opts.get(r'include') | ||||
exclude_pat = opts.get('exclude') | exclude_pat = opts.get(r'exclude') | ||||
enableprofile_pat = opts.get('enable_profile') | enableprofile_pat = opts.get(r'enable_profile') | ||||
include = exclude = enableprofile = False | include = exclude = enableprofile = False | ||||
if include_pat: | if include_pat: | ||||
pat = include_pat | pat = include_pat | ||||
include = True | include = True | ||||
if exclude_pat: | if exclude_pat: | ||||
pat = exclude_pat | pat = exclude_pat | ||||
exclude = True | exclude = True | ||||
if enableprofile_pat: | if enableprofile_pat: | ||||
extensions.wrapcommand(commands.table, 'clone', _clonesparsecmd) | extensions.wrapcommand(commands.table, 'clone', _clonesparsecmd) | ||||
def _setupadd(ui): | def _setupadd(ui): | ||||
entry = commands.table['^add'] | entry = commands.table['^add'] | ||||
entry[1].append(('s', 'sparse', None, | entry[1].append(('s', 'sparse', None, | ||||
'also include directories of added files in sparse config')) | 'also include directories of added files in sparse config')) | ||||
def _add(orig, ui, repo, *pats, **opts): | def _add(orig, ui, repo, *pats, **opts): | ||||
if opts.get('sparse'): | if opts.get(r'sparse'): | ||||
dirs = set() | dirs = set() | ||||
for pat in pats: | for pat in pats: | ||||
dirname, basename = util.split(pat) | dirname, basename = util.split(pat) | ||||
dirs.add(dirname) | dirs.add(dirname) | ||||
sparse.updateconfig(repo, list(dirs), opts, include=True) | sparse.updateconfig(repo, list(dirs), opts, include=True) | ||||
return orig(ui, repo, *pats, **opts) | return orig(ui, repo, *pats, **opts) | ||||
extensions.wrapcommand(commands.table, 'add', _add) | extensions.wrapcommand(commands.table, 'add', _add) |