[MERGE] Gracefully handle wrong parent kind (Bug #177390)

Andrew Bennetts andrew at canonical.com
Thu Jan 3 07:04:20 GMT 2008


John Arbash Meinel wrote:
> Aaron Bentley wrote:
> > Hi all,
> > 
> > This patch adds support for gracefully handling one of the few unhandled
> > conflict types.  When one side of a merge considers a file-id to be
> > a directory, and modifies its contents, while the other side considers
> > it to be some other type, Bazaar could detect the problem but not handle
> > it gracefully.
> > 
> > With this patch, a new directory is created with the basename plus the
> > extension ".new", and any contents that should be in the directory are
> > moved there.  A NonDirectoryParent conflict is added to the working
> > tree's conflict list.
> > 
> > Happy holidays to those of you celebrating!
> > 
> > Aaron
> 
> BB:comment
> 
> The only thing preventing this from being approve is backwards
> compatibility.
> 
> What happens if an old bzr client comes across a tree which has this
> conflict set? Does it barf? Does it have a "unknown conflict conflict"?

I just tried this.  You get a traceback:

bzr: ERROR: exceptions.KeyError: u'non-directory parent'

Traceback (most recent call last):
  File "/home/andrew/code/bzr/bzrlib/commands.py", line 806, in run_bzr_catch_errors
    return run_bzr(argv)
  File "/home/andrew/code/bzr/bzrlib/commands.py", line 762, in run_bzr
    ret = run(*run_argv)
  File "/home/andrew/code/bzr/bzrlib/commands.py", line 492, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/home/andrew/code/bzr/bzrlib/commands.py", line 772, in ignore_pipe
    result = func(*args, **kwargs)
  File "/home/andrew/code/bzr/bzrlib/builtins.py", line 189, in run
    to_file=self.outf, short=short, versioned=versioned)
  File "/home/andrew/code/bzr/bzrlib/status.py", line 125, in show_tree_status
    conflicts = new.conflicts()
  File "/home/andrew/code/bzr/bzrlib/decorators.py", line 127, in read_locked
    return unbound(self, *args, **kwargs)
  File "/home/andrew/code/bzr/bzrlib/workingtree.py", line 2616, in conflicts
    return _mod_conflicts.ConflictList.from_stanzas(RioReader(confile))
  File "/home/andrew/code/bzr/bzrlib/conflicts.py", line 224, in from_stanzas
    conflicts.append(Conflict.factory(**stanza.as_dict()))
  File "/home/andrew/code/bzr/bzrlib/conflicts.py", line 349, in factory
    return ctype[type](**kwargs)
KeyError: u'non-directory parent'

> As this is just the WT, we are a lot less likely to run into it
> (Branch/Repo are generally shared by different versions of Bazaar, WT
> much less often).
> 
> At the least, we need to know what will happen so we can decide if we
> want to do it. (At the moment, I think we do, but I wanted to discuss it
> first.)

My feeling is we probably want to do this anyway.  The risk of it biting people
is low, and the solution is easy: upgrade.  And after all, earlier versions of
bzr can't even perform the merge.

We should make this part of Bazaar more future-proof.  We ought to be able to
fail gracefully when doing working tree operations with unexpected conflicts.
e.g. for status, report the fact that there's an unknown conflict type, rather
than bombing out.  That's a separate bug to this, though.

So for this change, I vote:

bb:approve

-Andrew.




More information about the bazaar mailing list