changeset 740:a46cd7139699

git_handler: set substate to None to cope with Mercurial changes
author Siddharth Agarwal <sid0@fb.com>
date Tue, 17 Jun 2014 14:17:49 -0700
parents e034e5196d6c
children b61ef156f4b5
files hggit/git_handler.py
diffstat 1 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hggit/git_handler.py
+++ b/hggit/git_handler.py
@@ -837,6 +837,8 @@
                 ctx = context.memctx(self.repo, (p1, p2), text,
                                      list(files) + findconvergedfiles(p1, p2),
                                      getfilectx, author, date, {'hg-git': 'octopus'})
+                # See comment below about setting substate to None.
+                ctx.substate = None
                 return hex(self.repo.commitctx(ctx))
 
             octopus = len(gparents) > 2
@@ -878,7 +880,14 @@
         ctx = context.memctx(self.repo, (p1, p2), text,
                              list(files) + findconvergedfiles(p1, p2),
                              getfilectx, author, date, extra)
-
+        # Starting Mercurial commit d2743be1bb06, memctx imports from
+        # committablectx. This means that it has a 'substate' property that
+        # contains the subrepo state. Ordinarily, Mercurial expects the subrepo
+        # to be present while making a new commit -- since hg-git is importing
+        # purely in-memory commits without backing stores for the subrepos, that
+        # won't work. Forcibly set the substate to None so that there's no
+        # attempt to read subrepos.
+        ctx.substate = None
         node = self.repo.commitctx(ctx)
 
         self.swap_out_encoding(oldenc)