Skip to content

Commit 4fc626d

Browse files
authored
Refactor editor (#34780)
A complete rewrite
1 parent 81adb01 commit 4fc626d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+973
-1634
lines changed

models/git/lfs.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ type LFSMetaObject struct {
112112
ID int64 `xorm:"pk autoincr"`
113113
lfs.Pointer `xorm:"extends"`
114114
RepositoryID int64 `xorm:"UNIQUE(s) INDEX NOT NULL"`
115-
Existing bool `xorm:"-"`
116115
CreatedUnix timeutil.TimeStamp `xorm:"created"`
117116
UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"`
118117
}
@@ -146,7 +145,6 @@ func NewLFSMetaObject(ctx context.Context, repoID int64, p lfs.Pointer) (*LFSMet
146145
if err != nil {
147146
return nil, err
148147
} else if exist {
149-
m.Existing = true
150148
return m, committer.Commit()
151149
}
152150

modules/structs/repo_file.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ func (o *UpdateFileOptions) Branch() string {
6666
return o.FileOptions.BranchName
6767
}
6868

69+
// FIXME: ChangeFileOperation.SHA is NOT required for update or delete if last commit is provided in the options.
70+
6971
// ChangeFileOperation for creating, updating or deleting a file
7072
type ChangeFileOperation struct {
7173
// indicates what to do with the file

options/locale/locale_en-US.ini

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1354,7 +1354,7 @@ editor.update = Update %s
13541354
editor.delete = Delete %s
13551355
editor.patch = Apply Patch
13561356
editor.patching = Patching:
1357-
editor.fail_to_apply_patch = Unable to apply patch "%s"
1357+
editor.fail_to_apply_patch = Unable to apply patch
13581358
editor.new_patch = New Patch
13591359
editor.commit_message_desc = Add an optional extended description…
13601360
editor.signoff_desc = Add a Signed-off-by trailer by the committer at the end of the commit log message.
@@ -1374,17 +1374,14 @@ editor.branch_already_exists = Branch "%s" already exists in this repository.
13741374
editor.directory_is_a_file = Directory name "%s" is already used as a filename in this repository.
13751375
editor.file_is_a_symlink = `"%s" is a symbolic link. Symbolic links cannot be edited in the web editor`
13761376
editor.filename_is_a_directory = Filename "%s" is already used as a directory name in this repository.
1377-
editor.file_editing_no_longer_exists = The file being edited, "%s", no longer exists in this repository.
1378-
editor.file_deleting_no_longer_exists = The file being deleted, "%s", no longer exists in this repository.
1377+
editor.file_modifying_no_longer_exists = The file being modified, "%s", no longer exists in this repository.
13791378
editor.file_changed_while_editing = The file contents have changed since you started editing. <a target="_blank" rel="noopener noreferrer" href="%s">Click here</a> to see them or <strong>Commit Changes again</strong> to overwrite them.
13801379
editor.file_already_exists = A file named "%s" already exists in this repository.
13811380
editor.commit_id_not_matching = The Commit ID does not match the ID when you began editing. Commit into a patch branch and then merge.
13821381
editor.push_out_of_date = The push appears to be out of date.
13831382
editor.commit_empty_file_header = Commit an empty file
13841383
editor.commit_empty_file_text = The file you're about to commit is empty. Proceed?
13851384
editor.no_changes_to_show = There are no changes to show.
1386-
editor.fail_to_update_file = Failed to update/create file "%s".
1387-
editor.fail_to_update_file_summary = Error Message:
13881385
editor.push_rejected_no_message = The change was rejected by the server without a message. Please check Git Hooks.
13891386
editor.push_rejected = The change was rejected by the server. Please check Git Hooks.
13901387
editor.push_rejected_summary = Full Rejection Message:
@@ -1398,6 +1395,8 @@ editor.user_no_push_to_branch = User cannot push to branch
13981395
editor.require_signed_commit = Branch requires a signed commit
13991396
editor.cherry_pick = Cherry-pick %s onto:
14001397
editor.revert = Revert %s onto:
1398+
editor.failed_to_commit = Failed to commit changes.
1399+
editor.failed_to_commit_summary = Error Message:
14011400
14021401
commits.desc = Browse source code change history.
14031402
commits.commits = Commits

routers/api/v1/repo/file.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,9 @@ func ChangeFiles(ctx *context.APIContext) {
470470
ctx.APIError(http.StatusUnprocessableEntity, err)
471471
return
472472
}
473+
// FIXME: actually now we support more operations like "rename", "upload"
474+
// FIXME: ChangeFileOperation.SHA is NOT required for update or delete if last commit is provided in the options.
475+
// Need to fully fix them in API
473476
changeRepoFile := &files_service.ChangeRepoFile{
474477
Operation: file.Operation,
475478
TreePath: file.Path,

routers/web/repo/cherry_pick.go

Lines changed: 0 additions & 193 deletions
This file was deleted.

0 commit comments

Comments
 (0)