Mercurial > hg
comparison hgext/graphlog.py @ 6750:fb42030d79d6
add __len__ and __iter__ methods to repo and revlog
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 26 Jun 2008 14:35:50 -0500 |
parents | 53465a7464e2 |
children | f67d1468ac50 |
comparison
equal
deleted
inserted
replaced
6749:51b0e799352f | 6750:fb42030d79d6 |
---|---|
87 """ | 87 """ |
88 | 88 |
89 assert start_rev >= stop_rev | 89 assert start_rev >= stop_rev |
90 curr_rev = start_rev | 90 curr_rev = start_rev |
91 revs = [] | 91 revs = [] |
92 filerev = repo.file(path).count() - 1 | 92 filerev = len(repo.file(path)) - 1 |
93 while filerev >= 0: | 93 while filerev >= 0: |
94 fctx = repo.filectx(path, fileid=filerev) | 94 fctx = repo.filectx(path, fileid=filerev) |
95 | 95 |
96 # Compute revs and next_revs. | 96 # Compute revs and next_revs. |
97 if filerev not in revs: | 97 if filerev not in revs: |
196 def get_revs(repo, rev_opt): | 196 def get_revs(repo, rev_opt): |
197 if rev_opt: | 197 if rev_opt: |
198 revs = revrange(repo, rev_opt) | 198 revs = revrange(repo, rev_opt) |
199 return (max(revs), min(revs)) | 199 return (max(revs), min(revs)) |
200 else: | 200 else: |
201 return (repo.changelog.count() - 1, 0) | 201 return (len(repo) - 1, 0) |
202 | 202 |
203 def graphlog(ui, repo, path=None, **opts): | 203 def graphlog(ui, repo, path=None, **opts): |
204 """show revision history alongside an ASCII revision graph | 204 """show revision history alongside an ASCII revision graph |
205 | 205 |
206 Print a revision history alongside a revision graph drawn with | 206 Print a revision history alongside a revision graph drawn with |