Permalink
Browse files

Keep commit sha1s instead of marks

  • Loading branch information...
glandium committed Dec 18, 2016
1 parent 971728f commit 33abd245ec2a47bb3173adcb1985de965ddcb6c4
Showing with 9 additions and 14 deletions.
  1. +2 −2 cinnabar/git.py
  2. +6 −10 cinnabar/githg.py
  3. +1 −2 cinnabar/hg/bundle.py
View
@@ -469,10 +469,10 @@ def commit(self, ref, committer=('<cinnabar@git>', 0, 0), author=None,
yield helper
self.write('\n')
helper.sha1 = self.get_mark(mark)
self._done = False
if mark:
Git._refs[ref] = Mark(mark)
assert Git._refs.values().count(mark) == 1
Git._refs[ref] = helper.sha1
else:
del Git._refs[ref]
View
@@ -1230,14 +1230,12 @@ def store_changeset(self, instance, commit=None, track_heads=True):
if tree != EMPTY_TREE:
c.filemodify('', tree, typ='tree')
mark = Mark(mark)
generated_sha1 = self._fast_import.get_mark(mark)
if (generated_sha1 in self._changesets or
self.hg_changeset(generated_sha1)):
if (c.sha1 in self._changesets or
self.hg_changeset(c.sha1)):
body += '\0'
continue
break
commit = GitCommit(generated_sha1)
commit = GitCommit(c.sha1)
self._changesets[instance.node] = commit.sha1
data = self._changeset_data_cache[commit.sha1] = {
@@ -1302,13 +1300,11 @@ def store_manifest(self, instance):
commit.filemodify('git/%s' % name,
self.git_file_ref(node), typ=self.TYPE[attr])
mark = Mark(mark)
self._manifests[instance.node] = mark
self._manifest_dag.add(mark, parents)
self._manifests[instance.node] = commit.sha1
self._manifest_dag.add(commit.sha1, parents)
if check_enabled('manifests'):
mn = self._fast_import.get_mark(mark)
if not GitHgHelper.check_manifest('git:%s' % mn):
if not GitHgHelper.check_manifest('git:%s' % commit.sha1):
raise Exception(
'sha1 mismatch for node %s with parents %s %s and '
'previous %s' %
View
@@ -279,9 +279,8 @@ def create_hg_metadata(self, commit, parents):
if str(created) != str(real):
logging.error('%r != %r', str(created), str(real))
self._push_manifests[manifest.node] = manifest
mark = self.manifest_ref(manifest.node, hg2git=False, create=True)
self.manifest_ref(manifest.node, hg2git=False, create=True)
self.store_manifest(manifest)
self._manifests[manifest.node] = Mark(mark)
self._manifest_git_tree[manifest.node] = commit_data.tree
extra = {}

0 comments on commit 33abd24

Please sign in to comment.