mercurial/util.py
changeset 3568 23f7d9621783
parent 3550 eda9e7c9300d
parent 3566 4d97184a06ad
child 3632 4cfb72bcb978
equal deleted inserted replaced
3553:3bab1fc0ab75 3568:23f7d9621783
   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 class UnexpectedOutput(Abort):
   141 class UnexpectedOutput(Abort):
   983     if f >= 0:
   985     if f >= 0:
   984         user = user[f+1:]
   986         user = user[f+1:]
   985     f = user.find(' ')
   987     f = user.find(' ')
   986     if f >= 0:
   988     if f >= 0:
   987         user = user[:f]
   989         user = user[:f]
       
   990     f = user.find('.')
       
   991     if f >= 0:
       
   992         user = user[:f]
   988     return user
   993     return user
   989 
   994 
   990 def walkrepos(path):
   995 def walkrepos(path):
   991     '''yield every hg repository under path, recursively.'''
   996     '''yield every hg repository under path, recursively.'''
   992     def errhandler(err):
   997     def errhandler(err):