##// END OF EJS Templates
Files: preserve filemode on web edits.
dan -
r3373:5f4a0f91 default
parent child Browse files
Show More
@@ -1191,9 +1191,9 b' class RepoFilesView(RepoAppView):'
1191 1191 first_line = sl[0] if sl else ''
1192 1192
1193 1193 r_post = self.request.POST
1194 # modes: 0 - Unix, 1 - Mac, 2 - DOS
1195 mode = detect_mode(first_line, 0)
1196 content = convert_line_endings(r_post.get('content', ''), mode)
1194 # line endings: 0 - Unix, 1 - Mac, 2 - DOS
1195 line_ending_mode = detect_mode(first_line, 0)
1196 content = convert_line_endings(r_post.get('content', ''), line_ending_mode)
1197 1197
1198 1198 message = r_post.get('message') or c.default_message
1199 1199 org_f_path = c.file.unicode_path
@@ -1213,6 +1213,7 b' class RepoFilesView(RepoAppView):'
1213 1213 'content': content,
1214 1214 'lexer': '',
1215 1215 'op': 'mod',
1216 'mode': c.file.mode
1216 1217 }
1217 1218 }
1218 1219
@@ -675,8 +675,8 b' class ScmModel(BaseModel):'
675 675 filename = self._sanitize_path(data['filename'])
676 676 old_filename = self._sanitize_path(_filename)
677 677 content = data['content']
678
679 filenode = FileNode(old_filename, content=content)
678 file_mode = data.get('mode')
679 filenode = FileNode(old_filename, content=content, mode=file_mode)
680 680 op = data['op']
681 681 if op == 'add':
682 682 imc.add(filenode)
@@ -684,16 +684,14 b' class ScmModel(BaseModel):'
684 684 imc.remove(filenode)
685 685 elif op == 'mod':
686 686 if filename != old_filename:
687 # TODO: handle renames more efficient, needs vcs lib
688 # changes
687 # TODO: handle renames more efficient, needs vcs lib changes
689 688 imc.remove(filenode)
690 imc.add(FileNode(filename, content=content))
689 imc.add(FileNode(filename, content=content, mode=file_mode))
691 690 else:
692 691 imc.change(filenode)
693 692
694 693 try:
695 # TODO: handle pre push scenario
696 # commit changes
694 # TODO: handle pre push scenario commit changes
697 695 tip = imc.commit(message=message,
698 696 author=author,
699 697 parents=parents,
General Comments 0
You need to be logged in to leave comments. Login now