merge --uncommitted on a branch that is an ancestor of the one you are merging into breaks

Bug #127115 reported by Vincent Ladeuil
2
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
Medium
Wouter van Heyst

Bug Description

#!/bin/bash
rm -fr bug
mkdir bug
cd bug
bzr init base
cd base
echo blabla > a
bzr add a
bzr commit -m 'Adding a'
cd ..
bzr branch base branch
cd base
# bzr mv a b
echo talk properly > a
cd ../branch
bzr merge --uncommitted ../base

Results in:

bzr: ERROR: exceptions.TypeError: sequence item 2: expected string, NoneType found

Traceback (most recent call last):
  File "/v/home/vila/src/bzr.dev/bzrlib/commands.py", line 729, in run_bzr_catch_errors
    return run_bzr(argv)
  File "/v/home/vila/src/bzr.dev/bzrlib/commands.py", line 691, in run_bzr
    ret = run(*run_argv)
  File "/v/home/vila/src/bzr.dev/bzrlib/commands.py", line 389, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/v/home/vila/src/bzr.dev/bzrlib/builtins.py", line 2738, in run
    change_reporter=change_reporter)
  File "/v/home/vila/src/bzr.dev/bzrlib/builtins.py", line 3804, in _merge_helper
    merger.set_pending()
  File "/v/home/vila/src/bzr.dev/bzrlib/merge.py", line 168, in set_pending
    self._add_parent()
  File "/v/home/vila/src/bzr.dev/bzrlib/merge.py", line 183, in _add_parent
    allow_leftmost_as_ghost=True)
  File "/v/home/vila/src/bzr.dev/bzrlib/mutabletree.py", line 52, in tree_write_locked
    self.unlock()
  File "/v/home/vila/src/bzr.dev/bzrlib/workingtree_4.py", line 1121, in unlock
    self.flush()
  File "/v/home/vila/src/bzr.dev/bzrlib/workingtree_4.py", line 312, in flush
    self.current_dirstate().save()
  File "/v/home/vila/src/bzr.dev/bzrlib/dirstate.py", line 1728, in save
    self._state_file.writelines(self.get_lines())
  File "/v/home/vila/src/bzr.dev/bzrlib/dirstate.py", line 1221, in get_lines
    lines.append(self._get_parents_line(self.get_parent_ids()))
  File "/v/home/vila/src/bzr.dev/bzrlib/dirstate.py", line 1233, in _get_parents_line
    return '\0'.join([str(len(parent_ids))] + parent_ids)
TypeError: sequence item 2: expected string, NoneType found

Revision history for this message
Vincent Ladeuil (vila) wrote :

If I'm wrong about dirstate being the culprit, feel free to change the description.

Revision history for this message
Aaron Bentley (abentley) wrote :

This report doesn't make clear what the problems are.

Revision history for this message
Vincent Ladeuil (vila) wrote :

Yes, sorry about that.

The problem is that running the given script issues a trace back:

added a
added a
Committed revision 1.
Branched 1 revision(s).
 M a
All changes applied successfully.
bzr: ERROR: exceptions.TypeError: sequence item 2: expected string, NoneType found

Traceback (most recent call last):
  File "/v/home/vila/src/bzr.dev/bzrlib/commands.py", line 729, in run_bzr_catch_errors
    return run_bzr(argv)
  File "/v/home/vila/src/bzr.dev/bzrlib/commands.py", line 691, in run_bzr
    ret = run(*run_argv)
  File "/v/home/vila/src/bzr.dev/bzrlib/commands.py", line 389, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/v/home/vila/src/bzr.dev/bzrlib/builtins.py", line 2738, in run
    change_reporter=change_reporter)
  File "/v/home/vila/src/bzr.dev/bzrlib/builtins.py", line 3804, in _merge_helper
    merger.set_pending()
  File "/v/home/vila/src/bzr.dev/bzrlib/merge.py", line 168, in set_pending
    self._add_parent()
  File "/v/home/vila/src/bzr.dev/bzrlib/merge.py", line 183, in _add_parent
    allow_leftmost_as_ghost=True)
  File "/v/home/vila/src/bzr.dev/bzrlib/mutabletree.py", line 52, in tree_write_locked
    self.unlock()
  File "/v/home/vila/src/bzr.dev/bzrlib/workingtree_4.py", line 1121, in unlock
    self.flush()
  File "/v/home/vila/src/bzr.dev/bzrlib/workingtree_4.py", line 312, in flush
    self.current_dirstate().save()
  File "/v/home/vila/src/bzr.dev/bzrlib/dirstate.py", line 1728, in save
    self._state_file.writelines(self.get_lines())
  File "/v/home/vila/src/bzr.dev/bzrlib/dirstate.py", line 1221, in get_lines
    lines.append(self._get_parents_line(self.get_parent_ids()))
  File "/v/home/vila/src/bzr.dev/bzrlib/dirstate.py", line 1233, in _get_parents_line
    return '\0'.join([str(len(parent_ids))] + parent_ids)
TypeError: sequence item 2: expected string, NoneType found

bzr 0.19.0dev0 on python 2.4.4.candidate.1 (linux2)
arguments: ['/home/vila/bin/bzr', 'merge', '--uncommitted', '../base']

** please send this report to <email address hidden>
/v/home/vila/src/bzr.dev/bzrlib/lockable_files.py:110: UserWarning: file group LockableFiles(<bzrlib.transport.local.LocalTransport url=file:///home/vila/tmp/bug/branch/.bzr/checkout/>) was not explicitly unlocked
  warn("file group %r was not explicitly unlocked" % self)
/v/home/vila/src/bzr.dev/bzrlib/lock.py:79: UserWarning: lock on <open file u'/home/vila/tmp/bug/branch/.bzr/checkout/dirstate', mode 'rb+' at 0xb777f7b8> not released
  warn("lock on %r not released" % self.f)

Revision history for this message
Wouter van Heyst (larstiq) wrote : Re: dirstate breaks (traceback) merge --uncommitted

This is similar, but not quite, to something I mailed about on the 14th. Picking this one up
and writing tests for both.

Changed in bzr:
assignee: nobody → larstiq
importance: Undecided → Medium
status: New → In Progress
Revision history for this message
Wouter van Heyst (larstiq) wrote :

bzr-bisect is a little broken, but it still helped to determine this got broken in r2617, 'Improve merge speed'. Sepcifically <email address hidden>
removed the checking for self.other_rev_id being None.

Revision history for this message
Vincent Ladeuil (vila) wrote :

Fixed in bzr.dev @ 2645

Changed in bzr:
status: In Progress → Fix Released
description: updated
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.