diff --git a/README.md b/README.md index 95df610..0251b5c 100644 --- a/README.md +++ b/README.md @@ -57,10 +57,11 @@ Example .gitreview file (used to upload for git-review itself) host=review.openstack.org port=29418 project=openstack-ci/git-review.git + defaultbranch=master Required values: host, project -Optional values: port +Optional values: port (default: 29418), defaultbranch (default: master) ### Notes * Username not required because it is requested on first run diff --git a/git-review b/git-review index 5d06367..411ca6a 100755 --- a/git-review +++ b/git-review @@ -279,17 +279,19 @@ def check_color_support(): def get_config(): """Get the configuration options set in the .gitremote file, if present.""" - """Returns a hashmap with hostname, port and project.""" + """Returns a hashmap with hostname, port, project and defaultbranch.""" """If there is no .gitremote file, default values will be used.""" - config = dict(hostname=False, port='29418', project=False) + config = dict(hostname=False, port='29418', project=False, + defaultbranch='master') top_dir = run_command('git rev-parse --show-toplevel') target_file = os.path.join(top_dir, ".gitreview") if os.path.exists(target_file): - configParser = ConfigParser.ConfigParser(dict(port='29418')) + configParser = ConfigParser.ConfigParser(config) configParser.read(target_file) config['hostname'] = configParser.get("gerrit", "host") config['port'] = configParser.get("gerrit", "port") config['project'] = configParser.get("gerrit", "project") + config['defaultbranch'] = configParser.get("gerrit", "defaultbranch") return config @@ -581,7 +583,7 @@ def main(): parser.add_argument("--version", action="version", version='%s version %s' % \ (os.path.split(sys.argv[0])[-1], version)) - parser.add_argument("branch", nargs="?", default="master") + parser.add_argument("branch", nargs="?", default=config['defaultbranch']) parser.set_defaults(dry=False, rebase=True, verbose=False, update=False, setup=False, yes=False, remote="gerrit") diff --git a/git-review.1 b/git-review.1 index b7965d5..6364fbf 100644 --- a/git-review.1 +++ b/git-review.1 @@ -101,6 +101,7 @@ information about your gerrit installation in it. The format is: host=review.example.com port=29418 project=project.git +defaultbranch=master .ft P .fi .SH AUTHOR