Mercurial > hg > hg-git
changeset 638:23d7caeed05a
hg2git: store ctx instead of rev
Storing a ctx enables values like manifests to be cached on the context.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Wed, 12 Feb 2014 17:49:14 -0800 |
parents | 0ab89bd32c8e |
children | f828d82c35dc |
files | hggit/hg2git.py |
diffstat | 1 files changed, 5 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/hggit/hg2git.py +++ b/hggit/hg2git.py @@ -7,6 +7,7 @@ import dulwich.objects as dulobjs import mercurial.node +import mercurial.context import util @@ -52,8 +53,8 @@ """Create an instance against a mercurial.localrepo.""" self._hg = hg_repo - # Our current revision. - self._rev = mercurial.node.nullrev + # Our current revision's context. + self._ctx = mercurial.context.changectx(hg_repo, 'null') # Path to dulwich.objects.Tree. self._dirs = {} @@ -104,7 +105,7 @@ # The only reliable way to get the full set of changes is by looking at # the full manifest. And, the easy way to compare two manifests is # localrepo.status(). - modified, added, removed = self._hg.status(self._rev, newctx.rev())[0:3] + modified, added, removed = self._hg.status(self._ctx, newctx.rev())[0:3] # We track which directories/trees have modified in this update and we # only export those. @@ -160,7 +161,7 @@ for obj in self._populate_tree_entries(dirty_trees): yield (obj, None) - self._rev = newctx.rev() + self._ctx = newctx def _remove_tree(self, path): """Remove a (presumably empty) tree from the current changeset.