@@ -37,7 +37,7 @@ from rhodecode.lib.utils import jsonify,
from rhodecode.lib import diffs
from rhodecode.lib import helpers as h
from rhodecode.lib.compat import OrderedDict, json
from rhodecode.lib.compat import OrderedDict
from rhodecode.lib.utils2 import convert_line_endings, detect_mode, safe_str,\
str2bool
from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator
@@ -57,7 +57,7 @@ from rhodecode.model.db import Repositor
from rhodecode.controllers.changeset import anchor_url, _ignorews_url,\
_context_url, get_line_ctx, get_ignore_ws
from webob.exc import HTTPNotFound
from rhodecode.lib.exceptions import NonRelativePathError
from rhodecode.lib.exceptions import NonRelativePathError, IMCCommitError
log = logging.getLogger(__name__)
@@ -321,7 +321,6 @@ class FilesController(BaseRepoController
content=content, f_path=f_path)
h.flash(_('Successfully committed to %s') % f_path,
category='success')
except Exception:
log.error(traceback.format_exc())
h.flash(_('Error occurred during commit'), category='error')
@@ -86,3 +86,7 @@ class HTTPLockedRC(HTTPClientError):
self.title = self.explanation = ('Repository `%s` locked by '
'user `%s`' % (reponame, username))
super(HTTPLockedRC, self).__init__(*args, **kwargs)
class IMCCommitError(Exception):
pass
@@ -54,7 +54,7 @@ from rhodecode.model import BaseModel
from rhodecode.model.db import Repository, RhodeCodeUi, CacheInvalidation, \
UserFollowing, UserLog, User, RepoGroup, PullRequest
from rhodecode.lib.hooks import log_push_action
@@ -546,10 +546,14 @@ class ScmModel(BaseModel):
author = safe_unicode(author)
imc = IMC(repo)
imc.change(FileNode(path, content, mode=cs.get_file_mode(f_path)))
tip = imc.commit(message=message,
author=author,
try:
tip = imc.commit(message=message, author=author,
parents=[cs], branch=cs.branch)
except Exception, e:
raise IMCCommitError(str(e))
finally:
# always clear caches, if commit fails we want fresh object also
self.mark_for_invalidation(repo_name)
self._handle_push(repo,
username=user.username,
Status change: