From b9f2751b8797b19b3255ca20a88597310929e04d Mon Sep 17 00:00:00 2001 From: "pgervais@chromium.org" Date: Fri, 8 Aug 2014 15:52:33 +0000 Subject: [PATCH] Added hyphen-only options Some options have words separated by underscores. Added options with same name and underscores replaced by hyphens. BUG=400953 Review URL: https://codereview.chromium.org/436963005 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@288366 0039d316-1c4b-4281-b951-d872f2087c98 --- git_cache.py | 8 +++++--- git_cl.py | 5 ++++- git_new_branch.py | 3 ++- git_rebase_update.py | 3 ++- git_reparent_branch.py | 2 +- man/src/depot_tools_tutorial.demo.walkthrough.sh | 2 +- man/src/git-rebase-update.txt | 6 +++--- tests/git_rebase_update_test.py | 4 ++-- 8 files changed, 20 insertions(+), 13 deletions(-) diff --git a/git_cache.py b/git_cache.py index 1fa7e45568..7ebe5800f7 100755 --- a/git_cache.py +++ b/git_cache.py @@ -522,7 +522,7 @@ def CMDupdate_bootstrap(parser, args): # First, we need to ensure the cache is populated. populate_args = args[:] - populate_args.append('--no_bootstrap') + populate_args.append('--no-bootstrap') CMDpopulate(parser, populate_args) # Get the repo directory. @@ -542,9 +542,11 @@ def CMDpopulate(parser, args): help='Only cache 10000 commits of history') parser.add_option('--ref', action='append', help='Specify additional refs to be fetched') - parser.add_option('--no_bootstrap', action='store_true', + parser.add_option('--no_bootstrap', '--no-bootstrap', + action='store_true', help='Don\'t bootstrap from Google Storage') - parser.add_option('--ignore_locks', action='store_true', + parser.add_option('--ignore_locks', '--ignore-locks', + action='store_true', help='Don\'t try to lock repository') options, args = parser.parse_args(args) diff --git a/git_cl.py b/git_cl.py index 77f4a9e9f1..acc6830d15 100755 --- a/git_cl.py +++ b/git_cl.py @@ -1718,7 +1718,9 @@ def CMDupload(parser, args): help='cc email addresses') parser.add_option('-s', '--send-mail', action='store_true', help='send email to reviewer immediately') - parser.add_option("--emulate_svn_auto_props", action="store_true", + parser.add_option('--emulate_svn_auto_props', + '--emulate-svn-auto-props', + action="store_true", dest="emulate_svn_auto_props", help="Emulate Subversion's auto properties feature.") parser.add_option('-c', '--use-commit-queue', action='store_true', @@ -1726,6 +1728,7 @@ def CMDupload(parser, args): parser.add_option('--private', action='store_true', help='set the review private (rietveld only)') parser.add_option('--target_branch', + '--target-branch', help='When uploading to gerrit, remote branch to ' 'use for CL. Default: master') parser.add_option('--email', default=None, diff --git a/git_new_branch.py b/git_new_branch.py index 6c3f39f7e6..18ce0180b7 100755 --- a/git_new_branch.py +++ b/git_new_branch.py @@ -18,7 +18,8 @@ def main(args): ) parser.add_argument('branch_name') g = parser.add_mutually_exclusive_group() - g.add_argument('--upstream_current', action='store_true', + g.add_argument('--upstream-current', '--upstream_current', + action='store_true', help='set upstream branch to current branch.') g.add_argument('--upstream', metavar='REF', default=root(), help='upstream branch (or tag) to track.') diff --git a/git_rebase_update.py b/git_rebase_update.py index f87f43b873..09eaffa0f8 100755 --- a/git_rebase_update.py +++ b/git_rebase_update.py @@ -169,7 +169,8 @@ def rebase_branch(branch, parent, start_hash): def main(args=()): parser = argparse.ArgumentParser() parser.add_argument('--verbose', '-v', action='store_true') - parser.add_argument('--no_fetch', '-n', action='store_true', + parser.add_argument('--no_fetch', '--no-fetch', '-n', + action='store_true', help='Skip fetching remotes.') opts = parser.parse_args(args) diff --git a/git_reparent_branch.py b/git_reparent_branch.py index f9bf9c5c3e..fe79d3cc0d 100755 --- a/git_reparent_branch.py +++ b/git_reparent_branch.py @@ -69,7 +69,7 @@ def main(args): manual_merge_base(branch, mbase, new_parent) # TODO(iannucci): ONLY rebase-update the branch which moved (and dependants) - return git_rebase_update.main(['--no_fetch']) + return git_rebase_update.main(['--no-fetch']) if __name__ == '__main__': # pragma: no cover diff --git a/man/src/depot_tools_tutorial.demo.walkthrough.sh b/man/src/depot_tools_tutorial.demo.walkthrough.sh index f5207cce03..e84c229f5a 100755 --- a/man/src/depot_tools_tutorial.demo.walkthrough.sh +++ b/man/src/depot_tools_tutorial.demo.walkthrough.sh @@ -120,7 +120,7 @@ echo Fetching origin git fetch origin 2>&1 | grep -v 'stage' | sed 's+From.*+From https://upstream+' silent git update-ref refs/remotes/origin/master stage_2 silent git tag -d $(git tag -l 'stage_*') -git rebase-update --no_fetch +git rebase-update --no-fetch comment "Well look at that. The CQ landed our typo and chapter2 branches " comment "already and git rebase-update cleaned them up for us." diff --git a/man/src/git-rebase-update.txt b/man/src/git-rebase-update.txt index 066a1a60b2..6f8e0316b3 100644 --- a/man/src/git-rebase-update.txt +++ b/man/src/git-rebase-update.txt @@ -9,7 +9,7 @@ include::_git-rebase-update_desc.helper.txt[] SYNOPSIS -------- [verse] -'git rebase-update' [-v | --verbose] [-n | --no_fetch] +'git rebase-update' [-v | --verbose] [-n | --no-fetch] DESCRIPTION ----------- @@ -28,7 +28,7 @@ Fetching:: of git remotes is determined, and fetched accordingly. Note that if any branches have a tag as their upstream, we are forced to pull all remotes. + -Pass `--no_fetch` to skip this phase. +Pass `--no-fetch` to skip this phase. Rebasing:: All branches are rebased in topological order from roots (upstreams) to @@ -67,7 +67,7 @@ OPTIONS ------- -n:: ---no_fetch:: +--no-fetch:: Skip the `git fetch` phase of rebase-update. -v:: diff --git a/tests/git_rebase_update_test.py b/tests/git_rebase_update_test.py index 0dea37e60b..84e111b587 100755 --- a/tests/git_rebase_update_test.py +++ b/tests/git_rebase_update_test.py @@ -85,7 +85,7 @@ class GitRebaseUpdateTest(git_test_utils.GitRepoReadWriteTestBase): self.repo.git_commit('foobar2') self.repo.git('checkout', 'branch_K') - self.repo.run(self.nb.main, ['--upstream_current', 'sub_K']) + self.repo.run(self.nb.main, ['--upstream-current', 'sub_K']) with self.repo.open('K', 'w') as f: f.write('This depends on K') self.repo.git_commit('sub_K') @@ -117,7 +117,7 @@ class GitRebaseUpdateTest(git_test_utils.GitRepoReadWriteTestBase): self.assertIn('Cannot rebase-update', output) self.repo.run(self.nb.main, ['empty_branch']) - self.repo.run(self.nb.main, ['--upstream_current', 'empty_branch2']) + self.repo.run(self.nb.main, ['--upstream-current', 'empty_branch2']) self.repo.git('checkout', 'branch_K')