Skip to content

Commit

Permalink
Keep commit sha1s instead of marks
Browse files Browse the repository at this point in the history
  • Loading branch information
glandium committed Dec 18, 2016
1 parent 971728f commit 33abd24
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
4 changes: 2 additions & 2 deletions cinnabar/git.py
Expand Up @@ -469,10 +469,10 @@ def commit(self, ref, committer=('<cinnabar@git>', 0, 0), author=None,
yield helper yield helper


self.write('\n') self.write('\n')
helper.sha1 = self.get_mark(mark)
self._done = False self._done = False
if mark: if mark:
Git._refs[ref] = Mark(mark) Git._refs[ref] = helper.sha1
assert Git._refs.values().count(mark) == 1
else: else:
del Git._refs[ref] del Git._refs[ref]


Expand Down
16 changes: 6 additions & 10 deletions cinnabar/githg.py
Expand Up @@ -1230,14 +1230,12 @@ def store_changeset(self, instance, commit=None, track_heads=True):
if tree != EMPTY_TREE: if tree != EMPTY_TREE:
c.filemodify('', tree, typ='tree') c.filemodify('', tree, typ='tree')


mark = Mark(mark) if (c.sha1 in self._changesets or
generated_sha1 = self._fast_import.get_mark(mark) self.hg_changeset(c.sha1)):
if (generated_sha1 in self._changesets or
self.hg_changeset(generated_sha1)):
body += '\0' body += '\0'
continue continue
break break
commit = GitCommit(generated_sha1) commit = GitCommit(c.sha1)


self._changesets[instance.node] = commit.sha1 self._changesets[instance.node] = commit.sha1
data = self._changeset_data_cache[commit.sha1] = { data = self._changeset_data_cache[commit.sha1] = {
Expand Down Expand Up @@ -1302,13 +1300,11 @@ def store_manifest(self, instance):
commit.filemodify('git/%s' % name, commit.filemodify('git/%s' % name,
self.git_file_ref(node), typ=self.TYPE[attr]) self.git_file_ref(node), typ=self.TYPE[attr])


mark = Mark(mark) self._manifests[instance.node] = commit.sha1
self._manifests[instance.node] = mark self._manifest_dag.add(commit.sha1, parents)
self._manifest_dag.add(mark, parents)


if check_enabled('manifests'): if check_enabled('manifests'):
mn = self._fast_import.get_mark(mark) if not GitHgHelper.check_manifest('git:%s' % commit.sha1):
if not GitHgHelper.check_manifest('git:%s' % mn):
raise Exception( raise Exception(
'sha1 mismatch for node %s with parents %s %s and ' 'sha1 mismatch for node %s with parents %s %s and '
'previous %s' % 'previous %s' %
Expand Down
3 changes: 1 addition & 2 deletions cinnabar/hg/bundle.py
Expand Up @@ -279,9 +279,8 @@ def create_hg_metadata(self, commit, parents):
if str(created) != str(real): if str(created) != str(real):
logging.error('%r != %r', str(created), str(real)) logging.error('%r != %r', str(created), str(real))
self._push_manifests[manifest.node] = manifest 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.store_manifest(manifest)
self._manifests[manifest.node] = Mark(mark)
self._manifest_git_tree[manifest.node] = commit_data.tree self._manifest_git_tree[manifest.node] = commit_data.tree


extra = {} extra = {}
Expand Down

0 comments on commit 33abd24

Please sign in to comment.