@@ -31,8 +31,6 @@ import (
31
31
"code.gitea.io/gitea/services/gitdiff"
32
32
pull_service "code.gitea.io/gitea/services/pull"
33
33
repo_service "code.gitea.io/gitea/services/repository"
34
-
35
- "github.com/unknwon/com"
36
34
)
37
35
38
36
const (
@@ -732,7 +730,7 @@ func UpdatePullRequest(ctx *context.Context) {
732
730
// ToDo: add check if maintainers are allowed to change branch ... (need migration & co)
733
731
if ! allowedUpdate {
734
732
ctx .Flash .Error (ctx .Tr ("repo.pulls.update_not_allowed" ))
735
- ctx .Redirect (ctx .Repo .RepoLink + "/pulls/" + com . ToStr (issue .Index ))
733
+ ctx .Redirect (ctx .Repo .RepoLink + "/pulls/" + fmt . Sprint (issue .Index ))
736
734
return
737
735
}
738
736
@@ -752,18 +750,18 @@ func UpdatePullRequest(ctx *context.Context) {
752
750
return
753
751
}
754
752
ctx .Flash .Error (flashError )
755
- ctx .Redirect (ctx .Repo .RepoLink + "/pulls/" + com . ToStr (issue .Index ))
753
+ ctx .Redirect (ctx .Repo .RepoLink + "/pulls/" + fmt . Sprint (issue .Index ))
756
754
return
757
755
}
758
756
ctx .Flash .Error (err .Error ())
759
- ctx .Redirect (ctx .Repo .RepoLink + "/pulls/" + com . ToStr (issue .Index ))
757
+ ctx .Redirect (ctx .Repo .RepoLink + "/pulls/" + fmt . Sprint (issue .Index ))
760
758
return
761
759
}
762
760
763
761
time .Sleep (1 * time .Second )
764
762
765
763
ctx .Flash .Success (ctx .Tr ("repo.pulls.update_branch_success" ))
766
- ctx .Redirect (ctx .Repo .RepoLink + "/pulls/" + com . ToStr (issue .Index ))
764
+ ctx .Redirect (ctx .Repo .RepoLink + "/pulls/" + fmt . Sprint (issue .Index ))
767
765
}
768
766
769
767
// MergePullRequest response for merging pull request
@@ -775,11 +773,11 @@ func MergePullRequest(ctx *context.Context, form auth.MergePullRequestForm) {
775
773
if issue .IsClosed {
776
774
if issue .IsPull {
777
775
ctx .Flash .Error (ctx .Tr ("repo.pulls.is_closed" ))
778
- ctx .Redirect (ctx .Repo .RepoLink + "/pulls/" + com . ToStr (issue .Index ))
776
+ ctx .Redirect (ctx .Repo .RepoLink + "/pulls/" + fmt . Sprint (issue .Index ))
779
777
return
780
778
}
781
779
ctx .Flash .Error (ctx .Tr ("repo.issues.closed_title" ))
782
- ctx .Redirect (ctx .Repo .RepoLink + "/issues/" + com . ToStr (issue .Index ))
780
+ ctx .Redirect (ctx .Repo .RepoLink + "/issues/" + fmt . Sprint (issue .Index ))
783
781
return
784
782
}
785
783
@@ -792,25 +790,25 @@ func MergePullRequest(ctx *context.Context, form auth.MergePullRequestForm) {
792
790
}
793
791
if ! allowedMerge {
794
792
ctx .Flash .Error (ctx .Tr ("repo.pulls.update_not_allowed" ))
795
- ctx .Redirect (ctx .Repo .RepoLink + "/pulls/" + com . ToStr (issue .Index ))
793
+ ctx .Redirect (ctx .Repo .RepoLink + "/pulls/" + fmt . Sprint (issue .Index ))
796
794
return
797
795
}
798
796
799
797
if ! pr .CanAutoMerge () {
800
798
ctx .Flash .Error (ctx .Tr ("repo.pulls.no_merge_not_ready" ))
801
- ctx .Redirect (ctx .Repo .RepoLink + "/pulls/" + com . ToStr (issue .Index ))
799
+ ctx .Redirect (ctx .Repo .RepoLink + "/pulls/" + fmt . Sprint (issue .Index ))
802
800
return
803
801
}
804
802
805
803
if pr .HasMerged {
806
804
ctx .Flash .Error (ctx .Tr ("repo.pulls.has_merged" ))
807
- ctx .Redirect (ctx .Repo .RepoLink + "/pulls/" + com . ToStr (issue .Index ))
805
+ ctx .Redirect (ctx .Repo .RepoLink + "/pulls/" + fmt . Sprint (issue .Index ))
808
806
return
809
807
}
810
808
811
809
if pr .IsWorkInProgress () {
812
810
ctx .Flash .Error (ctx .Tr ("repo.pulls.no_merge_wip" ))
813
- ctx .Redirect (ctx .Repo .RepoLink + "/pulls/" + com . ToStr (pr .Index ))
811
+ ctx .Redirect (ctx .Repo .RepoLink + "/pulls/" + fmt . Sprint (pr .Index ))
814
812
return
815
813
}
816
814
@@ -824,14 +822,14 @@ func MergePullRequest(ctx *context.Context, form auth.MergePullRequestForm) {
824
822
return
825
823
} else if ! isRepoAdmin {
826
824
ctx .Flash .Error (ctx .Tr ("repo.pulls.no_merge_not_ready" ))
827
- ctx .Redirect (ctx .Repo .RepoLink + "/pulls/" + com . ToStr (pr .Index ))
825
+ ctx .Redirect (ctx .Repo .RepoLink + "/pulls/" + fmt . Sprint (pr .Index ))
828
826
return
829
827
}
830
828
}
831
829
832
830
if ctx .HasError () {
833
831
ctx .Flash .Error (ctx .Data ["ErrorMsg" ].(string ))
834
- ctx .Redirect (ctx .Repo .RepoLink + "/pulls/" + com . ToStr (pr .Index ))
832
+ ctx .Redirect (ctx .Repo .RepoLink + "/pulls/" + fmt . Sprint (pr .Index ))
835
833
return
836
834
}
837
835
@@ -863,14 +861,14 @@ func MergePullRequest(ctx *context.Context, form auth.MergePullRequestForm) {
863
861
864
862
if ! noDeps {
865
863
ctx .Flash .Error (ctx .Tr ("repo.issues.dependency.pr_close_blocked" ))
866
- ctx .Redirect (ctx .Repo .RepoLink + "/pulls/" + com . ToStr (pr .Index ))
864
+ ctx .Redirect (ctx .Repo .RepoLink + "/pulls/" + fmt . Sprint (pr .Index ))
867
865
return
868
866
}
869
867
870
868
if err = pull_service .Merge (pr , ctx .User , ctx .Repo .GitRepo , models .MergeStyle (form .Do ), message ); err != nil {
871
869
if models .IsErrInvalidMergeStyle (err ) {
872
870
ctx .Flash .Error (ctx .Tr ("repo.pulls.invalid_merge_option" ))
873
- ctx .Redirect (ctx .Repo .RepoLink + "/pulls/" + com . ToStr (pr .Index ))
871
+ ctx .Redirect (ctx .Repo .RepoLink + "/pulls/" + fmt . Sprint (pr .Index ))
874
872
return
875
873
} else if models .IsErrMergeConflicts (err ) {
876
874
conflictError := err .(models.ErrMergeConflicts )
@@ -884,7 +882,7 @@ func MergePullRequest(ctx *context.Context, form auth.MergePullRequestForm) {
884
882
return
885
883
}
886
884
ctx .Flash .Error (flashError )
887
- ctx .Redirect (ctx .Repo .RepoLink + "/pulls/" + com . ToStr (pr .Index ))
885
+ ctx .Redirect (ctx .Repo .RepoLink + "/pulls/" + fmt . Sprint (pr .Index ))
888
886
return
889
887
} else if models .IsErrRebaseConflicts (err ) {
890
888
conflictError := err .(models.ErrRebaseConflicts )
@@ -898,17 +896,17 @@ func MergePullRequest(ctx *context.Context, form auth.MergePullRequestForm) {
898
896
return
899
897
}
900
898
ctx .Flash .Error (flashError )
901
- ctx .Redirect (ctx .Repo .RepoLink + "/pulls/" + com . ToStr (pr .Index ))
899
+ ctx .Redirect (ctx .Repo .RepoLink + "/pulls/" + fmt . Sprint (pr .Index ))
902
900
return
903
901
} else if models .IsErrMergeUnrelatedHistories (err ) {
904
902
log .Debug ("MergeUnrelatedHistories error: %v" , err )
905
903
ctx .Flash .Error (ctx .Tr ("repo.pulls.unrelated_histories" ))
906
- ctx .Redirect (ctx .Repo .RepoLink + "/pulls/" + com . ToStr (pr .Index ))
904
+ ctx .Redirect (ctx .Repo .RepoLink + "/pulls/" + fmt . Sprint (pr .Index ))
907
905
return
908
906
} else if git .IsErrPushOutOfDate (err ) {
909
907
log .Debug ("MergePushOutOfDate error: %v" , err )
910
908
ctx .Flash .Error (ctx .Tr ("repo.pulls.merge_out_of_date" ))
911
- ctx .Redirect (ctx .Repo .RepoLink + "/pulls/" + com . ToStr (pr .Index ))
909
+ ctx .Redirect (ctx .Repo .RepoLink + "/pulls/" + fmt . Sprint (pr .Index ))
912
910
return
913
911
} else if git .IsErrPushRejected (err ) {
914
912
log .Debug ("MergePushRejected error: %v" , err )
@@ -928,7 +926,7 @@ func MergePullRequest(ctx *context.Context, form auth.MergePullRequestForm) {
928
926
}
929
927
ctx .Flash .Error (flashError )
930
928
}
931
- ctx .Redirect (ctx .Repo .RepoLink + "/pulls/" + com . ToStr (pr .Index ))
929
+ ctx .Redirect (ctx .Repo .RepoLink + "/pulls/" + fmt . Sprint (pr .Index ))
932
930
return
933
931
}
934
932
ctx .ServerError ("Merge" , err )
@@ -941,7 +939,7 @@ func MergePullRequest(ctx *context.Context, form auth.MergePullRequestForm) {
941
939
}
942
940
943
941
log .Trace ("Pull request merged: %d" , pr .ID )
944
- ctx .Redirect (ctx .Repo .RepoLink + "/pulls/" + com . ToStr (pr .Index ))
942
+ ctx .Redirect (ctx .Repo .RepoLink + "/pulls/" + fmt . Sprint (pr .Index ))
945
943
}
946
944
947
945
func stopTimerIfAvailable (user * models.User , issue * models.Issue ) error {
@@ -1052,15 +1050,15 @@ func CompareAndPullRequestPost(ctx *context.Context, form auth.CreateIssueForm)
1052
1050
}
1053
1051
ctx .Flash .Error (flashError )
1054
1052
}
1055
- ctx .Redirect (ctx .Repo .RepoLink + "/pulls/" + com . ToStr (pullIssue .Index ))
1053
+ ctx .Redirect (ctx .Repo .RepoLink + "/pulls/" + fmt . Sprint (pullIssue .Index ))
1056
1054
return
1057
1055
}
1058
1056
ctx .ServerError ("NewPullRequest" , err )
1059
1057
return
1060
1058
}
1061
1059
1062
1060
log .Trace ("Pull request created: %d/%d" , repo .ID , pullIssue .ID )
1063
- ctx .Redirect (ctx .Repo .RepoLink + "/pulls/" + com . ToStr (pullIssue .Index ))
1061
+ ctx .Redirect (ctx .Repo .RepoLink + "/pulls/" + fmt . Sprint (pullIssue .Index ))
1064
1062
}
1065
1063
1066
1064
// TriggerTask response for a trigger task request
@@ -1159,7 +1157,7 @@ func CleanUpPullRequest(ctx *context.Context) {
1159
1157
1160
1158
defer func () {
1161
1159
ctx .JSON (200 , map [string ]interface {}{
1162
- "redirect" : pr .BaseRepo .Link () + "/pulls/" + com . ToStr (issue .Index ),
1160
+ "redirect" : pr .BaseRepo .Link () + "/pulls/" + fmt . Sprint (issue .Index ),
1163
1161
})
1164
1162
}()
1165
1163
0 commit comments