Mercurial > public > mercurial-scm > hg
diff mercurial/subrepo.py @ 12323:f00953d9533c
subrepo: add support for 'hg archive'
author | Martin Geisler <mg@aragost.com> |
---|---|
date | Mon, 20 Sep 2010 15:46:17 +0200 |
parents | 510afb31cf99 |
children | b4711585a455 |
line wrap: on
line diff
--- a/mercurial/subrepo.py Mon Sep 20 15:44:30 2010 +0200 +++ b/mercurial/subrepo.py Mon Sep 20 15:46:17 2010 +0200 @@ -282,6 +282,15 @@ """return file flags""" return '' + def archive(self, archiver, prefix): + for name in self.files(): + flags = self.fileflags(name) + mode = 'x' in flags and 0755 or 0644 + symlink = 'l' in flags + archiver.addfile(os.path.join(prefix, self._path, name), + mode, symlink, self.filedata(name)) + + class hgsubrepo(abstractsubrepo): def __init__(self, ctx, path, state): self._path = path @@ -341,6 +350,15 @@ self._repo.ui.warn(_("warning: %s in %s\n") % (inst, relpath(self))) + def archive(self, archiver, prefix): + abstractsubrepo.archive(self, archiver, prefix) + + rev = self._state[1] + ctx = self._repo[rev] + for subpath in ctx.substate: + s = subrepo(ctx, subpath) + s.archive(archiver, os.path.join(prefix, self._path)) + def dirty(self): r = self._state[1] if r == '':