equal
deleted
inserted
replaced
64 |
64 |
65 We walk a window of revisions in the desired order. Within the |
65 We walk a window of revisions in the desired order. Within the |
66 window, we first walk forwards to gather data, then in the desired |
66 window, we first walk forwards to gather data, then in the desired |
67 order (usually backwards) to display it. |
67 order (usually backwards) to display it. |
68 |
68 |
69 This function returns an (iterator, getchange) pair. The |
69 This function returns an (iterator, getchange, matchfn) tuple. The |
70 getchange function returns the changelog entry for a numeric |
70 getchange function returns the changelog entry for a numeric |
71 revision. The iterator yields 3-tuples. They will be of one of |
71 revision. The iterator yields 3-tuples. They will be of one of |
72 the following forms: |
72 the following forms: |
73 |
73 |
74 "window", incrementing, lastrev: stepping through a window, |
74 "window", incrementing, lastrev: stepping through a window, |
80 possible display |
80 possible display |
81 |
81 |
82 "iter", rev, None: in-order traversal of the revs earlier iterated |
82 "iter", rev, None: in-order traversal of the revs earlier iterated |
83 over with "add" - use to display data''' |
83 over with "add" - use to display data''' |
84 |
84 |
|
85 files, matchfn, anypats, cwd = matchpats(repo, pats, opts) |
|
86 |
85 if repo.changelog.count() == 0: |
87 if repo.changelog.count() == 0: |
86 return [], False |
88 return [], False, matchfn |
87 |
89 |
88 files, matchfn, anypats, cwd = matchpats(repo, pats, opts) |
|
89 revs = map(int, revrange(ui, repo, opts['rev'] or ['tip:0'])) |
90 revs = map(int, revrange(ui, repo, opts['rev'] or ['tip:0'])) |
90 wanted = {} |
91 wanted = {} |
91 slowpath = anypats |
92 slowpath = anypats |
92 window = 300 |
93 window = 300 |
93 fncache = {} |
94 fncache = {} |
151 for rev in srevs: |
152 for rev in srevs: |
152 fns = fncache.get(rev) or filter(matchfn, getchange(rev)[3]) |
153 fns = fncache.get(rev) or filter(matchfn, getchange(rev)[3]) |
153 yield 'add', rev, fns |
154 yield 'add', rev, fns |
154 for rev in nrevs: |
155 for rev in nrevs: |
155 yield 'iter', rev, None |
156 yield 'iter', rev, None |
156 return iterate(), getchange |
157 return iterate(), getchange, matchfn |
157 |
158 |
158 revrangesep = ':' |
159 revrangesep = ':' |
159 |
160 |
160 def revrange(ui, repo, revs, revlog=None): |
161 def revrange(ui, repo, revs, revlog=None): |
161 """Yield revision as strings from a list of revision specifications.""" |
162 """Yield revision as strings from a list of revision specifications.""" |
1285 counts[change] += 1 |
1286 counts[change] += 1 |
1286 return counts['+'], counts['-'] |
1287 return counts['+'], counts['-'] |
1287 |
1288 |
1288 fstate = {} |
1289 fstate = {} |
1289 skip = {} |
1290 skip = {} |
1290 changeiter, getchange = walkchangerevs(ui, repo, pats, opts) |
1291 changeiter, getchange, matchfn = walkchangerevs(ui, repo, pats, opts) |
1291 count = 0 |
1292 count = 0 |
1292 incrementing = False |
1293 incrementing = False |
1293 for st, rev, fns in changeiter: |
1294 for st, rev, fns in changeiter: |
1294 if st == 'window': |
1295 if st == 'window': |
1295 incrementing = rev |
1296 incrementing = rev |
1548 def debug(self, *args): |
1549 def debug(self, *args): |
1549 if self.debugflag: |
1550 if self.debugflag: |
1550 self.write(*args) |
1551 self.write(*args) |
1551 def __getattr__(self, key): |
1552 def __getattr__(self, key): |
1552 return getattr(self.ui, key) |
1553 return getattr(self.ui, key) |
1553 changeiter, getchange = walkchangerevs(ui, repo, pats, opts) |
1554 changeiter, getchange, matchfn = walkchangerevs(ui, repo, pats, opts) |
1554 for st, rev, fns in changeiter: |
1555 for st, rev, fns in changeiter: |
1555 if st == 'window': |
1556 if st == 'window': |
1556 du = dui(ui) |
1557 du = dui(ui) |
1557 elif st == 'add': |
1558 elif st == 'add': |
1558 du.bump(rev) |
1559 du.bump(rev) |
1564 if opts['only_merges'] and len(parents) != 2: |
1565 if opts['only_merges'] and len(parents) != 2: |
1565 continue |
1566 continue |
1566 |
1567 |
1567 br = None |
1568 br = None |
1568 if opts['keyword']: |
1569 if opts['keyword']: |
1569 changes = repo.changelog.read(repo.changelog.node(rev)) |
1570 changes = getchange(rev) |
1570 miss = 0 |
1571 miss = 0 |
1571 for k in [kw.lower() for kw in opts['keyword']]: |
1572 for k in [kw.lower() for kw in opts['keyword']]: |
1572 if not (k in changes[1].lower() or |
1573 if not (k in changes[1].lower() or |
1573 k in changes[4].lower() or |
1574 k in changes[4].lower() or |
1574 k in " ".join(changes[3][:20]).lower()): |
1575 k in " ".join(changes[3][:20]).lower()): |
1581 br = repo.branchlookup([repo.changelog.node(rev)]) |
1582 br = repo.branchlookup([repo.changelog.node(rev)]) |
1582 |
1583 |
1583 show_changeset(du, repo, rev, brinfo=br) |
1584 show_changeset(du, repo, rev, brinfo=br) |
1584 if opts['patch']: |
1585 if opts['patch']: |
1585 prev = (parents and parents[0]) or nullid |
1586 prev = (parents and parents[0]) or nullid |
1586 dodiff(du, du, repo, prev, changenode, fns) |
1587 dodiff(du, du, repo, prev, changenode, match=matchfn) |
1587 du.write("\n\n") |
1588 du.write("\n\n") |
1588 elif st == 'iter': |
1589 elif st == 'iter': |
1589 for args in du.hunk[rev]: |
1590 for args in du.hunk[rev]: |
1590 ui.write(*args) |
1591 ui.write(*args) |
1591 |
1592 |