Mercurial > hg > hg-git
diff hggit/git_handler.py @ 282:8655c071a15d
make sure no tag object are included in the DAG we build
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Wed, 24 Feb 2010 17:21:20 +0100 |
parents | 8aff8c9d04d7 |
children | 90458271e374 |
line wrap: on
line diff
--- a/hggit/git_handler.py +++ b/hggit/git_handler.py @@ -354,14 +354,21 @@ convert_list = {} # get a list of all the head shas + seenheads = set() + if refs is None: + refs = self.git.refs if refs: - for head, sha in refs.iteritems(): - # refs contains all the refs in the server, not just the ones - # we are pulling - if sha in self.git.object_store: - todo.append(sha) - else: - todo = self.git.refs.values()[:] + for sha in refs.itervalues(): + # refs contains all the refs in the server, not just the ones + # we are pulling + if sha in self.git.object_store: + obj = self.git.get_object(sha) + while isinstance(obj, Tag): + obj_type, sha = obj.get_object() + obj = self.git.get_object(sha) + if isinstance (obj, Commit) and sha not in seenheads: + seenheads.add(sha) + todo.append(sha) # traverse the heads getting a list of all the unique commits while todo: @@ -371,15 +378,9 @@ continue done.add(sha) obj = self.git.get_object(sha) - if isinstance (obj, Commit): - convert_list[sha] = obj - todo.extend([p for p in obj.parents if p not in done]) - if isinstance(obj, Tag): - (obj_type, obj_sha) = obj.get_object() - obj = self.git.get_object(obj_sha) - if isinstance (obj, Commit): - convert_list[sha] = obj - todo.extend([p for p in obj.parents if p not in done]) + assert isinstance(obj, Commit) + convert_list[sha] = obj + todo.extend([p for p in obj.parents if p not in done]) # sort the commits commits = toposort.TopoSort(convert_list).items()