pull: '--url', '--commit', and '--branch' apply to the 'guix' channel.

Suggested by pkill9 <pkill9@runbox.com>.

* guix/scripts/pull.scm (channel-list): Apply REF and URL to the 'guix'
channel.
* doc/guix.texi (Invoking guix pull): Adjust accordingly.
This commit is contained in:
Ludovic Courtès 2019-04-17 13:56:40 +02:00
parent 14755829dc
commit 72f749dcb8
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
3 changed files with 15 additions and 15 deletions

View File

@ -3646,8 +3646,9 @@ but it supports the following options:
@item --url=@var{url} @item --url=@var{url}
@itemx --commit=@var{commit} @itemx --commit=@var{commit}
@itemx --branch=@var{branch} @itemx --branch=@var{branch}
Download code from the specified @var{url}, at the given @var{commit} (a valid Download code for the @code{guix} channel from the specified @var{url}, at the
Git commit ID represented as a hexadecimal string), or @var{branch}. given @var{commit} (a valid Git commit ID represented as a hexadecimal
string), or @var{branch}.
@cindex @file{channels.scm}, configuration file @cindex @file{channels.scm}, configuration file
@cindex configuration file for channels @cindex configuration file for channels

View File

@ -52,6 +52,7 @@
channel-location channel-location
%default-channels %default-channels
guix-channel?
channel-instance? channel-instance?
channel-instance-channel channel-instance-channel

View File

@ -502,24 +502,22 @@ Use '~/.config/guix/channels.scm' instead."))
(url (or (assoc-ref opts 'repository-url) (url (or (assoc-ref opts 'repository-url)
(environment-variable)))) (environment-variable))))
(if (or ref url) (if (or ref url)
(match channels (match (find guix-channel? channels)
((one) ((? channel? guix)
;; When there's only one channel, apply '--url', '--commit', and ;; Apply '--url', '--commit', and '--branch' to the 'guix' channel.
;; '--branch' to this specific channel. (let ((url (or url (channel-url guix))))
(let ((url (or url (channel-url one)))) (cons (match ref
(list (match ref
(('commit . commit) (('commit . commit)
(channel (inherit one) (channel (inherit guix)
(url url) (commit commit) (branch #f))) (url url) (commit commit) (branch #f)))
(('branch . branch) (('branch . branch)
(channel (inherit one) (channel (inherit guix)
(url url) (commit #f) (branch branch))) (url url) (commit #f) (branch branch)))
(#f (#f
(channel (inherit one) (url url))))))) (channel (inherit guix) (url url))))
(_ (remove guix-channel? channels))))
;; Otherwise bail out. (#f ;no 'guix' channel, failure will ensue
(leave channels))
(G_ "'--url', '--commit', and '--branch' are not applicable~%"))))
channels))) channels)))