##// END OF EJS Templates
import-checker: fix rotatecycle...
Matt Mackall -
r24487:642d245f default
parent child Browse files
Show More
@@ -191,7 +191,7 b' def rotatecycle(cycle):'
191 """
191 """
192 lowest = min(cycle)
192 lowest = min(cycle)
193 idx = cycle.index(lowest)
193 idx = cycle.index(lowest)
194 return cycle[idx:] + cycle[1:idx] + [lowest]
194 return cycle[idx:-1] + cycle[:idx] + [lowest]
195
195
196 def find_cycles(imports):
196 def find_cycles(imports):
197 """Find cycles in an already-loaded import graph.
197 """Find cycles in an already-loaded import graph.
@@ -201,8 +201,8 b' def find_cycles(imports):'
201 ... 'top.baz': ['foo'],
201 ... 'top.baz': ['foo'],
202 ... 'top.qux': ['foo']}
202 ... 'top.qux': ['foo']}
203 >>> print '\\n'.join(sorted(find_cycles(imports)))
203 >>> print '\\n'.join(sorted(find_cycles(imports)))
204 top.bar -> top.baz -> top.foo -> top.bar -> top.bar
204 top.bar -> top.baz -> top.foo -> top.bar
205 top.foo -> top.qux -> top.foo -> top.foo
205 top.foo -> top.qux -> top.foo
206 """
206 """
207 cycles = {}
207 cycles = {}
208 for mod in sorted(imports.iterkeys()):
208 for mod in sorted(imports.iterkeys()):
@@ -39,4 +39,4 b' these may expose other cycles.'
39 mercurial/ui.py mixed imports
39 mercurial/ui.py mixed imports
40 stdlib: formatter
40 stdlib: formatter
41 relative: config, error, scmutil, util
41 relative: config, error, scmutil, util
42 Import cycle: mercurial.cmdutil -> mercurial.context -> mercurial.subrepo -> mercurial.cmdutil -> mercurial.cmdutil
42 Import cycle: mercurial.cmdutil -> mercurial.context -> mercurial.subrepo -> mercurial.cmdutil
General Comments 0
You need to be logged in to leave comments. Login now