Rev 5164: (lifeless) When writing temporary files for external diff do not set the file utime if we don't know when the in-tree file was last modified. (Martin [gz]) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Mon Apr 19 05:10:56 BST 2010
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 5164 [merge]
revision-id: pqm at pqm.ubuntu.com-20100419041053-7rxk1julcon2sbm9
parent: pqm at pqm.ubuntu.com-20100416133950-3t613lojd942di1y
parent: gzlist at googlemail.com-20100416131540-4x8ovao9cwioyuzp
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Mon 2010-04-19 05:10:53 +0100
message:
(lifeless) When writing temporary files for external diff do not set the file utime if we don't know when the in-tree file was last modified. (Martin [gz])
modified:
bzrlib/diff.py diff.py-20050309040759-26944fbbf2ebbf36
bzrlib/tests/blackbox/test_export.py test_export.py-20051229024010-e6c26658e460fb1c
bzrlib/tests/test_diff.py testdiff.py-20050727164403-d1a3496ebb12e339
bzrlib/tests/test_export.py test_export.py-20090220201010-tpbxssdnezsvu9pk-1
=== modified file 'bzrlib/diff.py'
--- a/bzrlib/diff.py 2010-04-13 13:24:12 +0000
+++ b/bzrlib/diff.py 2010-04-19 04:10:53 +0000
@@ -798,13 +798,14 @@
target.close()
finally:
source.close()
+ try:
+ mtime = tree.get_file_mtime(file_id)
+ except errors.FileTimestampUnavailable:
+ pass
+ else:
+ os.utime(full_path, (mtime, mtime))
if not allow_write:
osutils.make_readonly(full_path)
- try:
- mtime = tree.get_file_mtime(file_id)
- except errors.FileTimestampUnavailable:
- mtime = 0
- os.utime(full_path, (mtime, mtime))
return full_path
def _prepare_files(self, file_id, old_path, new_path, force_temp=False,
=== modified file 'bzrlib/tests/blackbox/test_export.py'
--- a/bzrlib/tests/blackbox/test_export.py 2010-04-14 08:09:45 +0000
+++ b/bzrlib/tests/blackbox/test_export.py 2010-04-19 04:10:53 +0000
@@ -307,8 +307,9 @@
tree = self.example_branch()
self.build_tree_contents([('branch/har', 'foo')])
tree.add('har')
- tree.commit('setup', timestamp=42)
+ # Earliest allowable date on FAT32 filesystems is 1980-01-01
+ tree.commit('setup', timestamp=315532800)
self.run_bzr('export --per-file-timestamps t branch')
har_st = os.stat('t/har')
- self.assertEquals(42, har_st.st_mtime)
+ self.assertEquals(315532800, har_st.st_mtime)
=== modified file 'bzrlib/tests/test_diff.py'
--- a/bzrlib/tests/test_diff.py 2010-04-14 03:18:37 +0000
+++ b/bzrlib/tests/test_diff.py 2010-04-19 04:10:53 +0000
@@ -1367,7 +1367,8 @@
self.build_tree_contents([('tree/oldname2', 'oldcontent2')])
tree.add('oldname', 'file-id')
tree.add('oldname2', 'file2-id')
- tree.commit('old tree', timestamp=0)
+ # Earliest allowable date on FAT32 filesystems is 1980-01-01
+ tree.commit('old tree', timestamp=315532800)
tree.rename_one('oldname', 'newname')
tree.rename_one('oldname2', 'newname2')
self.build_tree_contents([('tree/newname', 'newcontent')])
@@ -1385,7 +1386,7 @@
old_path, new_path = diff_obj._prepare_files('file-id', 'oldname',
'newname')
self.assertContainsRe(old_path, 'old/oldname$')
- self.assertEqual(0, os.stat(old_path).st_mtime)
+ self.assertEqual(315532800, os.stat(old_path).st_mtime)
self.assertContainsRe(new_path, 'tree/newname$')
self.assertFileEqual('oldcontent', old_path)
self.assertFileEqual('newcontent', new_path)
=== modified file 'bzrlib/tests/test_export.py'
--- a/bzrlib/tests/test_export.py 2010-03-08 02:23:17 +0000
+++ b/bzrlib/tests/test_export.py 2010-04-14 00:11:32 +0000
@@ -102,13 +102,16 @@
def test_dir_export_files_per_file_timestamps(self):
builder = self.make_branch_builder('source')
builder.start_series()
+ # Earliest allowable date on FAT32 filesystems is 1980-01-01
+ a_time = time.mktime((1999, 12, 12, 0, 0, 0, 0, 0, 0))
+ b_time = time.mktime((1980, 01, 01, 0, 0, 0, 0, 0, 0))
builder.build_snapshot(None, None, [
('add', ('', 'root-id', 'directory', '')),
('add', ('a', 'a-id', 'file', 'content\n'))],
- timestamp=3423)
+ timestamp=a_time)
builder.build_snapshot(None, None, [
('add', ('b', 'b-id', 'file', 'content\n'))],
- timestamp=42)
+ timestamp=b_time)
builder.finish_series()
b = builder.get_branch()
b.lock_read()
@@ -116,7 +119,5 @@
tree = b.basis_tree()
export.export(tree, 'target', format='dir', per_file_timestamps=True)
t = self.get_transport('target')
- st_a = t.stat('a')
- st_b = t.stat('b')
- self.assertEqual(42.0, st_b.st_mtime)
- self.assertEqual(3423.0, st_a.st_mtime)
+ self.assertEqual(a_time, t.stat('a').st_mtime)
+ self.assertEqual(b_time, t.stat('b').st_mtime)
More information about the bazaar-commits
mailing list