d153586c28f8 — Gregory Szorc 8 years ago
git_handler: properly handle paths when files converge

filectx.renamed() returns a 2-tuple or None. memfilectx.__init__ expects
the copied argument to be either None or a string. Before, we were
passing a 2-tuple, leading to the memfilectx storing the wrong type.
This eventually resulted in doing a key lookup against a manifest
with a 2-tuple, which made manifest.c throw an error.
1 files changed, 4 insertions(+), 1 deletions(-)

M hggit/git_handler.py
M hggit/git_handler.py +4 -1
@@ 866,7 866,10 @@ class GitHandler(object):
                 fc = context.filectx(self.repo, f, changeid=memctx.p1().rev())
                 data = fc.data()
                 e = fc.flags()
-                copied_path = fc.renamed()
+                copied_path = None
+                copied = fc.renamed()
+                if copied:
+                    copied_path = copied[0]
 
             try:
                 return context.memfilectx(self.repo, f, data,