mercurial/commands.py
branchstable
changeset 10479 bb508b312359
parent 10448 6e5a47398fc5
child 10505 b3311e26f94f
equal deleted inserted replaced
10477:44b4a2a31623 10479:bb508b312359
   535         has = set((nullid,))
   535         has = set((nullid,))
   536         for n in base:
   536         for n in base:
   537             has.update(repo.changelog.reachable(n))
   537             has.update(repo.changelog.reachable(n))
   538         if revs:
   538         if revs:
   539             visit = list(revs)
   539             visit = list(revs)
       
   540             has.difference_update(revs)
   540         else:
   541         else:
   541             visit = repo.changelog.heads()
   542             visit = repo.changelog.heads()
   542         seen = {}
   543         seen = {}
   543         while visit:
   544         while visit:
   544             n = visit.pop(0)
   545             n = visit.pop(0)
   545             parents = [p for p in repo.changelog.parents(n) if p not in has]
   546             parents = [p for p in repo.changelog.parents(n) if p not in has]
   546             if len(parents) == 0:
   547             if len(parents) == 0:
   547                 o.insert(0, n)
   548                 if n not in has:
       
   549                     o.append(n)
   548             else:
   550             else:
   549                 for p in parents:
   551                 for p in parents:
   550                     if p not in seen:
   552                     if p not in seen:
   551                         seen[p] = 1
   553                         seen[p] = 1
   552                         visit.append(p)
   554                         visit.append(p)