Problem/Motivation

It's possible to "generate" a patch file based from the diff or a merge request/branch/commit/... from gitlab. This would be handy to be able to use with the new issue fork flow on Drupal.org.

Steps to reproduce

- Select widget_block as project
- Add patch: https://git.drupalcode.org/issue/widget_block-3085435/-/commit/507987fa7...
- Get the error "The patch URL must be from http://www.drupal.org/files/."

Proposed resolution

Simply also allowing https://git.drupalcode.org would resolve the issue.

Remaining tasks

Updated the Regex variable fallback.
Update the error message if something else is parsed.
Update the placeholder on the patch field.
Update documentation?
Only possible for admins on simplytest.me: Update the "Allowed patch source (simplytest_advanced_patch_source)" setting value to "^/https?:\/\/(www\.)?(?:drupal\.org\/files\/|git\.drupalcode\.org\/)/"

User interface changes

The placeholder text and error message is changed.

API changes

N/A

Data model changes

N/A

CommentFileSizeAuthor
#6 Screenshot at Dec 14 22-14-33.png112.74 KBBramDriesen

Issue fork simplytest-3188350

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

BramDriesen created an issue. See original summary.

BramDriesen’s picture

Version: 8.x-4.x-dev » 7.x-1.x-dev

I picked the wrong version obviously :)

BramDriesen’s picture

Issue summary: View changes

BramDriesen’s picture

Status: Active » Needs review
BramDriesen’s picture

Patched the logic as much as I could without testing directly. I did validate the regex expressions.

Screenshot of regex test

jhodgdon’s picture

+1 for fixing this as soon as possible:

  • Core issues with merge requests (MR) now have Preview links that open up an online testing site, so they don't need simplytest.me. But the preview can sometimes fail (I found one yesterday that did)
  • Contrib issues with MRs only have Preview links if the project has set up a Tugboat config file. Not many projects have done that.
  • If there is no Preview link, currently the only way a contributor can test the MR is to use a local dev site, but that is complex to set up
  • Manual testing of patches, making screenshots, and other things like that are excellent contributor tasks that help new contributors get used to our issues and procedures. It's important that they be able to do these tasks without having to go through a long install process, learning Git, etc. Online testing sites like simplytest.me and the Tugobat previews are a key part of that process.

Thanks!

Charles Belov’s picture

@jhodgdon I'm not seeing a preview link at either https://git.drupalcode.org/project/drupal/-/merge_requests/4656#note_209449 or https://git.drupalcode.org/project/drupal/-/merge_requests/4656#note_209449

Please advise where to look for that link.

Further, when I tried to apply a patch using simplytest.me, the console log shows:

- Applying patches for drupal/core
https://git.drupalcode.org/issue/drupal-3273986/-/commit/7bd5d37bb692615... (STM patch 7bd5d37bb6926152fd9cca21cc565824e6b034f2)
Could not apply patch! Skipping. The error was: Cannot apply patch https://git.drupalcode.org/issue/drupal-3273986/-/commit/7bd5d37bb692615...

Charles Belov’s picture

It appears this change has in fact been merged and was never marked as being complete or closed.

It turns out that I misunderstood what URL I needed to supply to simplytest.me. Once I gave it the correct URL for the patch, https://git.drupalcode.org/project/drupal/-/merge_requests/4656.patch, the console confirmed that it had been applied:

The composer patches functionality was enabled successfully.
650b568a8426b7d521a30c65# /bin/sh -c cd stm && composer patch-add drupal/core "STM patch 4656.patch" "https://git.drupalcode.org/project/drupal/-/merge_requests/4656.patch" --no-update
Gathering patches from patch file.
The patch was successfully added.

and the effects of the patch were visible when I logged into my new test instance.

It was not particularly easy for me to find that patch URL. It required multiple steps on git.drupalcode.org to find the proper patch and copy the link. It would be nice if it were documented somewhere, and I would happily file an issue for that documentation if I had any idea where the documentation actually belongs. It probably doesn't belong on the simplytest.me project.

It would be nice for the simplytest.me project to cross-link to it once the documentation exists, given that failure to supply the proper URL results in failure failure to apply the patch, and given that the redirect to the instance occurs even though there has been an error (again, a separate issue).

rachel_norfolk’s picture

Status: Needs review » Closed (duplicate)

Yes, just tested this with an 11.x link to an MR and it is accepted just fine.

Not actually sure where the change was applied to, which means I can’t reference it in the (inevitable) duplicate. Sorry.