Show More
@@ -37,7 +37,7 b' from rhodecode.lib.utils import jsonify,' | |||
|
37 | 37 | from rhodecode.lib import diffs |
|
38 | 38 | from rhodecode.lib import helpers as h |
|
39 | 39 | |
|
40 |
from rhodecode.lib.compat import OrderedDict |
|
|
40 | from rhodecode.lib.compat import OrderedDict | |
|
41 | 41 | from rhodecode.lib.utils2 import convert_line_endings, detect_mode, safe_str,\ |
|
42 | 42 | str2bool |
|
43 | 43 | from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator |
@@ -57,7 +57,7 b' from rhodecode.model.db import Repositor' | |||
|
57 | 57 | from rhodecode.controllers.changeset import anchor_url, _ignorews_url,\ |
|
58 | 58 | _context_url, get_line_ctx, get_ignore_ws |
|
59 | 59 | from webob.exc import HTTPNotFound |
|
60 | from rhodecode.lib.exceptions import NonRelativePathError | |
|
60 | from rhodecode.lib.exceptions import NonRelativePathError, IMCCommitError | |
|
61 | 61 | |
|
62 | 62 | |
|
63 | 63 | log = logging.getLogger(__name__) |
@@ -271,7 +271,7 b' class FilesController(BaseRepoController' | |||
|
271 | 271 | h.flash(_('This repository is has been locked by %s on %s') |
|
272 | 272 | % (h.person_by_id(repo.locked[0]), |
|
273 | 273 | h.fmt_date(h.time_to_datetime(repo.locked[1]))), |
|
274 |
|
|
|
274 | 'warning') | |
|
275 | 275 | return redirect(h.url('files_home', |
|
276 | 276 | repo_name=repo_name, revision='tip')) |
|
277 | 277 | |
@@ -293,7 +293,7 b' class FilesController(BaseRepoController' | |||
|
293 | 293 | |
|
294 | 294 | if c.file.is_binary: |
|
295 | 295 | return redirect(url('files_home', repo_name=c.repo_name, |
|
296 | revision=c.cs.raw_id, f_path=f_path)) | |
|
296 | revision=c.cs.raw_id, f_path=f_path)) | |
|
297 | 297 | c.default_message = _('Edited file %s via RhodeCode') % (f_path) |
|
298 | 298 | c.f_path = f_path |
|
299 | 299 | |
@@ -321,7 +321,6 b' class FilesController(BaseRepoController' | |||
|
321 | 321 | content=content, f_path=f_path) |
|
322 | 322 | h.flash(_('Successfully committed to %s') % f_path, |
|
323 | 323 | category='success') |
|
324 | ||
|
325 | 324 | except Exception: |
|
326 | 325 | log.error(traceback.format_exc()) |
|
327 | 326 | h.flash(_('Error occurred during commit'), category='error') |
@@ -86,3 +86,7 b' class HTTPLockedRC(HTTPClientError):' | |||
|
86 | 86 | self.title = self.explanation = ('Repository `%s` locked by ' |
|
87 | 87 | 'user `%s`' % (reponame, username)) |
|
88 | 88 | super(HTTPLockedRC, self).__init__(*args, **kwargs) |
|
89 | ||
|
90 | ||
|
91 | class IMCCommitError(Exception): | |
|
92 | pass |
@@ -54,7 +54,7 b' from rhodecode.model import BaseModel' | |||
|
54 | 54 | from rhodecode.model.db import Repository, RhodeCodeUi, CacheInvalidation, \ |
|
55 | 55 | UserFollowing, UserLog, User, RepoGroup, PullRequest |
|
56 | 56 | from rhodecode.lib.hooks import log_push_action |
|
57 | from rhodecode.lib.exceptions import NonRelativePathError | |
|
57 | from rhodecode.lib.exceptions import NonRelativePathError, IMCCommitError | |
|
58 | 58 | |
|
59 | 59 | log = logging.getLogger(__name__) |
|
60 | 60 | |
@@ -546,11 +546,15 b' class ScmModel(BaseModel):' | |||
|
546 | 546 | author = safe_unicode(author) |
|
547 | 547 | imc = IMC(repo) |
|
548 | 548 | imc.change(FileNode(path, content, mode=cs.get_file_mode(f_path))) |
|
549 | tip = imc.commit(message=message, | |
|
550 | author=author, | |
|
551 | parents=[cs], branch=cs.branch) | |
|
552 | ||
|
553 | self.mark_for_invalidation(repo_name) | |
|
549 | try: | |
|
550 | tip = imc.commit(message=message, author=author, | |
|
551 | parents=[cs], branch=cs.branch) | |
|
552 | except Exception, e: | |
|
553 | log.error(traceback.format_exc()) | |
|
554 | raise IMCCommitError(str(e)) | |
|
555 | finally: | |
|
556 | # always clear caches, if commit fails we want fresh object also | |
|
557 | self.mark_for_invalidation(repo_name) | |
|
554 | 558 | self._handle_push(repo, |
|
555 | 559 | username=user.username, |
|
556 | 560 | action='push_local', |
General Comments 0
You need to be logged in to leave comments.
Login now