hgext/hbisect.py
changeset 5727 1325ebc29e29
parent 5726 19cbe2aea2bc
child 5728 f3374025fe09
equal deleted inserted replaced
5726:19cbe2aea2bc 5727:1325ebc29e29
     6 # This software may be used and distributed according to the terms
     6 # This software may be used and distributed according to the terms
     7 # of the GNU General Public License, incorporated herein by reference.
     7 # of the GNU General Public License, incorporated herein by reference.
     8 
     8 
     9 from mercurial.i18n import _
     9 from mercurial.i18n import _
    10 from mercurial import hg, util, commands, cmdutil
    10 from mercurial import hg, util, commands, cmdutil
    11 import os, sys
    11 import os, sys, array
    12 
    12 
    13 class bisect(object):
    13 class bisect(object):
    14     """dichotomic search in the DAG of changesets"""
    14     """dichotomic search in the DAG of changesets"""
    15     def __init__(self, ui, repo):
    15     def __init__(self, ui, repo):
    16         self.repo = repo
    16         self.repo = repo
   102                     if a2:
   102                     if a2:
   103                         # merge ancestor lists
   103                         # merge ancestor lists
   104                         a = dict.fromkeys(a2)
   104                         a = dict.fromkeys(a2)
   105                         a.update(dict.fromkeys(a1))
   105                         a.update(dict.fromkeys(a1))
   106                         a[rev] = None
   106                         a[rev] = None
   107                         ancestors[rev] = a.keys()
   107                         ancestors[rev] = array.array("l", a.keys())
   108                     else:
   108                     else:
   109                         ancestors[rev] = a1 + [rev]
   109                         ancestors[rev] = a1 + array.array("l", [rev])
   110                 elif a2:
   110                 elif a2:
   111                     ancestors[rev] = a2 + [rev]
   111                     ancestors[rev] = a2 + array.array("l", [rev])
   112                 else:
   112                 else:
   113                     ancestors[rev] = [rev]
   113                     ancestors[rev] = array.array("l", [rev])
   114 
   114 
   115         if badrev not in ancestors[badrev]:
   115         if badrev not in ancestors[badrev]:
   116             raise util.Abort(_("Could not find the first bad revision"))
   116             raise util.Abort(_("Could not find the first bad revision"))
   117 
   117 
   118         # have we narrowed it down to one entry?
   118         # have we narrowed it down to one entry?