Show More
@@ -232,29 +232,38 class FilesController(BaseRepoController | |||
|
232 | 232 | if r_post: |
|
233 | 233 | |
|
234 | 234 | old_content = c.file.content |
|
235 | sl = old_content.splitlines(1) | |
|
236 | first_line = sl[0] if sl else '' | |
|
235 | 237 | # modes: 0 - Unix, 1 - Mac, 2 - DOS |
|
236 |
mode = detect_mode( |
|
|
238 | mode = detect_mode(first_line, 0) | |
|
237 | 239 | content = convert_line_endings(r_post.get('content'), mode) |
|
240 | ||
|
238 | 241 | message = r_post.get('message') or (_('Edited %s via RhodeCode') |
|
239 | 242 | % (f_path)) |
|
240 | 243 | |
|
241 | 244 | if content == old_content: |
|
242 | 245 | h.flash(_('No changes'), |
|
243 | 246 | category='warning') |
|
244 | return redirect(url('changeset_home', | |
|
245 |
|
|
|
247 | return redirect(url('changeset_home', repo_name=c.repo_name, | |
|
248 | revision='tip')) | |
|
249 | ||
|
246 | 250 | try: |
|
247 |
|
|
|
251 | content = content.encode('utf8') | |
|
252 | message = message.encode('utf8') | |
|
253 | path = f_path.encode('utf8') | |
|
254 | author = self.rhodecode_user.full_contact.encode('utf8') | |
|
248 | 255 | m = IMC(c.rhodecode_repo) |
|
249 |
m.change( |
|
|
256 | m.change(FileNode(path, content)) | |
|
250 | 257 | m.commit(message=message, |
|
251 |
author= |
|
|
258 | author=author, | |
|
252 | 259 | parents=[c.cs], branch=c.cs.branch) |
|
253 | 260 | h.flash(_('Successfully committed to %s' % f_path), |
|
254 | 261 | category='success') |
|
262 | ||
|
255 | 263 | except Exception, e: |
|
256 | 264 | log.error(traceback.format_exc()) |
|
257 | 265 | h.flash(_('Error occurred during commit'), category='error') |
|
266 | raise | |
|
258 | 267 | return redirect(url('changeset_home', |
|
259 | 268 | repo_name=c.repo_name, revision='tip')) |
|
260 | 269 |
General Comments 0
You need to be logged in to leave comments.
Login now