comparison hgext/graphlog.py @ 14319:b33f3e35efb0

scmutil: move revsingle/pair/range from cmdutil This allows users at levels below the command layer to avoid import loops.
author Matt Mackall <mpm@selenic.com>
date Fri, 13 May 2011 14:06:28 -0500
parents 9bbac962f4dd
children 253bda94372e
comparison
equal deleted inserted replaced
14318:1f46be4689ed 14319:b33f3e35efb0
10 This extension adds a --graph option to the incoming, outgoing and log 10 This extension adds a --graph option to the incoming, outgoing and log
11 commands. When this options is given, an ASCII representation of the 11 commands. When this options is given, an ASCII representation of the
12 revision graph is also shown. 12 revision graph is also shown.
13 ''' 13 '''
14 14
15 from mercurial.cmdutil import revrange, show_changeset 15 from mercurial.cmdutil import show_changeset
16 from mercurial.commands import templateopts 16 from mercurial.commands import templateopts
17 from mercurial.i18n import _ 17 from mercurial.i18n import _
18 from mercurial.node import nullrev 18 from mercurial.node import nullrev
19 from mercurial import cmdutil, commands, extensions 19 from mercurial import cmdutil, commands, extensions, scmutil
20 from mercurial import hg, util, graphmod 20 from mercurial import hg, util, graphmod
21 21
22 cmdtable = {} 22 cmdtable = {}
23 command = cmdutil.command(cmdtable) 23 command = cmdutil.command(cmdtable)
24 24
225 state[0] = coldiff 225 state[0] = coldiff
226 state[1] = idx 226 state[1] = idx
227 227
228 def get_revs(repo, rev_opt): 228 def get_revs(repo, rev_opt):
229 if rev_opt: 229 if rev_opt:
230 revs = revrange(repo, rev_opt) 230 revs = scmutil.revrange(repo, rev_opt)
231 if len(revs) == 0: 231 if len(revs) == 0:
232 return (nullrev, nullrev) 232 return (nullrev, nullrev)
233 return (max(revs), min(revs)) 233 return (max(revs), min(revs))
234 else: 234 else:
235 return (len(repo) - 1, 0) 235 return (len(repo) - 1, 0)
322 directory. 322 directory.
323 """ 323 """
324 324
325 check_unsupported_flags(pats, opts) 325 check_unsupported_flags(pats, opts)
326 326
327 revs = sorted(revrange(repo, [revset(pats, opts)]), reverse=1) 327 revs = sorted(scmutil.revrange(repo, [revset(pats, opts)]), reverse=1)
328 limit = cmdutil.loglimit(opts) 328 limit = cmdutil.loglimit(opts)
329 if limit is not None: 329 if limit is not None:
330 revs = revs[:limit] 330 revs = revs[:limit]
331 revdag = graphmod.dagwalker(repo, revs) 331 revdag = graphmod.dagwalker(repo, revs)
332 332