Exporting subdirs with --per-file-timestamps fails

Bug #795557 reported by Szilveszter Farkas
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
Medium
Szilveszter Farkas

Bug Description

When I try to export a subdir from a branch with --per-file-timestamps, I get the following error:

$ ./bzr export --per-file-timestamps ../export-bzrlib/ bzrlib/export
bzr: ERROR: The file id "None" is not present in the tree <bzrlib.inventory.CHKInventory object at 0x1019b4690>.

The corresponding bzr.log entry:

Fri 2011-06-10 15:42:58 +0200
0.072 bazaar version: 2.4.0dev4
0.073 bzr arguments: [u'export', u'--per-file-timestamps', u'../export-bzrlib/', u'bzrlib/export']
0.121 looking for plugins in /Users/szilveszter/.bazaar/plugins
0.138 looking for plugins in /Users/szilveszter/Work/bzr.repo/bzr.dev/bzrlib/plugins
0.154 looking for plugins in /Users/szilveszter/Work/bzr.repo/env/lib/python2.7/site-packages/bzrlib/plugins
0.158 encoding stdout as sys.stdout encoding 'UTF-8'
0.222 export version <InventoryRevisionTree instance at 1019e8410, <email address hidden>'>
0.556 Transferred: 0kB (0.0kB/s r:0kB w:0kB)
0.562 Traceback (most recent call last):
  File "/Users/szilveszter/Work/bzr.repo/bzr.dev/bzrlib/commands.py", line 930, in exception_to_return_code
    return the_callable(*args, **kwargs)
  File "/Users/szilveszter/Work/bzr.repo/bzr.dev/bzrlib/commands.py", line 1130, in run_bzr
    ret = run(*run_argv)
  File "/Users/szilveszter/Work/bzr.repo/bzr.dev/bzrlib/commands.py", line 691, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/Users/szilveszter/Work/bzr.repo/bzr.dev/bzrlib/commands.py", line 713, in run
    return self._operation.run_simple(*args, **kwargs)
  File "/Users/szilveszter/Work/bzr.repo/bzr.dev/bzrlib/cleanup.py", line 135, in run_simple
    self.cleanups, self.func, *args, **kwargs)
  File "/Users/szilveszter/Work/bzr.repo/bzr.dev/bzrlib/cleanup.py", line 165, in _do_with_cleanups
    result = func(*args, **kwargs)
  File "/Users/szilveszter/Work/bzr.repo/bzr.dev/bzrlib/builtins.py", line 2967, in run
    per_file_timestamps=per_file_timestamps)
  File "/Users/szilveszter/Work/bzr.repo/bzr.dev/bzrlib/export/__init__.py", line 162, in export
    per_file_timestamps, fileobj):
  File "/Users/szilveszter/Work/bzr.repo/bzr.dev/bzrlib/export/__init__.py", line 129, in get_export_generator
    force_mtime=force_mtime, fileobj=fileobj):
  File "/Users/szilveszter/Work/bzr.repo/bzr.dev/bzrlib/export/dir_exporter.py", line 99, in dir_exporter_generator
    mtime = tree.get_file_mtime(tree.path2id(relpath), relpath)
  File "/Users/szilveszter/Work/bzr.repo/bzr.dev/bzrlib/revisiontree.py", line 99, in get_file_mtime
    ie = self._inventory[file_id]
  File "/Users/szilveszter/Work/bzr.repo/bzr.dev/bzrlib/inventory.py", line 1897, in __getitem__
    raise errors.NoSuchId(self, file_id)
NoSuchId: The file id "None" is not present in the tree <bzrlib.inventory.CHKInventory object at 0x1019b4690>.

The problem lies here:

mtime = tree.get_file_mtime(tree.path2id(relpath), relpath)

When exporting a subdir, relpath will be relative to the subdir, but path2id needs a path relative to the branch root.

Related branches

Revision history for this message
Szilveszter Farkas (phanatic) wrote :

I have already managed to come up with a fix, but it still needs proper tests.

Changed in bzr:
assignee: nobody → Szilveszter Farkas (phanatic)
status: New → In Progress
Vincent Ladeuil (vila)
Changed in bzr:
milestone: none → 2.4b4
status: In Progress → Fix Released
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.