# HG changeset patch # User James May # Date 2017-12-01 06:39:21 # Node ID 760fef6aca748bc7000e413082486e54e0569863 # Parent ec71518acd4a5da928c2108274144305528d6fdb archive: pass thru mtime for directory archives, like other archive types do Without this files in the output archive directory have their mtimes set to whatever time they were written their. This is in this inconsistent with the other archivers, eg. zip, which use exactly the same time for all files. Works on my machine (Windows), but I don't have a *nix box available to run anything more thorough, unfortunately. diff --git a/mercurial/archival.py b/mercurial/archival.py --- a/mercurial/archival.py +++ b/mercurial/archival.py @@ -262,6 +262,7 @@ class fileit(object): def __init__(self, name, mtime): self.basedir = name self.opener = vfsmod.vfs(self.basedir) + self.mtime = mtime def addfile(self, name, mode, islink, data): if islink: @@ -272,6 +273,8 @@ class fileit(object): f.close() destfile = os.path.join(self.basedir, name) os.chmod(destfile, mode) + if self.mtime is not None: + os.utime(destfile, (self.mtime, self.mtime)) def done(self): pass @@ -299,7 +302,12 @@ def archive(repo, dest, node, kind, deco matchfn is function to filter names of files to write to archive. - prefix is name of path to put before every archive member.''' + prefix is name of path to put before every archive member. + + mtime is the modified time, in seconds, or None to use the changeset time. + + subrepos tells whether to include subrepos. + ''' if kind == 'files': if prefix: