Exemplo n.º 1
0
	def new(cls, repo, *tree_sha):
		""" Merge the given treeish revisions into a new index which is returned.
		This method behaves like git-read-tree --aggressive when doing the merge.

		:param repo: The repository treeish are located in.

		:param tree_sha:
			20 byte or 40 byte tree sha or tree objects 

		:return:
			New IndexFile instance. Its path will be undefined. 
			If you intend to write such a merged Index, supply an alternate file_path 
			to its 'write' method."""
		base_entries = aggressive_tree_merge(repo.odb, [to_bin_sha(str(t)) for t in tree_sha])
		
		inst = cls(repo)
		# convert to entries dict
		entries = dict(izip(((e.path, e.stage) for e in base_entries), 
							(IndexEntry.from_base(e) for e in base_entries)))
		
		inst.entries = entries
		return inst
Exemplo n.º 2
0
	def new(cls, repo, *tree_sha):
		""" Merge the given treeish revisions into a new index which is returned.
		This method behaves like git-read-tree --aggressive when doing the merge.

		:param repo: The repository treeish are located in.

		:param tree_sha:
			20 byte or 40 byte tree sha or tree objects 

		:return:
			New IndexFile instance. Its path will be undefined. 
			If you intend to write such a merged Index, supply an alternate file_path 
			to its 'write' method."""
		base_entries = aggressive_tree_merge(repo.odb, [to_bin_sha(str(t)) for t in tree_sha])
		
		inst = cls(repo)
		# convert to entries dict
		entries = dict(izip(((e.path, e.stage) for e in base_entries), 
							(IndexEntry.from_base(e) for e in base_entries)))
		
		inst.entries = entries
		return inst