Commit 6fbdc5ed authored by Bob Van Landuyt's avatar Bob Van Landuyt

Apply patches when creating MR via email

This allows users to add patches as attachments to merge request
created via email.

When an email to create a merge request is sent, all the attachments
ending in `.patch` will be applied to the branch specified in the
subject of the email. If the branch did not exist, it will be created
from the HEAD of the repository.

When the patches could not be applied, the error message will be
replied to the user.

The patches can have a maximum combined size of 2MB for now.
parent 6d8810a6
# frozen_string_literal: true
module Commits
class CommitPatchService < CreateService
# Requires:
# - project: `Project` to be committed into
# - user: `User` that will be the committer
# - params:
# - branch_name: `String` the branch that will be committed into
# - start_branch: `String` the branch that will will started from
# - patches: `Gitlab::Git::Patches::Collection` that contains the patches
def initialize(*args)
super
@patches = Gitlab::Git::Patches::Collection.new(Array(params[:patches]))
end
private
def new_branch?
!repository.branch_exists?(@branch_name)
end
def create_commit!
if @start_branch && new_branch?
prepare_branch!
end
Gitlab::Git::Patches::CommitPatches
.new(current_user, project.repository, @branch_name, @patches)
.commit
end
def prepare_branch!
branch_result = CreateBranchService.new(project, current_user)
.execute(@branch_name, @start_branch)
if branch_result[:status] != :success
raise ChangeError, branch_result[:message]
end
end
# Overridden from the Commits::CreateService, to skip some validations we
# don't need:
# - validate_on_branch!
# Not needed, the patches are applied on top of HEAD if the branch did not
# exist
# - validate_branch_existence!
# Not needed because we continue applying patches on the branch if it
# already existed, and create it if it did not exist.
def validate!
validate_patches!
validate_new_branch_name! if new_branch?
validate_permissions!
end
def validate_patches!
raise_error("Patches are too big") unless @patches.valid_size?
end
end
end
...@@ -19,7 +19,12 @@ module Commits ...@@ -19,7 +19,12 @@ module Commits
new_commit = create_commit! new_commit = create_commit!
success(result: new_commit) success(result: new_commit)
rescue ValidationError, ChangeError, Gitlab::Git::Index::IndexError, Gitlab::Git::CommitError, Gitlab::Git::PreReceiveError => ex rescue ValidationError,
ChangeError,
Gitlab::Git::Index::IndexError,
Gitlab::Git::CommitError,
Gitlab::Git::PreReceiveError,
Gitlab::Git::CommandError => ex
error(ex.message) error(ex.message)
end end
......
...@@ -6,8 +6,10 @@ module MergeRequests ...@@ -6,8 +6,10 @@ module MergeRequests
def execute def execute
@params_issue_iid = params.delete(:issue_iid) @params_issue_iid = params.delete(:issue_iid)
self.merge_request = MergeRequest.new
merge_quick_actions_into_params!(merge_request)
merge_request.assign_attributes(params)
self.merge_request = MergeRequest.new(params)
merge_request.author = current_user merge_request.author = current_user
merge_request.compare_commits = [] merge_request.compare_commits = []
merge_request.source_project = find_source_project merge_request.source_project = find_source_project
......
...@@ -40,6 +40,8 @@ class EmailReceiverWorker ...@@ -40,6 +40,8 @@ class EmailReceiverWorker
"You are not allowed to perform this action. If you believe this is in error, contact a staff member." "You are not allowed to perform this action. If you believe this is in error, contact a staff member."
when Gitlab::Email::NoteableNotFoundError when Gitlab::Email::NoteableNotFoundError
"The thread you are replying to no longer exists, perhaps it was deleted? If you believe this is in error, contact a staff member." "The thread you are replying to no longer exists, perhaps it was deleted? If you believe this is in error, contact a staff member."
when Gitlab::Email::InvalidAttachment
error.message
when Gitlab::Email::InvalidRecordError when Gitlab::Email::InvalidRecordError
can_retry = true can_retry = true
error.message error.message
......
---
title: Allow adding patches when creating a merge request via email
merge_request: 22723
author: Serdar Dogruyol
type: added
...@@ -166,6 +166,23 @@ administrator to do so. ...@@ -166,6 +166,23 @@ administrator to do so.
![Create new merge requests by email](img/create_from_email.png) ![Create new merge requests by email](img/create_from_email.png)
### Adding patches when creating a merge request via e-mail
> **Note**: This feature was [implemented in GitLab 11.5](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/22723)
You can add commits to the merge request being created by adding
patches as attachments to the email, all attachments with a filename
ending in `.patch` will be considered patches. The patches will be processed
ordered by name.
The combined size of the patches can be 2MB.
If the source branch from the subject does not exist, it will be
created from the repository's HEAD or the specified target branch to
apply the patches. The target branch can be specified using the
[`/target_branch` quick action](../quick_actions.md). If the source
branch already exists, the patches will be applied on top of it.
## Find the merge request that introduced a change ## Find the merge request that introduced a change
> **Note**: this feature was [implemented in GitLab 10.5](https://gitlab.com/gitlab-org/gitlab-ce/issues/2383). > **Note**: this feature was [implemented in GitLab 10.5](https://gitlab.com/gitlab-org/gitlab-ce/issues/2383).
......
...@@ -44,10 +44,26 @@ module Gitlab ...@@ -44,10 +44,26 @@ module Gitlab
@project ||= Project.find_by_full_path(project_path) @project ||= Project.find_by_full_path(project_path)
end end
def metrics_params
super.merge(includes_patches: patch_attachments.any?)
end
private private
def build_merge_request
MergeRequests::BuildService.new(project, author, merge_request_params).execute
end
def create_merge_request def create_merge_request
merge_request = MergeRequests::BuildService.new(project, author, merge_request_params).execute merge_request = build_merge_request
if patch_attachments.any?
apply_patches_to_source_branch(start_branch: merge_request.target_branch)
remove_patch_attachments
# Rebuild the merge request as the source branch might just have
# been created, so we should re-validate.
merge_request = build_merge_request
end
if merge_request.errors.any? if merge_request.errors.any?
merge_request merge_request
...@@ -59,12 +75,42 @@ module Gitlab ...@@ -59,12 +75,42 @@ module Gitlab
def merge_request_params def merge_request_params
params = { params = {
source_project_id: project.id, source_project_id: project.id,
source_branch: mail.subject, source_branch: source_branch,
target_project_id: project.id target_project_id: project.id
} }
params[:description] = message if message.present? params[:description] = message if message.present?
params params
end end
def apply_patches_to_source_branch(start_branch:)
patches = patch_attachments.map { |patch| patch.body.decoded }
result = Commits::CommitPatchService
.new(project, author, branch_name: source_branch, patches: patches, start_branch: start_branch)
.execute
if result[:status] != :success
message = "Could not apply patches to #{source_branch}:\n#{result[:message]}"
raise InvalidAttachment, message
end
end
def remove_patch_attachments
patch_attachments.each { |patch| mail.parts.delete(patch) }
# reset the message, so it needs to be reporocessed when the attachments
# have been modified
@message = nil
end
def patch_attachments
@patches ||= mail.attachments
.select { |attachment| attachment.filename.ends_with?('.patch') }
.sort_by(&:filename)
end
def source_branch
@source_branch ||= mail.subject
end
end end
end end
end end
......
...@@ -18,6 +18,7 @@ module Gitlab ...@@ -18,6 +18,7 @@ module Gitlab
InvalidIssueError = Class.new(InvalidRecordError) InvalidIssueError = Class.new(InvalidRecordError)
InvalidMergeRequestError = Class.new(InvalidRecordError) InvalidMergeRequestError = Class.new(InvalidRecordError)
UnknownIncomingEmail = Class.new(ProcessingError) UnknownIncomingEmail = Class.new(ProcessingError)
InvalidAttachment = Class.new(ProcessingError)
class Receiver class Receiver
def initialize(raw) def initialize(raw)
......
# frozen_string_literal: true
module Gitlab
module Git
module Patches
class Collection
MAX_PATCH_SIZE = 2.megabytes
def initialize(one_or_more_patches)
@patches = Array(one_or_more_patches).map do |patch_content|
Gitlab::Git::Patches::Patch.new(patch_content)
end
end
def content
@patches.map(&:content).join("\n")
end
def valid_size?
size < MAX_PATCH_SIZE
end
# rubocop: disable CodeReuse/ActiveRecord
# `@patches` is not an `ActiveRecord` relation, but an `Enumerable`
# We're using sum from `ActiveSupport`
def size
@size ||= @patches.sum(&:size)
end
# rubocop: enable CodeReuse/ActiveRecord
end
end
end
end
# frozen_string_literal: true
module Gitlab
module Git
module Patches
class CommitPatches
include Gitlab::Git::WrapsGitalyErrors
def initialize(user, repository, branch, patch_collection)
@user, @repository, @branch, @patches = user, repository, branch, patch_collection
end
def commit
repository.with_cache_hooks do
wrapped_gitaly_errors do
operation_service.user_commit_patches(user, branch, patches.content)
end
end
end
private
attr_reader :user, :repository, :branch, :patches
def operation_service
repository.raw.gitaly_operation_client
end
end
end
end
end
# frozen_string_literal: true
module Gitlab
module Git
module Patches
class Patch
attr_reader :content
def initialize(content)
@content = content
end
def size
content.bytesize
end
end
end
end
end
...@@ -299,6 +299,29 @@ module Gitlab ...@@ -299,6 +299,29 @@ module Gitlab
Gitlab::Git::OperationService::BranchUpdate.from_gitaly(response.branch_update) Gitlab::Git::OperationService::BranchUpdate.from_gitaly(response.branch_update)
end end
def user_commit_patches(user, branch_name, patches)
header = Gitaly::UserApplyPatchRequest::Header.new(
repository: @gitaly_repo,
user: Gitlab::Git::User.from_gitlab(user).to_gitaly,
target_branch: encode_binary(branch_name)
)
reader = binary_stringio(patches)
chunks = Enumerator.new do |chunk|
chunk.yield Gitaly::UserApplyPatchRequest.new(header: header)
until reader.eof?
patch_chunk = reader.read(MAX_MSG_SIZE)
chunk.yield(Gitaly::UserApplyPatchRequest.new(patches: patch_chunk))
end
end
response = GitalyClient.call(@repository.storage, :operation_service, :user_apply_patch, chunks)
Gitlab::Git::OperationService::BranchUpdate.from_gitaly(response.branch_update)
end
private private
def call_cherry_pick_or_revert(rpc, user:, commit:, branch_name:, message:, start_branch_name:, start_repository:) def call_cherry_pick_or_revert(rpc, user:, commit:, branch_name:, message:, start_branch_name:, start_repository:)
......
From: "Jake the Dog" <jake@adventuretime.ooo>
To: incoming+gitlabhq/gitlabhq+merge-request+auth_token@appmail.adventuretime.ooo
Subject: new-branch-with-a-patch
Date: Wed, 31 Oct 2018 17:27:52 +0100
X-Mailer: MailMate (1.12r5523)
Message-ID: <7BE7C2E6-F0D9-4C85-9F55-B2A4BA01BFEC@gitlab.com>
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="=_MailMate_D2C4B06A-4F8D-4AAB-B247-C507E35AAED6_="
--=_MailMate_D2C4B06A-4F8D-4AAB-B247-C507E35AAED6_=
This applies nicely to a branch freshly created from the root-ref
The other attachments in this email are ignored
--=_MailMate_D2C4B06A-4F8D-4AAB-B247-C507E35AAED6_=
Content-Disposition: attachment;
filename=0002-This-does-not-apply-to-the-feature-branch.patch
Content-Transfer-Encoding: quoted-printable
=46rom 00c68c2b4f954370ce82a1162bc29c13f524897e Mon Sep 17 00:00:00 2001
From: Patch user <patchuser@gitlab.org>
Date: Mon, 22 Oct 2018 11:05:48 +0200
Subject: [PATCH] This does not apply to the `feature` branch
---
files/ruby/feature.rb | 5 +++++
1 file changed, 5 insertions(+)
create mode 100644 files/ruby/feature.rb
diff --git a/files/ruby/feature.rb b/files/ruby/feature.rb
new file mode 100644
index 0000000..fef26e4
--- /dev/null
+++ b/files/ruby/feature.rb
@@ -0,0 +1,5 @@
+class Feature
+ def bar
+ puts 'foo'
+ end
+end
-- =
2.19.1
--=_MailMate_D2C4B06A-4F8D-4AAB-B247-C507E35AAED6_=
Content-Disposition: attachment; filename=0001-A-commit-from-a-patch.patch
Content-Transfer-Encoding: quoted-printable
=46rom 3fee0042e610fb3563e4379e316704cb1210f3de Mon Sep 17 00:00:00 2001
From: Patch user <patchuser@gitlab.org>
Date: Thu, 18 Oct 2018 13:40:35 +0200
Subject: [PATCH] A commit from a patch
---
README | 2 ++
1 file changed, 2 insertions(+)
diff --git a/README b/README
index 3742e48..e40a3b9 100644
--- a/README
+++ b/README
@@ -1 +1,3 @@
Sample repo for testing gitlab features
+
+This was applied in a patch!
-- =
2.19.1
--=_MailMate_D2C4B06A-4F8D-4AAB-B247-C507E35AAED6_=
Content-Disposition: attachment; filename=really-not-a-patch.png
Content-Type: image/png
Content-Transfer-Encoding: base64
iVBORw0KGgoAAAANSUhEUgAAAjMAAAAfCAYAAAASo0ymAAABfGlDQ1BJQ0MgUHJvZmlsZQAAKJFj
YGAqSSwoyGFhYGDIzSspCnJ3UoiIjFJgv8PAzcDDIMRgxSCemFxc4BgQ4MOAE3y7xsAIoi/rgsxK
8/x506a1fP4WNq+ZclYlOrj1gQF3SmpxMgMDIweQnZxSnJwLZOcA2TrJBUUlQPYMIFu3vKQAxD4B
ZIsUAR0IZN8BsdMh7A8gdhKYzcQCVhMS5AxkSwDZAkkQtgaInQ5hW4DYyRmJKUC2B8guiBvAgNPD
RcHcwFLXkYC7SQa5OaUwO0ChxZOaFxoMcgcQyzB4MLgwKDCYMxgwWDLoMjiWpFaUgBQ65xdUFmWm
Z5QoOAJDNlXBOT+3oLQktUhHwTMvWU9HwcjA0ACkDhRnEKM/B4FNZxQ7jxDLX8jAYKnMwMDcgxBL
msbAsH0PA4PEKYSYyjwGBn5rBoZt5woSixLhDmf8xkKIX5xmbARh8zgxMLDe+///sxoDA/skBoa/
E////73o//+/i4H2A+PsQA4AJHdp4IxrEg8AAAGcaVRYdFhNTDpjb20uYWRvYmUueG1wAAAAAAA8
eDp4bXBtZXRhIHhtbG5zOng9Im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karzG9l8ci/10KW6G39339nU7D645l4i0Ns2WCy36UuoNljv
BcFkivCSSOltR0fppcze0kTdb9T3Rf/Ce5p8fHrQysOKxkZ7b4zR5J/Oqu1vY8UOA5Z+thRx5EvT
PRvN+aC30IRrZLtFP71y0VZLI+gNfhho+NJIyR119AV40d8PS2Oj+GhgECbKeWQXYJd0Es/qB3vc
E+uGJqpcA4KDDAj3CKfj2q9O2GRiWPyVFVdd1VueqkJNBVjjgLWcJuWdurC+9aY/P//tiwj3fwqJ
UIWdNJnp1NHFjfNAwJ7MAG9mvgvpzVAPxfguToAT4AQ4AU7ASUCvZIZ9mMmpmq9wAu0J3Gu1z9Bk
famovQS+hxPgBDgBToAT8I0A75nxjRs/y42ApaEGV24Go08CfYzP7Rjf5AQ4AU6AE+AEPBHQq2fG
YzLjSSHfxwlwApwAJ8AJcAKcQGck8IvOaBS3iRPgBDgBToAT4AQ4AVYCPJlhJcXLcQKcACfACXAC
nECnJMCTmU5ZLdwoToAT4AQ4AU6AE2AlwJMZVlK8HCfACXACnAAnwAl0SgI8memU1cKN4gQ4AU6A
E+AEOAFWAv8PxvdR0yK8jugAAAAASUVORK5CYII=
--=_MailMate_D2C4B06A-4F8D-4AAB-B247-C507E35AAED6_=--
From: "Jake the Dog" <jake@adventuretime.ooo>
To: incoming+gitlabhq/gitlabhq+merge-request+auth_token@appmail.adventuretime.ooo
Subject: feature
Date: Wed, 31 Oct 2018 17:27:52 +0100
X-Mailer: MailMate (1.12r5523)
Message-ID: <7BE7C2E6-F0D9-4C85-9F55-B2A4BA01BFEC@gitlab.com>
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="=_MailMate_D2C4B06A-4F8D-4AAB-B247-C507E35AAED6_="
--=_MailMate_D2C4B06A-4F8D-4AAB-B247-C507E35AAED6_=
This does not apply
--=_MailMate_D2C4B06A-4F8D-4AAB-B247-C507E35AAED6_=
Content-Disposition: attachment;
filename=0002-This-does-not-apply-to-the-feature-branch.patch
Content-Transfer-Encoding: quoted-printable
=46rom 00c68c2b4f954370ce82a1162bc29c13f524897e Mon Sep 17 00:00:00 2001
From: Patch user <patchuser@gitlab.org>
Date: Mon, 22 Oct 2018 11:05:48 +0200
Subject: [PATCH] This does not apply to the `feature` branch
---
files/ruby/feature.rb | 5 +++++
1 file changed, 5 insertions(+)
create mode 100644 files/ruby/feature.rb
diff --git a/files/ruby/feature.rb b/files/ruby/feature.rb
new file mode 100644
index 0000000..fef26e4
--- /dev/null
+++ b/files/ruby/feature.rb
@@ -0,0 +1,5 @@
+class Feature
+ def bar
+ puts 'foo'
+ end
+end
-- =
2.19.1
--=_MailMate_D2C4B06A-4F8D-4AAB-B247-C507E35AAED6_=--
From: "Jake the Dog" <jake@adventuretime.ooo>
To: incoming+gitlabhq/gitlabhq+merge-request+auth_token@appmail.adventuretime.ooo
Subject: new-branch-with-a-patch
Date: Wed, 24 Oct 2018 16:39:49 +0200
X-Mailer: MailMate (1.12r5523)
Message-ID: <F1F36291-728D-4E8F-AFEB-C398B8D9BB4E@gitlab.com>
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="=_MailMate_D2C4B06A-4F8D-4AAB-B247-C507E35AAED6_="
--=_MailMate_D2C4B06A-4F8D-4AAB-B247-C507E35AAED6_=
This applies nicely to a branch freshly created from the root-ref
The other attachments in this email are ignored
/target_branch with-codeowners
--=_MailMate_D2C4B06A-4F8D-4AAB-B247-C507E35AAED6_=
Content-Disposition: attachment; filename=0001-A-commit-from-a-patch.patch
Content-Transfer-Encoding: quoted-printable
=46rom 3fee0042e610fb3563e4379e316704cb1210f3de Mon Sep 17 00:00:00 2001
From: Patch user <patchuser@gitlab.org>
Date: Thu, 18 Oct 2018 13:40:35 +0200
Subject: [PATCH] A commit from a patch
---
README | 2 ++
1 file changed, 2 insertions(+)
diff --git a/README b/README
index 3742e48..e40a3b9 100644
--- a/README
+++ b/README
@@ -1 +1,3 @@
Sample repo for testing gitlab features
+
+This was applied in a patch!
-- =
2.19.1
From: "Jake the Dog" <jake@adventuretime.ooo>
To: incoming+gitlabhq/gitlabhq+merge-request+auth_token@appmail.adventuretime.ooo
Subject: new-branch-with-a-patch
Date: Wed, 24 Oct 2018 16:39:49 +0200
X-Mailer: MailMate (1.12r5523)
Message-ID: <F1F36291-728D-4E8F-AFEB-C398B8D9BB4E@gitlab.com>
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="=_MailMate_D2C4B06A-4F8D-4AAB-B247-C507E35AAED6_="
--=_MailMate_D2C4B06A-4F8D-4AAB-B247-C507E35AAED6_=
This applies nicely to a branch freshly created from the root-ref
The other attachments in this email are ignored
--=_MailMate_D2C4B06A-4F8D-4AAB-B247-C507E35AAED6_=
Content-Disposition: attachment; filename=0001-A-commit-from-a-patch.patch
Content-Transfer-Encoding: quoted-printable
=46rom 3fee0042e610fb3563e4379e316704cb1210f3de Mon Sep 17 00:00:00 2001
From: Patch user <patchuser@gitlab.org>
Date: Thu, 18 Oct 2018 13:40:35 +0200
Subject: [PATCH] A commit from a patch
---
README | 2 ++
1 file changed, 2 insertions(+)
diff --git a/README b/README
index 3742e48..e40a3b9 100644
--- a/README
+++ b/README
@@ -1 +1,3 @@
Sample repo for testing gitlab features
+
+This was applied in a patch!
-- =
2.19.1
--=_MailMate_D2C4B06A-4F8D-4AAB-B247-C507E35AAED6_=
Content-Disposition: attachment; filename=really-not-a-patch.png
Content-Type: image/png
Content-Transfer-Encoding: base64
iVBORw0KGgoAAAANSUhEUgAAAjMAAAAfCAYAAAASo0ymAAABfGlDQ1BJQ0MgUHJvZmlsZQAAKJFj
YGAqSSwoyGFhYGDIzSspCnJ3UoiIjFJgv8PAzcDDIMRgxSCemFxc4BgQ4MOAE3y7xsAIoi/rgsxK
8/x506a1fP4WNq+ZclYlOrj1gQF3SmpxMgMDIweQnZxSnJwLZOcA2TrJBUUlQPYMIFu3vKQAxD4B
ZIsUAR0IZN8BsdMh7A8gdhKYzcQCVhMS5AxkSwDZAkkQtgaInQ5hW4DYyRmJKUC2B8guiBvAgNP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