comparison 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
comparison
equal deleted inserted replaced
6761:cb981fc955fb 6762:f67d1468ac50
249 return False 249 return False
250 250
251 def unique(g): 251 def unique(g):
252 """return the uniq elements of iterable g""" 252 """return the uniq elements of iterable g"""
253 return dict.fromkeys(g).keys() 253 return dict.fromkeys(g).keys()
254
255 def sort(l):
256 if not isinstance(l, list):
257 l = list(l)
258 l.sort()
259 return l
254 260
255 class Abort(Exception): 261 class Abort(Exception):
256 """Raised if a command needs to print an error and exit.""" 262 """Raised if a command needs to print an error and exit."""
257 263
258 class UnexpectedOutput(Abort): 264 class UnexpectedOutput(Abort):