Permalink
Browse files

Make FastImport.put_blob return the sha1 of the object

And use that everywhere the method is used.
  • Loading branch information...
glandium committed Dec 18, 2016
1 parent 3e65274 commit 32d85e5350257e8e44a25abbcb0681b167b1f3f2
Showing with 9 additions and 12 deletions.
  1. +3 −0 cinnabar/git.py
  2. +5 −9 cinnabar/githg.py
  3. +1 −3 cinnabar/hg/bundle.py
View
@@ -413,9 +413,12 @@ def cmd_data(self, data):
def put_blob(self, data='', mark=0):
self.write('blob\n')
if mark == 0:
mark = self.new_mark()
self.cmd_mark(mark)
self.cmd_data(data)
self._done = False
return self.get_mark(mark)
@staticmethod
def _format_committer(author):
View
@@ -1293,14 +1293,11 @@ def store_file(self, instance):
if mark:
return
data = instance.data
mark = self._fast_import.new_mark()
self._fast_import.put_blob(data=data, mark=mark)
self._files[instance.node] = self._fast_import.get_mark(mark)
self._files[instance.node] = self._fast_import.put_blob(data=data)
if data.startswith('\1\n'):
data = self._prepare_git_file(instance.data)
mark = self._fast_import.new_mark()
self._fast_import.put_blob(data=data, mark=mark)
self._git_files[instance.node] = self._fast_import.get_mark(mark)
self._git_files[instance.node] = self._fast_import.put_blob(
data=data)
def _prepare_git_file(self, data):
assert data.startswith('\1\n')
@@ -1446,9 +1443,8 @@ def tagset_lines(tags):
for f, tags in self._tags.iteritems():
if f not in self._tagfiles and f != NULL_NODE_ID:
data = ''.join(tagset_lines(tags))
mark = self._fast_import.new_mark()
self._fast_import.put_blob(data=data, mark=mark)
created[f] = (Mark(mark), 'exec')
mark = self._fast_import.put_blob(data=data)
created[f] = (mark, 'exec')
if created or deleted:
self.tag_changes = True
View
@@ -371,9 +371,7 @@ def create_copy(self, hg_source, sha1, git_manifest_parents=None,
path=path)
node = hg_file.node = hg_file.sha1
self._push_files[node] = hg_file
mark = self._fast_import.new_mark()
self._fast_import.put_blob(data=hg_file.data, mark=mark)
self._files[node] = self._fast_import.get_mark(mark)
self._files[node] = self._fast_import.put_blob(data=hg_file.data)
self._git_files.setdefault(node, sha1)
return node

0 comments on commit 32d85e5

Please sign in to comment.