Mercurial > hg-stable
diff mercurial/util.py @ 6762:f67d1468ac50
util: add sort helper
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Fri, 27 Jun 2008 18:28:45 -0500 |
parents | 1dca460e7d1e |
children | c016dc1a8e91 |
line wrap: on
line diff
--- a/mercurial/util.py Fri Jun 27 14:53:30 2008 -0500 +++ b/mercurial/util.py Fri Jun 27 18:28:45 2008 -0500 @@ -252,6 +252,12 @@ """return the uniq elements of iterable g""" return dict.fromkeys(g).keys() +def sort(l): + if not isinstance(l, list): + l = list(l) + l.sort() + return l + class Abort(Exception): """Raised if a command needs to print an error and exit."""