cherry-picker icon indicating copy to clipboard operation
cherry-picker copied to clipboard

Add a way to configure user preferences

Open Jackenmen opened this issue 4 years ago • 1 comments

At this point(where we have --pr-remote, --[no-]push, --upstream-remote (#35), and --no-auto-pr (#36) flags, it seems worth considering adding some way to configure user preferences on a global and perhaps local level.

The most obvious solution seems to be using git config since it supports both global and local user configuration already, it is used by cherry-picker already, and therefore should be relatively straight-forward. Small note here: I think it would be better to choose a different section than cherry-picker as currently cherry-picker suggest to use git config --local --remove-section cherry-picker as last resort for resetting cherry-picker's state.

Of course, there could instead be a single file at some configuration path (~/.config/cherry_picker/preferences.toml?) for setting both global and local level preferences, i.e.:

[global]
upstream_remote = "the_real_deal"
pr_remote = "mine"
no_auto_pr = true

# I'm not entirely sold on the idea of using paths, but it would be the simplest to implement for sure
[local."/home/jack/CPython"]
upstream_remote = "python"

but I don't know if there are any upsides to this over just using git config

Jackenmen avatar Aug 07 '21 01:08 Jackenmen

Note: --no-push and -no-auto-pr should ideally be set separately for regular cherry_picker run and for cherry_picker --continue so that one can have a workflow like this (otherwise it won't be possible to configure it as such after #43 is merged) using only the user preferences:

# cherry-pick but don't push:
cherry_picker --no-push COMMIT_SHA1 BRANCH
# after successful cherry-pick, continue with a push and PR using:
cherry_picker --continue

Jackenmen avatar Aug 07 '21 18:08 Jackenmen