mercurial/util.py
changeset 8151 127281884959
parent 8150 bbc24c0753a0
child 8181 03d93882fc93
equal deleted inserted replaced
8150:bbc24c0753a0 8151:127281884959
   216     return pipefilter(s, cmd)
   216     return pipefilter(s, cmd)
   217 
   217 
   218 def binary(s):
   218 def binary(s):
   219     """return true if a string is binary data"""
   219     """return true if a string is binary data"""
   220     return bool(s and '\0' in s)
   220     return bool(s and '\0' in s)
   221 
       
   222 def unique(g):
       
   223     """return the uniq elements of iterable g"""
       
   224     return dict.fromkeys(g).keys()
       
   225 
   221 
   226 def sort(l):
   222 def sort(l):
   227     if not isinstance(l, list):
   223     if not isinstance(l, list):
   228         l = list(l)
   224         l = list(l)
   229     l.sort()
   225     l.sort()