mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 16:57:49 +03:00
git2hg.find_incoming: move graph traversal into a function
This is preparation for upcoming changes to find_incoming that will allow it to import certain Git branches as Mercurial named branches.
This commit is contained in:
parent
39849eaa29
commit
e38779118a
@ -36,10 +36,11 @@ def find_incoming(git_object_store, git_map, refs):
|
||||
todo.sort(key=commitdate, reverse=True)
|
||||
return todo
|
||||
|
||||
todo = get_heads(refs)
|
||||
def get_unseen_commits(todo):
|
||||
'''get all unseen commits reachable from todo in topological order
|
||||
|
||||
# traverse the heads getting a list of all the unique commits in
|
||||
# topological order
|
||||
'unseen' means not reachable from the done set and not in the git map.
|
||||
Mutates todo and the done set in the process.'''
|
||||
commits = []
|
||||
while todo:
|
||||
sha = todo[-1]
|
||||
@ -64,6 +65,11 @@ def find_incoming(git_object_store, git_map, refs):
|
||||
done.add(sha)
|
||||
todo.pop()
|
||||
|
||||
return commits
|
||||
|
||||
todo = get_heads(refs)
|
||||
commits = get_unseen_commits(todo)
|
||||
|
||||
return GitIncomingResult(commits, commit_cache)
|
||||
|
||||
class GitIncomingResult(object):
|
||||
|
Loading…
Reference in New Issue
Block a user