##// END OF EJS Templates
graphmod/graphlog: extract nodelistwalk
Peter Arrenbrecht -
r8837:d8e3a980 default
parent child Browse files
Show More
@@ -12,7 +12,7 b' commands. When this options is given, an'
12 revision graph is also shown.
12 revision graph is also shown.
13 '''
13 '''
14
14
15 import os
15 import os, sys
16 from mercurial.cmdutil import revrange, show_changeset
16 from mercurial.cmdutil import revrange, show_changeset
17 from mercurial.commands import templateopts
17 from mercurial.commands import templateopts
18 from mercurial.i18n import _
18 from mercurial.i18n import _
@@ -252,17 +252,11 b' def graphlog(ui, repo, path=None, **opts'
252 ascii(ui, grapher(graphdag))
252 ascii(ui, grapher(graphdag))
253
253
254 def graphrevs(repo, nodes, opts):
254 def graphrevs(repo, nodes, opts):
255 include = set(nodes)
256 limit = cmdutil.loglimit(opts)
255 limit = cmdutil.loglimit(opts)
257 count = 0
256 nodes.reverse()
258 for node in reversed(nodes):
257 if limit < sys.maxint:
259 if count >= limit:
258 nodes = nodes[:limit]
260 break
259 return graphmod.nodes(repo, nodes)
261 ctx = repo[node]
262 parents = [p.rev() for p in ctx.parents() if p.node() in include]
263 parents.sort()
264 yield (ctx, parents)
265 count += 1
266
260
267 def graphabledag(ui, repo, revdag, opts):
261 def graphabledag(ui, repo, revdag, opts):
268 showparents = [ctx.node() for ctx in repo[None].parents()]
262 showparents = [ctx.node() for ctx in repo[None].parents()]
@@ -42,6 +42,14 b' def filerevs(repo, path, start, stop):'
42 break
42 break
43 filerev -= 1
43 filerev -= 1
44
44
45 def nodes(repo, nodes):
46 include = set(nodes)
47 for node in nodes:
48 ctx = repo[node]
49 parents = [p.rev() for p in ctx.parents() if p.node() in include]
50 parents.sort()
51 yield (ctx, parents)
52
45 def graph(repo, start_rev, stop_rev):
53 def graph(repo, start_rev, stop_rev):
46 """incremental revision grapher
54 """incremental revision grapher
47
55
General Comments 0
You need to be logged in to leave comments. Login now