~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to scripts/branch-rewrite.py

  • Committer: Stuart Bishop
  • Date: 2011-09-02 10:50:34 UTC
  • mto: (13813.4.2 pgbouncer-fixture)
  • mto: This revision was merged to the branch mainline in revision 13861.
  • Revision ID: stuart.bishop@canonical.com-20110902105034-9ah2e88li2d5lg7y
Revert r13814 landed in wrong pipe

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
from canonical.database.sqlbase import ISOLATION_LEVEL_AUTOCOMMIT
21
21
from canonical.config import config
22
 
from canonical.launchpad.interfaces.lpstorm import ISlaveStore
23
 
from lp.code.model.branch import Branch
24
22
from lp.codehosting.rewrite import BranchRewriter
25
23
from lp.services.log.loglevels import INFO, WARNING
26
24
from lp.services.scripts.base import LaunchpadScript
60
58
                else:
61
59
                    # Standard input has been closed, so die.
62
60
                    return
63
 
            except Exception:
 
61
            except KeyboardInterrupt:
 
62
                sys.exit()
 
63
            except:
64
64
                self.logger.exception('Exception occurred:')
65
65
                print "NULL"
66
 
                # The exception might have been a DisconnectionError or
67
 
                # similar. Cleanup such as database reconnection will
68
 
                # not happen until the transaction is rolled back. We
69
 
                # are explicitly rolling back the store here instead of
70
 
                # using transaction.abort() due to Bug #819282.
71
 
                try:
72
 
                    ISlaveStore(Branch).rollback()
73
 
                except Exception:
74
 
                    self.logger.exception('Exception occurred in rollback:')
75
66
 
76
67
 
77
68
if __name__ == '__main__':