Allow per-user override of -R setting.

Introduce "gitreview.rebase" user configuration
option.

Change-Id: I96dfab1af48d8f1592766fea4b97e0f35c03d8a5
This commit is contained in:
Marcin Cieslak 2013-02-11 01:16:02 +01:00 committed by Clark Boylan
parent 279774db59
commit 254da41997
2 changed files with 31 additions and 1 deletions

View File

@ -917,6 +917,11 @@ def finish_branch(target_branch):
print("Deleted branch '%s'" % local_branch) print("Deleted branch '%s'" % local_branch)
def convert_bool(one_or_zero):
"Return a bool on a one or zero string."
return one_or_zero in ["1", "true", "True"]
def print_exit_message(status, needs_update): def print_exit_message(status, needs_update):
if needs_update: if needs_update:
@ -939,6 +944,10 @@ def main():
config = get_config(os.path.join(top_dir, ".gitreview")) config = get_config(os.path.join(top_dir, ".gitreview"))
hook_file = os.path.join(git_dir, "hooks", "commit-msg") hook_file = os.path.join(git_dir, "hooks", "commit-msg")
defaultrebase = convert_bool(
git_config_get_value("gitreview", "rebase",
default=str(config['defaultrebase'])))
usage = "git review [OPTIONS] ... [BRANCH]" usage = "git review [OPTIONS] ... [BRANCH]"
import argparse import argparse
@ -1037,7 +1046,7 @@ def main():
parser.add_argument("branch", nargs="?", default=config['defaultbranch']) parser.add_argument("branch", nargs="?", default=config['defaultbranch'])
parser.set_defaults(dry=False, parser.set_defaults(dry=False,
draft=False, draft=False,
rebase=config['defaultrebase'], rebase=defaultrebase,
verbose=False, verbose=False,
update=False, update=False,
setup=False, setup=False,

View File

@ -179,6 +179,27 @@ file:
[gitreview] [gitreview]
username=\fImygerrituser\fP username=\fImygerrituser\fP
.Ed .Ed
.It gireview.rebase
This setting determines whether changes submitted will
be rebased to the newest state of the branch.
.Pp
A value of 'true' or 'false' should be specified.
.Bl -tag
.It false
Do not rebase changes on submit - equivalent to setting
.Fl R
when submitting changes.
.It true
Do rebase changes on submit. This is the default value unless
overridden by
.Pa .gitreview
file.
.El
.Pp
This setting takes precedence over repository-specific configuration
in the
.Pa .gitreview
file.
.El .El
.Sh FILES .Sh FILES
To use To use