bzr export should set timestamps of exported files/dirs

Registered by goto

bzr export either doesn't set timestamps for exported files, or sets them to 'now'. probably it should set all the files/directories to their own timestamps (whatever it's set to in the exported revision) and the top-level directory or tgz/zip package to the timestamp of the revision itself.

Blueprint information

Status:
Not started
Approver:
None
Priority:
Undefined
Drafter:
None
Direction:
Needs approval
Assignee:
None
Definition:
New
Series goal:
None
Implementation:
Unknown
Milestone target:
None

Related branches

Sprints

Whiteboard

this'll do it for tgz and directory exports
--------------------------------------------------------------------------
diff -Naur bzr-0.16/bzrlib/inventory.py bzr-0.16-patched/bzrlib/inventory.py
--- bzr-0.16/bzrlib/inventory.py 2007-05-07 06:12:45.000000000 -0700
+++ bzr-0.16-patched/bzrlib/inventory.py 2007-06-15 21:03:57.484375000 -0700
@@ -254,9 +254,7 @@
     def get_tar_item(self, root, dp, now, tree):
         """Get a tarfile item and a file stream for its content."""
         item = tarfile.TarInfo(osutils.pathjoin(root, dp).encode('utf8'))
- # TODO: would be cool to actually set it to the timestamp of the
- # revision it was last changed
- item.mtime = now
+ item.mtime = tree.get_file_mtime(self.file_id)
         fileobj = self._put_in_tar(item, tree)
         return item, fileobj

@@ -323,6 +321,8 @@
         """
         fullpath = osutils.pathjoin(dest, dp)
         self._put_on_disk(fullpath, tree)
+ mtime = tree.get_file_mtime(self.file_id)
+ os.utime(fullpath, (mtime, mtime))
         # mutter(" export {%s} kind %s to %s", self.file_id,
         # self.kind, fullpath)

--------------------------------------------------------------------------

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.