comparison mercurial/util.py @ 3535:4d97184a06ad

Make util.unique return a list
author Matt Mackall <mpm@selenic.com>
date Fri, 27 Oct 2006 14:06:32 -0500
parents bb44489b901f
children 23f7d9621783
comparison
equal deleted inserted replaced
3534:549cb7b640fb 3535:4d97184a06ad
126 return False 126 return False
127 127
128 def unique(g): 128 def unique(g):
129 """return the uniq elements of iterable g""" 129 """return the uniq elements of iterable g"""
130 seen = {} 130 seen = {}
131 l = []
131 for f in g: 132 for f in g:
132 if f not in seen: 133 if f not in seen:
133 seen[f] = 1 134 seen[f] = 1
134 yield f 135 l.append(f)
136 return l
135 137
136 class Abort(Exception): 138 class Abort(Exception):
137 """Raised if a command needs to print an error and exit.""" 139 """Raised if a command needs to print an error and exit."""
138 140
139 def always(fn): return True 141 def always(fn): return True