From 254da41997ee39530b93dc05adea3254416acfa2 Mon Sep 17 00:00:00 2001 From: Marcin Cieslak Date: Mon, 11 Feb 2013 01:16:02 +0100 Subject: [PATCH] Allow per-user override of -R setting. Introduce "gitreview.rebase" user configuration option. Change-Id: I96dfab1af48d8f1592766fea4b97e0f35c03d8a5 --- git-review | 11 ++++++++++- git-review.1 | 21 +++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/git-review b/git-review index 29c975d..8dcb58a 100755 --- a/git-review +++ b/git-review @@ -917,6 +917,11 @@ def finish_branch(target_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): if needs_update: @@ -939,6 +944,10 @@ def main(): config = get_config(os.path.join(top_dir, ".gitreview")) 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]" import argparse @@ -1037,7 +1046,7 @@ def main(): parser.add_argument("branch", nargs="?", default=config['defaultbranch']) parser.set_defaults(dry=False, draft=False, - rebase=config['defaultrebase'], + rebase=defaultrebase, verbose=False, update=False, setup=False, diff --git a/git-review.1 b/git-review.1 index a369779..a46d0e7 100644 --- a/git-review.1 +++ b/git-review.1 @@ -179,6 +179,27 @@ file: [gitreview] username=\fImygerrituser\fP .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 .Sh FILES To use