summaryrefslogtreecommitdiffstats
path: root/subcmds/help.py
Commit message (Collapse)AuthorAgeFilesLines
* subcmds: stop instantiating at import timeMike Frysinger2020-03-171-3/+3
| | | | | | | | | | | | | | | | | | The current subcmds design has singletons in all_commands. This isn't exactly unusual, but the fact that our main & help subcommand will then attach members to the classes before invoking them is. This makes it hard to keep track of what members a command has access to, and the two code paths (main & help) attach different members depending on what APIs they then invoke. Lets pull this back a step by storing classes in all_commands and leave the instantiation step to when they're used. This doesn't fully clean up the confusion, but gets us closer. Change-Id: I6a768ff97fe541e6f3228358dba04ed66c4b070a Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/259154 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: David Pursehouse <dpursehouse@collab.net>
* subcmds: centralize all_commands logicMike Frysinger2020-03-171-6/+7
| | | | | | | | | | | | | | | The branch->branches alias is setup in the main module when that really belongs in the existing all_commands setup. For help, rather than monkey patching all_commands to the class, switch it to use the state directly from the module. This makes it a bit more obvious where it's coming from rather than this one subcommand having a |commands| member added externally to it. Change-Id: I0200def09bf4774cad8012af0f4ae60ea3089dc0 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/259153 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: David Pursehouse <dpursehouse@collab.net>
* Fix blank line issues reported by flake8David Pursehouse2020-02-121-0/+1
| | | | | | | | | | | | | | | | | | | | - E301 expected 1 blank line - E302 expected 2 blank lines - E303 too many blank lines - E305 expected 2 blank lines after class or function definition - E306 expected 1 blank line before a nested definition Fixed automatically with autopep8: git ls-files | grep py$ | xargs autopep8 --in-place \ --select E301,E302,E303,E305,E306 Manually fix issues in project.py caused by misuse of block comments. Change-Id: Iee840fcaff48aae504ddac9c3e76d2acd484f6a9 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/254599 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: David Pursehouse <dpursehouse@collab.net>
* Fix indentation issues reported by flake8David Pursehouse2020-02-121-4/+4
| | | | | | | | | | | | | | | | | | | | | - E121 continuation line under-indented for hanging indent - E122 continuation line missing indentation or outdented - E125 continuation line with same indent as next logical line - E126 continuation line over-indented for hanging indent - E127 continuation line over-indented for visual indent - E128 continuation line under-indented for visual indent - E129 visually indented line with same indent as next logical line - E131 continuation line unaligned for hanging indent Fixed automatically with autopep8: git ls-files | grep py$ | xargs autopep8 --in-place \ --select E121,E122,E125,E126,E127,E128,E129,E131 Change-Id: Ifd95fb8e6a1a4d6e9de187b5787d64a6326dd249 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/254605 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: David Pursehouse <dpursehouse@collab.net>
* help: unify command displayMike Frysinger2019-12-031-17/+9
| | | | | | | | | No functional changes, just unifying duplicate code paths. Change-Id: I6afa797ca1e1eb90abdc0236325003ae070cbfb3 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/247293 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* help: add a --help-all option to show all commands at onceMike Frysinger2019-08-271-4/+15
| | | | | | | | | | This is useful when you want to scan all the possibilities of repo at once. Like when you're searching for different option names. Change-Id: I225dfb94d2be78229905b744ecf57eb2829bb52d Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/232894 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* set default file encoding to utf-8Mike Frysinger2019-06-131-0/+1
| | | | | | | | There's no reason to support any other encoding in these files. This only affects the files themselves and not streams they open. Bug: https://crbug.com/gerrit/10418 Change-Id: I053cb40cd3666ce5c8a0689b9dd938f24ca765bf
* update markdown/help header formatMike Frysinger2018-10-101-15/+2
| | | | | | | Since gitiles recommends using # headers over ---/=== underlines, change the manifest-format.md over and all our help texts. Change-Id: I96391d41fba769e9f26870d497cf7cf01c8d8ab3
* Add GitcClientCommand class for GITC-specific commandsDan Willemsen2015-09-291-2/+6
| | | | | | | These won't show up as common commands in the help text unless in a GITC client, and will refuse to execute. Change-Id: Iffe82adcc9d6ddde9cb4b204f83ff018042bdab0
* gitc: Improve help visibilityv1.12.28Dan Willemsen2015-09-011-2/+11
| | | | | | | This improves the visiblity of gitc-init if we can get the gitc config, and hides it otherwise. Change-Id: I82830b0b07c311e8c74397ba79eb4c361f8b6fb5
* Some fixes for supporting python3Chirayu Desai2013-04-181-6/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | * Fix imports. * Use python3 syntax. * Wrap map() calls with list(). * Use list() only wherever needed. (Thanks Conley!) * Fix dictionary iteration methods (s/iteritems/items/). * Make use of sorted() in appropriate places * Use iterators directly in the loop. * Don't use .keys() wherever it isn't needed. * Use sys.maxsize instead of sys.maxint TODO: * Make repo work fully with python3. :) Some of this was done by the '2to3' tool [1], by applying the needed fixes in a way that doesn't break compatibility with python2. Links: [1]: http://docs.python.org/2/library/2to3.html Change-Id: Ibdf3bf9a530d716db905733cb9bfef83a48820f7 Signed-off-by: Chirayu Desai <cdesai@cyanogenmod.org>
* Fix: Missing spaces in printed messagesDavid Pursehouse2013-03-051-1/+1
| | | | | | | | | | | | | | | | | | | | | Several messages are printed with the `print` method and the message is split across two lines, i.e.: print('This is a message split' 'across two source code lines') Which causes the message to be printed as: This is a message splitacross two source code lines Add a space at the end of the first line before the line break: print('This is a message split ' 'across two source code lines' Also correct a minor spelling mistake. Change-Id: Ib98d93fcfb98d78f48025fcc428b6661380cff79
* Tidy up code formatting a bit moreDavid Pursehouse2012-11-141-1/+1
| | | | | | | | | | | | Enable the following Pylint warnings: C0322: Operator not preceded by a space C0323: Operator not followed by a space C0324: Comma not followed by a space And make the necessary fixes. Change-Id: I74d74283ad5138cbaf28d492b18614eb355ff9fe
* Change print statements to work in python3Sarah Owens2012-11-131-19/+14
| | | | | | This is part of a series of changes to introduce Python3 support. Change-Id: I373be5de7141aa127d7debdbce1df39148dbec32
* Coding style cleanupDavid Pursehouse2012-10-091-3/+3
| | | | | | | | | | | | | | | Fix the following issues reported by pylint: C0321: More than one statement on a single line W0622: Redefining built-in 'name' W0612: Unused variable 'name' W0613: Unused argument 'name' W0102: Dangerous default value 'value' as argument W0105: String statement has no effect Also fixed a few cases of inconsistent indentation. Change-Id: Ie0db839e7c57d576cff12d8c055fe87030d00744
* help: Fix help syncShawn O. Pearce2011-10-111-0/+1
| | | | | | | | help sync crashed as sync required the manifest to be configured to create the option parser, as the default number of jobs is required. Change-Id: Ie75e8d75ac0e38313e4aab451cbb24430e84def5 Signed-off-by: Shawn O. Pearce <sop@google.com>
* help: Don't show empty Summary or Description sectionsShawn O. Pearce2011-01-091-0/+2
| | | | | Signed-off-by: Shawn O. Pearce <sop@google.com> (cherry picked from commit 60e679209a5495393ef584efaaad287fc8b77c51)
* Support a level 2 heading in help description textShawn O. Pearce2009-04-211-3/+13
| | | | | | | | The level 2 headings (denoted by ~) indent the heading two spaces, but continue to use the bold formatter to offset them from the other surrounding text. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Show options help after the summary for a commandShawn O. Pearce2009-04-181-1/+1
| | | | | | It is a bit clearer to read this way. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Add a 'repo manifest' command whose help is the manifest file formatShawn O. Pearce2009-03-041-3/+14
| | | | | | | This should make it easier for users to discover the file format on their own, and read about it. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Tell users how to see the complete list of commandsShawn O. Pearce2009-03-041-0/+1
| | | | | | Using "repo help --all" may not be obvious. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Don't permit users to run repo status in a mirror clientShawn O. Pearce2009-03-031-2/+2
| | | | | | | | | | | | | | | | If a client was created with "repo init --mirror" then there are no working directories present, and no files checked out. Using a command like "repo status" in this context makes no sense, and actually throws back a Pytyon traceback at the console when the underlying commands fail out. We now tag commands with the MirrorSafeCommand type if they are able to be executed within a mirror directory safely. Using a command in a mirror which lacks this base class results in a useful error letting you know the command isn't supported. Bug: REPO-14 Signed-off-by: Shawn O. Pearce <sop@google.com>
* Initial Contributionv1.0The Android Open Source Project2008-10-211-0/+147