Project

General

Profile

Actions

Feature #5687

closed

system_patches add possibility to add pull-request

Added by jeroen van breedam over 8 years ago. Updated over 8 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Start date:
12/23/2015
Due date:
% Done:

0%

Estimated time:
Plus Target Version:
Release Notes:

Description

Lots of committers use the github editor (including myself).
The edit generates a commit for each file.

So, most of the pull-requests have multiple commits to fix a single issue.
To test these fixes, you now have to add multiple commit-id's to system_patches in order to see it in action.

Would it be a good idea to also allow a PR-url to be added as a patch ?
The github API makes it fairly easy to get all the commit-id's for a single pull-request.

demo code:

<?php
function get_content_from_github($url) {
    $ch = curl_init();
    curl_setopt($ch,CURLOPT_URL,$url);
    curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); 
    curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,1);
    //To comply with https://developer.github.com/v3/#user-agent-required
    curl_setopt($ch, CURLOPT_USERAGENT, "nothing"); 
    $content = curl_exec($ch);
    curl_close($ch);
    return $content;
}

function get_PR_commit_ids_from_github($url)
{
    $response=get_content_from_github($url);
    $json=json_decode($response, true);
    //var_dump($json);
    if(!empty($json)) {
        foreach($json as $item) {
            if(preg_match("/^[0-9a-f]{5,40}$/", $item['sha'])) {
                $result[] = $item['sha'];
            }
            else {
                $result = "";
            }
        }
    }
    else {
        $result = "" ;
    }

    return $result ; 
}

print_r(get_PR_commit_ids_from_github('https://api.github.com/repos/pfsense/pfsense/pulls/2318/commits'));

?>

Actions #1

Updated by Renato Botelho over 8 years ago

github allow to get a single diff for a Pull Request with all commits combined, you just need to add the suffix .diff in the end of PR URL

https://github.com/pfsense/pfsense/pull/NNNN.diff

Actions #2

Updated by jeroen van breedam over 8 years ago

right, luckily i didn't start on implementing this into system_patches

@rbgarga: got a github cheat-sheet somewhere for this kind of stuff ?

Actions #3

Updated by Renato Botelho over 8 years ago

  • Status changed from New to Rejected

Not sure, the only page I remember is https://github.com/blog/967-github-secrets

I'm closing this ticket

Actions #4

Updated by Chris Buechler over 8 years ago

  • Target version deleted (2.3)
Actions

Also available in: Atom PDF