Comment 2 for bug 796582

Revision history for this message
Andrew Bennetts (spiv) wrote : Re: committing with -x incorrectly declares the commit pointless

I think I see the problem in a general sense, although I'm not sure what to do to fix it.

When -x is used, Commit._update_builder_with_changes uses the _populate_from_inventory code rather than the iter_changes code. And it seems that although _populate_from_inventory notices missing files, nothing acts on that. It sets self.deleted_ids, but neither it, _record_unselected, nor _report_and_accumulate_deletes uses that variable. Presumably something needs to happen at about the time _record_unselected happens to inform the builder that the files in deleted_ids have been deleted, but I'm not sure precisely when, nor what the API to use on the commit builder to acheive this.

(As an aside: it's a bit weird that the commit builder appears to be two different kinds of objects in one; the delta-based builder and the whole-inventory-based builder; if configured in the latter mode then AIUI methods like record_delete are not available. Wouldn't two separate classes be clearer? They could still share much of the same code, of course, e.g. via a base class.)