Mercurial > hg-stable
changeset 10085:3f3f9c5bbe2b
Merge with stable
author | Martin Geisler <mg@lazybytes.net> |
---|---|
date | Wed, 16 Dec 2009 22:58:57 +0100 |
parents | 580892d01310 (current diff) 4c844f16bf39 (diff) |
children | b1982715c435 |
files | |
diffstat | 4 files changed, 79 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/graphlog.py Wed Dec 16 22:18:15 2009 +0100 +++ b/hgext/graphlog.py Wed Dec 16 22:58:57 2009 +0100 @@ -241,15 +241,15 @@ check_unsupported_flags(opts) limit = cmdutil.loglimit(opts) start, stop = get_revs(repo, opts["rev"]) - stop = max(stop, start - limit + 1) if start == nullrev: return if path: path = util.canonpath(repo.root, os.getcwd(), path) if path: # could be reset in canonpath - revdag = graphmod.filerevs(repo, path, start, stop) + revdag = graphmod.filerevs(repo, path, start, stop, limit) else: + stop = max(stop, start - limit + 1) revdag = graphmod.revisions(repo, start, stop) displayer = show_changeset(ui, repo, opts, buffered=True)
--- a/mercurial/graphmod.py Wed Dec 16 22:18:15 2009 +0100 +++ b/mercurial/graphmod.py Wed Dec 16 22:58:57 2009 +0100 @@ -17,6 +17,7 @@ Data depends on type. """ +import sys from mercurial.node import nullrev CHANGESET = 'C' @@ -36,21 +37,24 @@ yield (cur, CHANGESET, ctx, sorted(parents)) cur -= 1 -def filerevs(repo, path, start, stop): +def filerevs(repo, path, start, stop, limit=sys.maxint): """file cset DAG generator yielding (id, CHANGESET, ctx, [parentids]) tuples This generator function walks through the revision history of a single file from revision start down to revision stop. """ filerev = len(repo.file(path)) - 1 - while filerev >= 0: + rev = stop + 1 + count = 0 + while filerev >= 0 and rev > stop: fctx = repo.filectx(path, fileid=filerev) parents = [f.linkrev() for f in fctx.parents() if f.path() == path] rev = fctx.rev() if rev <= start: yield (rev, CHANGESET, fctx.changectx(), sorted(parents)) - if rev <= stop: - break + count += 1 + if count == limit: + break filerev -= 1 def nodes(repo, nodes):
--- a/tests/test-glog Wed Dec 16 22:18:15 2009 +0100 +++ b/tests/test-glog Wed Dec 16 22:58:57 2009 +0100 @@ -175,3 +175,19 @@ hg incoming --graph ../repo cd .. hg -R repo outgoing --graph repo2 + +cd repo +echo % file + limit with revs != cset revs +touch b +hg ci -Aqm0 +# this used to show only one cset +hg glog -l2 a + +echo "% file + limit + -ra:b, (b - a) < limit" +hg glog -l3000 -r32:tip a + +echo "% file + limit + -ra:b, b < tip" +hg glog -l1 -r32:34 a + +echo "% file + limit + -ra:b, b < tip, (b - a) < limit" +hg glog -l10 -r33:34 a
--- a/tests/test-glog.out Wed Dec 16 22:18:15 2009 +0100 +++ b/tests/test-glog.out Wed Dec 16 22:58:57 2009 +0100 @@ -643,3 +643,56 @@ date: Thu Jan 01 00:00:27 1970 +0000 summary: (27) collapse +% file + limit with revs != cset revs +o changeset: 34:fea3ac5810e0 +| parent: 32:d06dffa21a31 +| user: test +| date: Thu Jan 01 00:00:34 1970 +0000 +| summary: (34) head +| +| o changeset: 33:68608f5145f9 +| | parent: 18:1aa84d96232a +| | user: test +| | date: Thu Jan 01 00:00:33 1970 +0000 +| | summary: (33) head +| | +% file + limit + -ra:b, (b - a) < limit +o changeset: 34:fea3ac5810e0 +| parent: 32:d06dffa21a31 +| user: test +| date: Thu Jan 01 00:00:34 1970 +0000 +| summary: (34) head +| +| o changeset: 33:68608f5145f9 +| | parent: 18:1aa84d96232a +| | user: test +| | date: Thu Jan 01 00:00:33 1970 +0000 +| | summary: (33) head +| | +o | changeset: 32:d06dffa21a31 +|\ \ parent: 27:886ed638191b +| | | parent: 31:621d83e11f67 +| | | user: test +| | | date: Thu Jan 01 00:00:32 1970 +0000 +| | | summary: (32) expand +| | | +% file + limit + -ra:b, b < tip +o changeset: 34:fea3ac5810e0 +| parent: 32:d06dffa21a31 +| user: test +| date: Thu Jan 01 00:00:34 1970 +0000 +| summary: (34) head +| +% file + limit + -ra:b, b < tip, (b - a) < limit +o changeset: 34:fea3ac5810e0 +| parent: 32:d06dffa21a31 +| user: test +| date: Thu Jan 01 00:00:34 1970 +0000 +| summary: (34) head +| +| o changeset: 33:68608f5145f9 +| | parent: 18:1aa84d96232a +| | user: test +| | date: Thu Jan 01 00:00:33 1970 +0000 +| | summary: (33) head +| |