From caf0111d9c571ac268c235880e6d18fa512e9efa Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Thu, 23 Jul 2009 11:43:04 -0400 Subject: [PATCH] libbe.rcs.RCS.commit() now actually calls .pre/postcommit(). It hadn't before, which defeats the Pu purpose of hook functions. This hand't caused any problems though, since only libbe.bzr defined a postcommit() and there were no precommit() definitions. Bzr's postcommit() had been to auto-merge from the default merge source. Yikes! Removed that ;). --- libbe/bzr.py | 14 -------------- libbe/rcs.py | 12 ++++++++++-- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/libbe/bzr.py b/libbe/bzr.py index b33292c..d7cd1e5 100644 --- a/libbe/bzr.py +++ b/libbe/bzr.py @@ -93,20 +93,6 @@ class Bzr(RCS): assert len(match.groups()) == 1 revision = match.groups()[0] return revision - def postcommit(self): - try: - self._u_invoke_client('merge') - except rcs.CommandError, e: - if ('No merge branch known or specified' in e.err_str or - 'No merge location known or specified' in e.err_str): - pass - else: - self._u_invoke_client('revert', '--no-backup', - directory=directory) - self._u_invoke_client('resolve', '--all', directory=directory) - raise - if len(self._u_invoke_client('status', directory=directory)[1]) > 0: - self.commit('Merge from upstream') rcs.make_rcs_testcase_subclasses(Bzr, sys.modules[__name__]) diff --git a/libbe/rcs.py b/libbe/rcs.py index 1e1cfa7..294b8e0 100644 --- a/libbe/rcs.py +++ b/libbe/rcs.py @@ -398,14 +398,22 @@ class RCS(object): temp_file = os.fdopen(descriptor, 'wb') temp_file.write(summary) temp_file.flush() + self.precommit() revision = self._rcs_commit(filename, allow_empty=allow_empty) temp_file.close() + self.postcommit() finally: os.remove(filename) return revision - def precommit(self, directory): + def precommit(self): + """ + Executed before all attempted commits. + """ pass - def postcommit(self, directory): + def postcommit(self): + """ + Only executed after successful commits. + """ pass def _u_any_in_string(self, list, string): """ -- 2.26.2