unable to unshelve shelved root-id change

Bug #641330 reported by Parth Malwankar
50
This bug affects 9 people
Affects Status Importance Assigned to Milestone
Bazaar
Confirmed
Medium
Unassigned
Breezy
Triaged
Medium
Unassigned

Bug Description

I am using trunk 2.3.0dev1 (revno 5418).

[tmp]% bzr init unshelve-error
Created a standalone tree (format: 2a)
[tmp]% cd unshelve-error
[unshelve-error]% bzr mkdir foo
added foo
[unshelve-error]% bzr shelve --all
Selected changes:
-D foo/
Changes shelved with id "1".
[unshelve-error]% bzr unshelve 1
Using changes with id "1".
bzr: ERROR: No final name for trans_id 'new-1'
file-id: 'tree_root-20100917140029-sh3gsmebmvg8j3gb-1'
root trans-id: None

[unshelve-error]% bzr -Derror unshelve 1
Using changes with id "1".
bzr: ERROR: bzrlib.errors.NoFinalPath: No final name for trans_id 'new-1'
file-id: 'tree_root-20100917140029-sh3gsmebmvg8j3gb-1'
root trans-id: None

Traceback (most recent call last):
  File "/storage/parth/src/bzr.dev/trunk/bzrlib/commands.py", line 912, in exception_to_return_code
    return the_callable(*args, **kwargs)
  File "/storage/parth/src/bzr.dev/trunk/bzrlib/commands.py", line 1112, in run_bzr
    ret = run(*run_argv)
  File "/storage/parth/src/bzr.dev/trunk/bzrlib/commands.py", line 690, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/storage/parth/src/bzr.dev/trunk/bzrlib/commands.py", line 705, in run
    return self._operation.run_simple(*args, **kwargs)
  File "/storage/parth/src/bzr.dev/trunk/bzrlib/cleanup.py", line 135, in run_simple
    self.cleanups, self.func, *args, **kwargs)
  File "/storage/parth/src/bzr.dev/trunk/bzrlib/cleanup.py", line 165, in _do_with_cleanups
    result = func(*args, **kwargs)
  File "/storage/parth/src/bzr.dev/trunk/bzrlib/builtins.py", line 5923, in run
    unshelver.run()
  File "/storage/parth/src/bzr.dev/trunk/bzrlib/shelf_ui.py", line 475, in run
    merger = unshelver.make_merger(None)
  File "/storage/parth/src/bzr.dev/trunk/bzrlib/shelf.py", line 325, in make_merger
    target_tree = self.transform.get_preview_tree()
  File "/storage/parth/src/bzr.dev/trunk/bzrlib/transform.py", line 904, in get_preview_tree
    return _PreviewTree(self)
  File "/storage/parth/src/bzr.dev/trunk/bzrlib/transform.py", line 1743, in __init__
    self._transform.iter_changes())
  File "/storage/parth/src/bzr.dev/trunk/bzrlib/transform.py", line 870, in iter_changes
    self._to_file_data(to_trans_id, from_trans_id, from_executable)
  File "/storage/parth/src/bzr.dev/trunk/bzrlib/transform.py", line 825, in _to_file_data
    to_name = self.final_name(to_trans_id)
  File "/storage/parth/src/bzr.dev/trunk/bzrlib/transform.py", line 465, in final_name
    raise NoFinalPath(trans_id, self)
NoFinalPath: No final name for trans_id 'new-1'
file-id: 'tree_root-20100917140029-sh3gsmebmvg8j3gb-1'
root trans-id: None

[unshelve-error]%

Revision history for this message
John A Meinel (jameinel) wrote :

Actually, I'm pretty sure this is about not being able to unshelve the
root, not a newly created subdir. Try:

bzr init foo
cd foo
touch a; bzr add a; bzr commit -m "a"
bzr mkdir dir
bzr shelve
bzr unshelve

I think that will work.

The problem is that you did this as the *first* action (without any
other commit) and it shelved the creation of the tree root.

Either:
 a) We shouldn't allow shelving the root
or
 b) We should support unshelving a new root

Now, if what I wrote also fails, then we have 2 bugs :). But what you posted here is a failure to unshelve a root-id change.

Changed in bzr:
importance: Undecided → Low
status: New → Confirmed
summary: - unable to unshelve shelved directory
+ unable to unshelve shelved root-id change
Revision history for this message
Parth Malwankar (parthm) wrote :

The snippet you showed works correctly.
You are right about root-id. I see the same behavior even with a file.

[foo]% bzr init
Created a standalone tree (format: 2a)

[foo]% touch x
[foo]% bzr add
adding x
[foo]% bzr shelve --all
Selected changes:
-D x
Changes shelved with id "1".
[foo]% bzr unshelve 1
Using changes with id "1".
bzr: ERROR: No final name for trans_id 'new-1'
file-id: 'tree_root-20100917153546-cwjpp24s675icdbn-1'
root trans-id: None

[foo]%

Revision history for this message
Forest Bond (forest-bond) wrote :

This bug should be higher priority since you can shelve important changes along with the root and then not get them back easily.

Revision history for this message
David H. Bronke (whitelynx) wrote :

I also agree with a priority increase; Friday I lost several important changes at work because I happened to shelve the addition of some files, and now I can't get my work back. I'm going to hack around the .bzr directory and see if I can get the data back from there.

Revision history for this message
Martin Packman (gz) wrote :

Bumping priority based on the comments here and given it's hard to recover from if you make this mistake.

Changed in bzr:
importance: Low → Medium
Revision history for this message
Jiří Janoušek (fenryxo) wrote :

Is there any way how to recover shelved files or is it a permanent data loss?

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

Once this bug is fixed it should be possible to recover.

IIRC Martin [gz] was working on this?

Revision history for this message
Michał Karnicki (karni) wrote :

This still hasn't been fixed, has it?

karni@zen:~/src/.../rinput4j$ bzr unshelve
Using changes with id "1".
bzr: ERROR: No final name for trans_id 'new-4'
file-id: 'tree_root-20130516131631-c8hgidoee0zc0vs7-1'
root trans-id: None

karni@zen:~$ apt-cache policy bzr
bzr:
  Installed: 2.5.1-0ubuntu2

Jelmer Vernooij (jelmer)
tags: added: check-for-breezy
Jelmer Vernooij (jelmer)
tags: removed: check-for-breezy
Changed in brz:
status: New → Triaged
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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