Comment 9 for bug 82555

Revision history for this message
Gareth White (gwhite-deactivatedaccount) wrote :

I ran into this today by accident. It's even more confusing with a 2a repository as "bzr status" incorrectly reports the merged file as renamed and tells you to update. If you then update you either get a conflict and an error (2.0.3), a crash (2.0.4) or a different error (2.1.0rc1). Revert may then crash too.

Since it sounds like this is pretty hard to fix can we not make it detect you're merging into an empty branch and just abort the merge altogether (with a friendly error message)?

Current behaviour with 2.0.3:
> bzr init branch1
Created a standalone tree (format: 2a)
> bzr init branch2
Created a standalone tree (format: 2a)
> cd branch1
> touch test
> bzr add test
adding test
> bzr commit -m "test"
Committing to: /Users/garethw/Programming/Bazaar/branch1/
added test
Committed revision 1.
> cd ../branch2
> bzr merge ../branch1
+N test
All changes applied successfully.
> bzr status
working tree is out of date, run 'bzr update'
renamed:
  test => test
> bzr update
-D test
Path conflict: test / test
1 conflicts encountered.
bzr: ERROR: Reserved revision-id {null:}
> bzr revert
bzr: ERROR: exceptions.ValueError: Cannot have multiple roots.

Traceback (most recent call last):
  File "/Users/garethw/Programming/Bazaar/bzr-repo/2.0.3/bzrlib/commands.py", line 842, in exception_to_return_code
    return the_callable(*args, **kwargs)
  File "/Users/garethw/Programming/Bazaar/bzr-repo/2.0.3/bzrlib/commands.py", line 1037, in run_bzr
    ret = run(*run_argv)
  File "/Users/garethw/Programming/Bazaar/bzr-repo/2.0.3/bzrlib/commands.py", line 654, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/Users/garethw/Programming/Bazaar/bzr-repo/2.0.3/bzrlib/builtins.py", line 4053, in run
    self._revert_tree_to_revision(tree, revision, file_list, no_backup)
  File "/Users/garethw/Programming/Bazaar/bzr-repo/2.0.3/bzrlib/builtins.py", line 4063, in _revert_tree_to_revision
    report_changes=True)
  File "/Users/garethw/Programming/Bazaar/bzr-repo/2.0.3/bzrlib/mutabletree.py", line 53, in tree_write_locked
    return unbound(self, *args, **kwargs)
  File "/Users/garethw/Programming/Bazaar/bzr-repo/2.0.3/bzrlib/workingtree.py", line 2067, in revert
    report_changes)
  File "/Users/garethw/Programming/Bazaar/bzr-repo/2.0.3/bzrlib/transform.py", line 2510, in revert
    working_tree, target_tree, tt, filenames, backups, pp)
  File "/Users/garethw/Programming/Bazaar/bzr-repo/2.0.3/bzrlib/transform.py", line 2537, in _prepare_revert_transform
    merge_modified, basis_tree)
  File "/Users/garethw/Programming/Bazaar/bzr-repo/2.0.3/bzrlib/transform.py", line 2639, in _alter_files
    tt.adjust_path(name[1], parent_trans, trans_id)
  File "/Users/garethw/Programming/Bazaar/bzr-repo/2.0.3/bzrlib/transform.py", line 1074, in adjust_path
    TreeTransformBase.adjust_path(self, name, parent, trans_id)
  File "/Users/garethw/Programming/Bazaar/bzr-repo/2.0.3/bzrlib/transform.py", line 170, in adjust_path
    raise ValueError("Cannot have multiple roots.")
ValueError: Cannot have multiple roots.

With 2.0.4, it's the same until the update:
> bzr update
bzr: ERROR: exceptions.ValueError: WorkingTree.set_root_id with fileid=None

Traceback (most recent call last):
  File "/Users/garethw/Programming/Bazaar/bzr-repo/bzr-2.0/bzrlib/commands.py", line 842, in exception_to_return_code
  File "/Users/garethw/Programming/Bazaar/bzr-repo/bzr-2.0/bzrlib/commands.py", line 1037, in run_bzr
  File "/Users/garethw/Programming/Bazaar/bzr-repo/bzr-2.0/bzrlib/commands.py", line 654, in run_argv_aliases
  File "/Users/garethw/Programming/Bazaar/bzr-repo/bzr-2.0/bzrlib/builtins.py", line 1413, in run
  File "/Users/garethw/Programming/Bazaar/bzr-repo/bzr-2.0/bzrlib/workingtree.py", line 2217, in update
  File "/Users/garethw/Programming/Bazaar/bzr-repo/bzr-2.0/bzrlib/mutabletree.py", line 53, in tree_write_locked
  File "/Users/garethw/Programming/Bazaar/bzr-repo/bzr-2.0/bzrlib/workingtree.py", line 2252, in _update_tree
  File "/Users/garethw/Programming/Bazaar/bzr-repo/bzr-2.0/bzrlib/mutabletree.py", line 53, in tree_write_locked
  File "/Users/garethw/Programming/Bazaar/bzr-repo/bzr-2.0/bzrlib/workingtree.py", line 2140, in set_root_id
ValueError: WorkingTree.set_root_id with fileid=None

With 2.1.0rc1:
> bzr update
bzr: ERROR: branch has no revision null:
bzr update --revision only works for a revision in the branch history
> bzr revert
- /
R test => test
> bzr status
working tree is out of date, run 'bzr update'
> bzr update
bzr: ERROR: branch has no revision null:
bzr update --revision only works for a revision in the branch history