Comment 2 for bug 653773

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

There are some logic issues with this bit of code that I'm sorting out:

        if push:
            commit_db.start_commit()
            push_branches_back(package, temp_dir, bstore, possible_transports, local_branches)
            icommon.generate_debian_diffs(lp, temp_dir, package, bstore,
                    possible_transports=possible_transports)
            icommon.generate_ubuntu_merges(lp, temp_dir, package, bstore,
                    possible_transports=possible_transports)
            if not keep_temp:
                shutil.rmtree(temp_dir)
            revid_db.commit()

Specifically:

1) commit_db.start_commit() is called, which inserts a record into the 'commits' table, indicating that a given branch needs to be updated.

However, commit_db.finish_commit() is never called afterword. It seems to only be called in the earlier code that noticed there was data that needed to be "push_back"ed.

I'm thinking we want to add a commit_db.finish_commit() after the revid_db.commit() state.

2) Focusing on this part:

            if not keep_temp:
                shutil.rmtree(temp_dir)
            revid_db.commit()

This says to delete the temporary tree, before you finish copying the data in the 'revids_working' table over to the 'revids' table. That, coupled with no .finish_commit(), means that you can end up thinking that there is stuff that needs to be pushed back up to launchpad and finalized, but you've already deleted all your local work.