guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] guix package: Add '--switch-generation' option.


From: Alex Kost
Subject: [PATCH] guix package: Add '--switch-generation' option.
Date: Mon, 06 Oct 2014 18:14:53 +0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Ludovic Courtès (2014-10-05 00:23 +0400) wrote:

> Alex Kost <address@hidden> skribis:>

[...]

>> - (Not related to this patch, but still …)  Currently with “roll-back”,
>>   we can only switch to the previous generation.  What about adding a
>>   possibility to switch to any generation?  So that we could use
>>   something like this:
>>
>>     guix package --switch-generation=7
>>
>>   Also such functionality can be added to Emacs UI: for example pressing
>>   "C" on a generation in *Guix Generation List* will make this
>>   generation the current one.
>>
>>   So ‘roll-back’ procedure may become a special case of the
>>   ‘switch-generation’ one.  WDYT?
>
> I think it’s a good idea!  (I think it was suggested in earlier
> discussions, but never implemented.)

Andreas Enge (2014-10-05 18:44 +0400) wrote:

[...]

> Actually, sometimes I would like to switch to the next generation ("-roll-
> forward", in a sense): I install something, go back with "--roll-back",
> and might like to go just one forward again.
>
> So how about the following:
> --switch-generation=1
> goes to generation 1;
> --switch-generation=-1
> goes 1 generation back;
> --switch-generation=+1
> goes one generation forward.

Thanks for the great idea!

————————————————————————————————————————————————————————————————
A patch is attached.  Some comments:

- ‘shitted-generation’ is not a very good name, I think.  Ideas?

- ‘previous-generation-number’ may use ‘shifted-generation’ now:

(define* (previous-generation-number profile #:optional
                                     (number (generation-number profile)))
  "Return the number of the generation before generation NUMBER of
PROFILE, or 0 if none exists.  It could be NUMBER - 1, but it's not the
case when generations have been deleted (there are \"holes\")."
  (or (shifted-generation profile -1 number)
      0))
  Worth changing?

- Perhaps it would be better to make 2 commits (?): one for adding
  ‘shifted-generation’ and ‘switch-to-generation’ procedures to (guix
  profiles) and another is for adding the “--switch-generation” option
  itself.

- Also I made a couple of cosmetic changes in “guix/scripts/package.scm”:
  * ‘filter-map’ was replaced by 'for-each' because it was called only for
    side effects there;
  * ‘begin’ was removed from ‘cond’.
  I think these changes do not deserve a separate commit and may stay in
  this patch.  Is it OK?

Attachment: 0001-guix-package-Add-switch-generation-option.patch
Description: Text Data

-- 
Thanks,
Alex

reply via email to

[Prev in Thread] Current Thread [Next in Thread]