Show More
@@ -389,22 +389,20 b' def overridelog(orig, ui, repo, *pats, *' | |||
|
389 | 389 | # (2) to determine what files to print out diffs for. |
|
390 | 390 | # The magic matchandpats override should be used for case (1) but not for |
|
391 | 391 | # case (2). |
|
392 |
def overridemake |
|
|
392 | def overridemakefilematcher(repo, pats, opts, badfn=None): | |
|
393 | 393 | wctx = repo[None] |
|
394 | 394 | match, pats = oldmatchandpats(wctx, pats, opts, badfn=badfn) |
|
395 | 395 | return lambda rev: match |
|
396 | 396 | |
|
397 | 397 | oldmatchandpats = installmatchandpatsfn(overridematchandpats) |
|
398 |
oldmake |
|
|
399 |
setattr(logcmdutil, '_makenofollow |
|
|
400 | overridemakelogfilematcher) | |
|
398 | oldmakefilematcher = logcmdutil._makenofollowfilematcher | |
|
399 | setattr(logcmdutil, '_makenofollowfilematcher', overridemakefilematcher) | |
|
401 | 400 | |
|
402 | 401 | try: |
|
403 | 402 | return orig(ui, repo, *pats, **opts) |
|
404 | 403 | finally: |
|
405 | 404 | restorematchandpatsfn() |
|
406 |
setattr(logcmdutil, '_makenofollow |
|
|
407 | oldmakelogfilematcher) | |
|
405 | setattr(logcmdutil, '_makenofollowfilematcher', oldmakefilematcher) | |
|
408 | 406 | |
|
409 | 407 | def overrideverify(orig, ui, repo, *pats, **opts): |
|
410 | 408 | large = opts.pop(r'large', False) |
@@ -126,7 +126,7 b' def _setuplog(ui):' | |||
|
126 | 126 | entry[1].append(('', 'sparse', None, |
|
127 | 127 | "limit to changesets affecting the sparse checkout")) |
|
128 | 128 | |
|
129 |
def _l |
|
|
129 | def _initialrevs(orig, repo, opts): | |
|
130 | 130 | revs = orig(repo, opts) |
|
131 | 131 | if opts.get('sparse'): |
|
132 | 132 | sparsematch = sparse.matcher(repo) |
@@ -135,7 +135,7 b' def _setuplog(ui):' | |||
|
135 | 135 | return any(f for f in ctx.files() if sparsematch(f)) |
|
136 | 136 | revs = revs.filter(ctxmatch) |
|
137 | 137 | return revs |
|
138 |
extensions.wrapfunction(logcmdutil, '_l |
|
|
138 | extensions.wrapfunction(logcmdutil, '_initialrevs', _initialrevs) | |
|
139 | 139 | |
|
140 | 140 | def _clonesparsecmd(orig, ui, repo, *args, **opts): |
|
141 | 141 | include_pat = opts.get('include') |
@@ -46,17 +46,17 b' from . import (' | |||
|
46 | 46 | ) |
|
47 | 47 | stringio = util.stringio |
|
48 | 48 | |
|
49 |
loglimit = logcmdutil. |
|
|
49 | loglimit = logcmdutil.getlimit | |
|
50 | 50 | diffordiffstat = logcmdutil.diffordiffstat |
|
51 | 51 | _changesetlabels = logcmdutil.changesetlabels |
|
52 | 52 | changeset_printer = logcmdutil.changesetprinter |
|
53 | 53 | jsonchangeset = logcmdutil.jsonchangeset |
|
54 | 54 | changeset_templater = logcmdutil.changesettemplater |
|
55 |
logtemplatespec = logcmdutil. |
|
|
56 |
makelogtemplater = logcmdutil.make |
|
|
55 | logtemplatespec = logcmdutil.templatespec | |
|
56 | makelogtemplater = logcmdutil.maketemplater | |
|
57 | 57 | show_changeset = logcmdutil.changesetdisplayer |
|
58 |
getlogrevs = logcmdutil.get |
|
|
59 |
getloglinerangerevs = logcmdutil.getl |
|
|
58 | getlogrevs = logcmdutil.getrevs | |
|
59 | getloglinerangerevs = logcmdutil.getlinerangerevs | |
|
60 | 60 | displaygraph = logcmdutil.displaygraph |
|
61 | 61 | graphlog = logcmdutil.graphlog |
|
62 | 62 | checkunsupportedgraphflags = logcmdutil.checkunsupportedgraphflags |
@@ -36,7 +36,7 b' from . import (' | |||
|
36 | 36 | util, |
|
37 | 37 | ) |
|
38 | 38 | |
|
39 |
def |
|
|
39 | def getlimit(opts): | |
|
40 | 40 | """get the log limit according to option -l/--limit""" |
|
41 | 41 | limit = opts.get('limit') |
|
42 | 42 | if limit: |
@@ -391,7 +391,7 b' class changesettemplater(changesetprinte' | |||
|
391 | 391 | |
|
392 | 392 | Note: there are a variety of convenience functions to build a |
|
393 | 393 | changesettemplater for common cases. See functions such as: |
|
394 |
make |
|
|
394 | maketemplater, changesetdisplayer, buildcommittemplate, or other | |
|
395 | 395 | functions that use changesest_templater. |
|
396 | 396 | ''' |
|
397 | 397 | |
@@ -478,13 +478,13 b' class changesettemplater(changesetprinte' | |||
|
478 | 478 | self.footer = templater.stringify( |
|
479 | 479 | self.t(self._parts['footer'], **props)) |
|
480 | 480 | |
|
481 |
def |
|
|
481 | def templatespec(tmpl, mapfile): | |
|
482 | 482 | if mapfile: |
|
483 | 483 | return formatter.templatespec('changeset', tmpl, mapfile) |
|
484 | 484 | else: |
|
485 | 485 | return formatter.templatespec('', tmpl, None) |
|
486 | 486 | |
|
487 |
def _lookup |
|
|
487 | def _lookuptemplate(ui, tmpl, style): | |
|
488 | 488 | """Find the template matching the given template spec or style |
|
489 | 489 | |
|
490 | 490 | See formatter.lookuptemplate() for details. |
@@ -494,7 +494,7 b' def _lookuplogtemplate(ui, tmpl, style):' | |||
|
494 | 494 | if not tmpl and not style: # template are stronger than style |
|
495 | 495 | tmpl = ui.config('ui', 'logtemplate') |
|
496 | 496 | if tmpl: |
|
497 |
return |
|
|
497 | return templatespec(templater.unquotestring(tmpl), None) | |
|
498 | 498 | else: |
|
499 | 499 | style = util.expandpath(ui.config('ui', 'style')) |
|
500 | 500 | |
@@ -505,17 +505,17 b' def _lookuplogtemplate(ui, tmpl, style):' | |||
|
505 | 505 | or templater.templatepath(mapfile)) |
|
506 | 506 | if mapname: |
|
507 | 507 | mapfile = mapname |
|
508 |
return |
|
|
508 | return templatespec(None, mapfile) | |
|
509 | 509 | |
|
510 | 510 | if not tmpl: |
|
511 |
return |
|
|
511 | return templatespec(None, None) | |
|
512 | 512 | |
|
513 | 513 | return formatter.lookuptemplate(ui, 'changeset', tmpl) |
|
514 | 514 | |
|
515 |
def make |
|
|
515 | def maketemplater(ui, repo, tmpl, buffered=False): | |
|
516 | 516 | """Create a changesettemplater from a literal template 'tmpl' |
|
517 | 517 | byte-string.""" |
|
518 |
spec = |
|
|
518 | spec = templatespec(tmpl, None) | |
|
519 | 519 | return changesettemplater(ui, repo, spec, buffered=buffered) |
|
520 | 520 | |
|
521 | 521 | def changesetdisplayer(ui, repo, opts, buffered=False): |
@@ -537,14 +537,14 b' def changesetdisplayer(ui, repo, opts, b' | |||
|
537 | 537 | if opts.get('template') == 'json': |
|
538 | 538 | return jsonchangeset(ui, repo, match, opts, buffered) |
|
539 | 539 | |
|
540 |
spec = _lookup |
|
|
540 | spec = _lookuptemplate(ui, opts.get('template'), opts.get('style')) | |
|
541 | 541 | |
|
542 | 542 | if not spec.ref and not spec.tmpl and not spec.mapfile: |
|
543 | 543 | return changesetprinter(ui, repo, match, opts, buffered) |
|
544 | 544 | |
|
545 | 545 | return changesettemplater(ui, repo, spec, match, opts, buffered) |
|
546 | 546 | |
|
547 |
def _make |
|
|
547 | def _makematcher(repo, revs, pats, opts): | |
|
548 | 548 | """Build matcher and expanded patterns from log options |
|
549 | 549 | |
|
550 | 550 | If --follow, revs are the revisions to follow from. |
@@ -625,7 +625,7 b' def _fileancestors(repo, revs, match, fo' | |||
|
625 | 625 | yield rev |
|
626 | 626 | return smartset.generatorset(revgen(), iterasc=False), filematcher |
|
627 | 627 | |
|
628 |
def _makenofollow |
|
|
628 | def _makenofollowfilematcher(repo, pats, opts): | |
|
629 | 629 | '''hook for extensions to override the filematcher for non-follow cases''' |
|
630 | 630 | return None |
|
631 | 631 | |
@@ -641,7 +641,7 b' def _makenofollowlogfilematcher(repo, pa' | |||
|
641 | 641 | 'user': ('user(%s)', '%lr'), |
|
642 | 642 | } |
|
643 | 643 | |
|
644 |
def _make |
|
|
644 | def _makerevset(repo, match, pats, slowpath, opts): | |
|
645 | 645 | """Return a revset string built from log options and file patterns""" |
|
646 | 646 | opts = dict(opts) |
|
647 | 647 | # follow or not follow? |
@@ -694,7 +694,7 b' def _makelogrevset(repo, match, pats, sl' | |||
|
694 | 694 | expr = None |
|
695 | 695 | return expr |
|
696 | 696 | |
|
697 |
def _l |
|
|
697 | def _initialrevs(repo, opts): | |
|
698 | 698 | """Return the initial set of revisions to be filtered or followed""" |
|
699 | 699 | follow = opts.get('follow') or opts.get('follow_first') |
|
700 | 700 | if opts.get('rev'): |
@@ -708,7 +708,7 b' def _logrevs(repo, opts):' | |||
|
708 | 708 | revs.reverse() |
|
709 | 709 | return revs |
|
710 | 710 | |
|
711 |
def get |
|
|
711 | def getrevs(repo, pats, opts): | |
|
712 | 712 | """Return (revs, filematcher) where revs is a smartset |
|
713 | 713 | |
|
714 | 714 | filematcher is a callable taking a revision number and returning a match |
@@ -716,11 +716,11 b' def getlogrevs(repo, pats, opts):' | |||
|
716 | 716 | """ |
|
717 | 717 | follow = opts.get('follow') or opts.get('follow_first') |
|
718 | 718 | followfirst = opts.get('follow_first') |
|
719 |
limit = |
|
|
720 |
revs = _l |
|
|
719 | limit = getlimit(opts) | |
|
720 | revs = _initialrevs(repo, opts) | |
|
721 | 721 | if not revs: |
|
722 | 722 | return smartset.baseset(), None |
|
723 |
match, pats, slowpath = _make |
|
|
723 | match, pats, slowpath = _makematcher(repo, revs, pats, opts) | |
|
724 | 724 | filematcher = None |
|
725 | 725 | if follow: |
|
726 | 726 | if slowpath or match.always(): |
@@ -729,15 +729,15 b' def getlogrevs(repo, pats, opts):' | |||
|
729 | 729 | revs, filematcher = _fileancestors(repo, revs, match, followfirst) |
|
730 | 730 | revs.reverse() |
|
731 | 731 | if filematcher is None: |
|
732 |
filematcher = _makenofollow |
|
|
732 | filematcher = _makenofollowfilematcher(repo, pats, opts) | |
|
733 | 733 | if filematcher is None: |
|
734 | 734 | def filematcher(rev): |
|
735 | 735 | return match |
|
736 | 736 | |
|
737 |
expr = _make |
|
|
737 | expr = _makerevset(repo, match, pats, slowpath, opts) | |
|
738 | 738 | if opts.get('graph') and opts.get('rev'): |
|
739 | 739 | # User-specified revs might be unsorted, but don't sort before |
|
740 |
# _make |
|
|
740 | # _makerevset because it might depend on the order of revs | |
|
741 | 741 | if not (revs.isdescending() or revs.istopo()): |
|
742 | 742 | revs.sort(reverse=True) |
|
743 | 743 | if expr: |
@@ -747,7 +747,7 b' def getlogrevs(repo, pats, opts):' | |||
|
747 | 747 | revs = revs.slice(0, limit) |
|
748 | 748 | return revs, filematcher |
|
749 | 749 | |
|
750 |
def _parselinerange |
|
|
750 | def _parselinerangeopt(repo, opts): | |
|
751 | 751 | """Parse --line-range log option and return a list of tuples (filename, |
|
752 | 752 | (fromline, toline)). |
|
753 | 753 | """ |
@@ -767,7 +767,7 b' def _parselinerangelogopt(repo, opts):' | |||
|
767 | 767 | (fname, util.processlinerange(fromline, toline))) |
|
768 | 768 | return linerangebyfname |
|
769 | 769 | |
|
770 |
def getl |
|
|
770 | def getlinerangerevs(repo, userrevs, opts): | |
|
771 | 771 | """Return (revs, filematcher, hunksfilter). |
|
772 | 772 | |
|
773 | 773 | "revs" are revisions obtained by processing "line-range" log options and |
@@ -785,7 +785,7 b' def getloglinerangerevs(repo, userrevs, ' | |||
|
785 | 785 | |
|
786 | 786 | # Two-levels map of "rev -> file ctx -> [line range]". |
|
787 | 787 | linerangesbyrev = {} |
|
788 |
for fname, (fromline, toline) in _parselinerange |
|
|
788 | for fname, (fromline, toline) in _parselinerangeopt(repo, opts): | |
|
789 | 789 | if fname not in wctx: |
|
790 | 790 | raise error.Abort(_('cannot follow file not in parent ' |
|
791 | 791 | 'revision: "%s"') % fname) |
@@ -926,7 +926,7 b' def checkunsupportedgraphflags(pats, opt' | |||
|
926 | 926 | % op.replace("_", "-")) |
|
927 | 927 | |
|
928 | 928 | def graphrevs(repo, nodes, opts): |
|
929 |
limit = |
|
|
929 | limit = getlimit(opts) | |
|
930 | 930 | nodes.reverse() |
|
931 | 931 | if limit is not None: |
|
932 | 932 | nodes = nodes[:limit] |
@@ -93,11 +93,11 b' o (0) root' | |||
|
93 | 93 | > ) |
|
94 | 94 | > |
|
95 | 95 | > def logrevset(repo, pats, opts): |
|
96 |
> revs = logcmdutil._l |
|
|
96 | > revs = logcmdutil._initialrevs(repo, opts) | |
|
97 | 97 | > if not revs: |
|
98 | 98 | > return None |
|
99 |
> match, pats, slowpath = logcmdutil._make |
|
|
100 |
> return logcmdutil._make |
|
|
99 | > match, pats, slowpath = logcmdutil._makematcher(repo, revs, pats, opts) | |
|
100 | > return logcmdutil._makerevset(repo, match, pats, slowpath, opts) | |
|
101 | 101 | > |
|
102 | 102 | > def uisetup(ui): |
|
103 | 103 | > def printrevset(orig, repo, pats, opts): |
General Comments 0
You need to be logged in to leave comments.
Login now