Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/cmdutil.py @ 32561:9f56d462634c
cmdutil: use sorted(dict) instead of x = dict.keys(); x.sort()
The former both does less work and has the virtue of working on Python 3.
author | Augie Fackler <raf@durin42.com> |
---|---|
date | Sun, 28 May 2017 14:02:14 -0400 |
parents | 69c864149d69 |
children | 2dd8d4108249 |
comparison
equal
deleted
inserted
replaced
32560:47ce079b1afa | 32561:9f56d462634c |
---|---|
447 | 447 |
448 if cmd in choice: | 448 if cmd in choice: |
449 return choice[cmd] | 449 return choice[cmd] |
450 | 450 |
451 if len(choice) > 1: | 451 if len(choice) > 1: |
452 clist = choice.keys() | 452 clist = sorted(choice) |
453 clist.sort() | |
454 raise error.AmbiguousCommand(cmd, clist) | 453 raise error.AmbiguousCommand(cmd, clist) |
455 | 454 |
456 if choice: | 455 if choice: |
457 return choice.values()[0] | 456 return choice.values()[0] |
458 | 457 |