[PATCH 3 of 5] subrepo: fix git archive parsing of directories and symfiles

Eric Eisner ede at MIT.EDU
Mon Dec 20 13:11:09 CST 2010


# HG changeset patch
# User Eric Eisner <ede at mit.edu>
# Date 1292871573 18000
# Node ID a79e0688a5ee2a17d500b178d6ebd8e73ef6f1af
# Parent  b512a7074349121fd602b85379ed4cba0aa49214
subrepo: fix git archive parsing of directories and symfiles

diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py
--- a/mercurial/subrepo.py
+++ b/mercurial/subrepo.py
@@ -886,9 +886,14 @@ class gitsubrepo(abstractsubrepo):
         relpath = subrelpath(self)
         ui.progress(_('archiving (%s)') % relpath, 0, unit=_('files'))
         for i, info in enumerate(tar):
+            if info.isdir():
+                continue
+            if info.issym():
+                data = info.linkname
+            else:
+                data = tar.extractfile(info).read()
             archiver.addfile(os.path.join(prefix, self._relpath, info.name),
-                             info.mode, info.issym(),
-                             tar.extractfile(info).read())
+                             info.mode, info.issym(), data)
             ui.progress(_('archiving (%s)') % relpath, i + 1,
                         unit=_('files'))
         ui.progress(_('archiving (%s)') % relpath, None)


More information about the Mercurial-devel mailing list