##// END OF EJS Templates
Files: preserve filemode on web edits.
dan -
r3410:e6485a6c stable
parent child Browse files
Show More
@@ -1190,9 +1190,9 b' class RepoFilesView(RepoAppView):'
1190 1190 first_line = sl[0] if sl else ''
1191 1191
1192 1192 r_post = self.request.POST
1193 # modes: 0 - Unix, 1 - Mac, 2 - DOS
1194 mode = detect_mode(first_line, 0)
1195 content = convert_line_endings(r_post.get('content', ''), mode)
1193 # line endings: 0 - Unix, 1 - Mac, 2 - DOS
1194 line_ending_mode = detect_mode(first_line, 0)
1195 content = convert_line_endings(r_post.get('content', ''), line_ending_mode)
1196 1196
1197 1197 message = r_post.get('message') or c.default_message
1198 1198 org_f_path = c.file.unicode_path
@@ -1212,6 +1212,7 b' class RepoFilesView(RepoAppView):'
1212 1212 'content': content,
1213 1213 'lexer': '',
1214 1214 'op': 'mod',
1215 'mode': c.file.mode
1215 1216 }
1216 1217 }
1217 1218
@@ -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