Mercurial > hg
comparison mercurial/commands.py @ 36003:fcde8946c553
logcmdutil: hold makefilematcher/makehunksfilter() by changesetpriner (API)
This merges self.matchfn and self.show(matchfn) into self._makefilematcher,
and does the same for hunksfilter. Because changesetprinter seems to have
too many optional arguments, makefilematcher() and makehunksfilter() will
be packed into one object by later patch.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 21 Jan 2018 14:07:52 +0900 |
parents | f8ad57d24252 |
children | dd77e36eabb6 |
comparison
equal
deleted
inserted
replaced
36002:f8ad57d24252 | 36003:fcde8946c553 |
---|---|
3448 if opts.get('rev'): | 3448 if opts.get('rev'): |
3449 endrev = scmutil.revrange(repo, opts.get('rev')).max() + 1 | 3449 endrev = scmutil.revrange(repo, opts.get('rev')).max() + 1 |
3450 getrenamed = templatekw.getrenamedfn(repo, endrev=endrev) | 3450 getrenamed = templatekw.getrenamedfn(repo, endrev=endrev) |
3451 | 3451 |
3452 ui.pager('log') | 3452 ui.pager('log') |
3453 displayer = logcmdutil.changesetdisplayer(ui, repo, opts, buffered=True) | 3453 displayer = logcmdutil.changesetdisplayer(ui, repo, opts, |
3454 makefilematcher=filematcher, | |
3455 makehunksfilter=hunksfilter, | |
3456 buffered=True) | |
3454 for rev in revs: | 3457 for rev in revs: |
3455 ctx = repo[rev] | 3458 ctx = repo[rev] |
3456 copies = None | 3459 copies = None |
3457 if getrenamed is not None and rev: | 3460 if getrenamed is not None and rev: |
3458 copies = [] | 3461 copies = [] |
3459 for fn in ctx.files(): | 3462 for fn in ctx.files(): |
3460 rename = getrenamed(fn, rev) | 3463 rename = getrenamed(fn, rev) |
3461 if rename: | 3464 if rename: |
3462 copies.append((fn, rename[0])) | 3465 copies.append((fn, rename[0])) |
3463 if filematcher: | 3466 displayer.show(ctx, copies=copies) |
3464 revmatchfn = filematcher(ctx) | |
3465 else: | |
3466 revmatchfn = None | |
3467 if hunksfilter: | |
3468 revhunksfilter = hunksfilter(ctx) | |
3469 else: | |
3470 revhunksfilter = None | |
3471 displayer.show(ctx, copies=copies, matchfn=revmatchfn, | |
3472 hunksfilterfn=revhunksfilter) | |
3473 displayer.flush(ctx) | 3467 displayer.flush(ctx) |
3474 | 3468 |
3475 displayer.close() | 3469 displayer.close() |
3476 | 3470 |
3477 @command('manifest', | 3471 @command('manifest', |