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