Rev 5974: Bug #795557, in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Wed Jun 15 13:00:57 UTC 2011
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 5974 [merge]
revision-id: pqm at pqm.ubuntu.com-20110615130055-anv7vid86fsmrj17
parent: pqm at pqm.ubuntu.com-20110615081602-44eucf9miecsn8wt
parent: john at arbash-meinel.com-20110615121230-cy6gse1l7cwsa662
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2011-06-15 13:00:55 +0000
message:
Bug #795557,
allow exporting a subdir when also exporting the timestamps.
(Szilveszter Farkas)
modified:
bzrlib/export/dir_exporter.py dir_exporter.py-20051114235828-b51397f56bc7b117
bzrlib/tests/blackbox/test_export.py test_export.py-20051229024010-e6c26658e460fb1c
bzrlib/tests/test_export.py test_export.py-20090220201010-tpbxssdnezsvu9pk-1
doc/en/release-notes/bzr-2.4.txt bzr2.4.txt-20110114053217-k7ym9jfz243fddjm-1
=== modified file 'bzrlib/export/dir_exporter.py'
--- a/bzrlib/export/dir_exporter.py 2011-06-06 09:31:59 +0000
+++ b/bzrlib/export/dir_exporter.py 2011-06-10 14:47:25 +0000
@@ -96,7 +96,11 @@
if force_mtime is not None:
mtime = force_mtime
else:
- mtime = tree.get_file_mtime(tree.path2id(relpath), relpath)
+ if subdir is None:
+ file_id = tree.path2id(relpath)
+ else:
+ file_id = tree.path2id(osutils.pathjoin(subdir, relpath))
+ mtime = tree.get_file_mtime(file_id, relpath)
os.utime(fullpath, (mtime, mtime))
yield
=== modified file 'bzrlib/tests/blackbox/test_export.py'
--- a/bzrlib/tests/blackbox/test_export.py 2011-06-07 13:33:41 +0000
+++ b/bzrlib/tests/blackbox/test_export.py 2011-06-10 14:47:25 +0000
@@ -387,6 +387,16 @@
har_st = os.stat('t/har')
self.assertEquals(315532800, har_st.st_mtime)
+ def test_dir_export_partial_tree_per_file_timestamps(self):
+ tree = self.example_branch()
+ self.build_tree(['branch/subdir/', 'branch/subdir/foo.txt'])
+ tree.smart_add(['branch'])
+ # Earliest allowable date on FAT32 filesystems is 1980-01-01
+ tree.commit('setup', timestamp=315532800)
+ self.run_bzr('export --per-file-timestamps tpart branch/subdir')
+ foo_st = os.stat('tpart/foo.txt')
+ self.assertEquals(315532800, foo_st.st_mtime)
+
def test_export_directory(self):
"""Test --directory option"""
self.example_branch()
=== modified file 'bzrlib/tests/test_export.py'
--- a/bzrlib/tests/test_export.py 2011-05-13 12:51:05 +0000
+++ b/bzrlib/tests/test_export.py 2011-06-10 14:47:25 +0000
@@ -146,6 +146,25 @@
self.assertEqual(a_time, t.stat('a').st_mtime)
self.assertEqual(b_time, t.stat('b').st_mtime)
+ def test_subdir_files_per_timestamps(self):
+ builder = self.make_branch_builder('source')
+ builder.start_series()
+ foo_time = time.mktime((1999, 12, 12, 0, 0, 0, 0, 0, 0))
+ builder.build_snapshot(None, None, [
+ ('add', ('', 'root-id', 'directory', '')),
+ ('add', ('subdir', 'subdir-id', 'directory', '')),
+ ('add', ('subdir/foo.txt', 'foo-id', 'file', 'content\n'))],
+ timestamp=foo_time)
+ builder.finish_series()
+ b = builder.get_branch()
+ b.lock_read()
+ self.addCleanup(b.unlock)
+ tree = b.basis_tree()
+ export.export(tree, 'target', format='dir', subdir='subdir',
+ per_file_timestamps=True)
+ t = self.get_transport('target')
+ self.assertEquals(foo_time, t.stat('foo.txt').st_mtime)
+
class TarExporterTests(tests.TestCaseWithTransport):
=== modified file 'doc/en/release-notes/bzr-2.4.txt'
--- a/doc/en/release-notes/bzr-2.4.txt 2011-06-15 07:29:19 +0000
+++ b/doc/en/release-notes/bzr-2.4.txt 2011-06-15 12:12:30 +0000
@@ -62,6 +62,9 @@
* Fix a race condition for ``server_started`` hooks leading to a spurious
test failure. (Vincent Ladeuil, #789167)
+* Fix exporting subdirectory with ``--per-file-timestamps``.
+ (Szilveszter Farkas, #795557)
+
* Handle files that get created but don't get used during TreeTransform.
``open()`` can create a file, and still raise an exception before it
returns. So anything we might have created, make sure we destroy during
More information about the bazaar-commits
mailing list