unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: raingloom <raingloom@riseup.net>
To: Philippe SWARTVAGHER <philippe.swartvagher@inria.fr>
Cc: 50026@debbugs.gnu.org
Subject: bug#50026: Specify a pull-request in --with-branch package transformations
Date: Thu, 12 Aug 2021 17:30:46 +0200	[thread overview]
Message-ID: <20210812173046.53151677@riseup.net> (raw)
In-Reply-To: <29e470a4-89a3-2ac1-1fbd-f4a747443fb9@inria.fr>

On Thu, 12 Aug 2021 11:38:38 +0200
Philippe SWARTVAGHER <philippe.swartvagher@inria.fr> wrote:

> Hello,
> 
> A nice feature would be to be able to use a pull-request as branch to
> specify in the `--with-branch` transformation option.
> 
> A use-case is to use a pull-request coming from a private fork, thus
> we can't use the combination `--with-git-url= with-branch=`.
> 
> 
> As an example, if I follow
> https://gitlab.inria.fr/help/user/project/merge_requests/reviews/index.md#checkout-merge-requests-locally-through-the-head-ref,
> I should be able to do something like:
> 
> ```bash
> 
> guix build chameleon --with-branch=chameleon=merge-requests/262/head
> 
> ```
> 
> (with 262 being the pull-request I'm interested in) However, this
> fails:
> 
> ```
> 
> guix build: erreur : impossible de récupérer la branche «
> merge-requests/262/head » depuis
> https://gitlab.inria.fr/solverstack/chameleon : cannot locate
> remote-tracking branch 'origin/merge-requests/262/head'
> ```
> 
> While commands stated in the documentation work well:
> 
> ```bash
> 
> git clone https://gitlab.inria.fr/solverstack/chameleon && cd
> chameleon
> 
> git fetch origin merge-requests/262/head:mr-262
> 
> git checkout mr-262
> 
> ```
> 
> I guess the fetch step is lacking in the way Guix handles the
> `--with-branch` transformation.
> 
> 
> FYI, Ansible is able to do things like that (see
> https://docs.ansible.com/ansible/latest/collections/ansible/builtin/git_module.html),
> by combining options `refspec` and `version`.
> 
> 
> I'm aware a workaround is to download the patch corresponding to the
> pull-request and using `--with-patch`, however handling it directly
> with `--with-branch` would be more handy !
> 
> Thanks,
> 

How is this different compared to just using the git URL and branch that
the pull request is from?

For example, here we have a merge request:
https://gitlab.com/guile-git/guile-git/-/merge_requests/30
From this repo:
https://gitlab.com/plattfot/guile-git
and this branch:
git_ignore_path_is_ignored

This is how merge requests work, there is always a (pretty easy to
find) source repo and branch that should be merged into a branch of the
target repo.

This is how you would build it in this case:
guix build \
--with-git-url=guile-git=https://gitlab.com/plattfot/guile-git \
--with-branch=guile-git=git_ignore_path_is_ignored guile-git

Someone could make a script that extracts this information from the
various git forges (Gitea, GitLab, GitHub, etc), but all you get is
that you can copy one URL instead of one URL and one branch name.

I'm not aware of any standard way to access merge requests that would
work across all git forges, so IMHO the implementation complexity is
not worth it for such a tiny improvement. There is more important work.




  reply	other threads:[~2021-08-12 15:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-12  9:38 bug#50026: Specify a pull-request in --with-branch package transformations Philippe SWARTVAGHER
2021-08-12 15:30 ` raingloom [this message]
2021-08-12 20:06   ` Philippe SWARTVAGHER
2021-09-14  7:43 ` Ludovic Courtès
2021-09-14  8:12   ` zimoun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210812173046.53151677@riseup.net \
    --to=raingloom@riseup.net \
    --cc=50026@debbugs.gnu.org \
    --cc=philippe.swartvagher@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).