lib/git_topic/cli.rb in git-topic-0.2.5 vs lib/git_topic/cli.rb in git-topic-0.2.6
- old
+ new
@@ -9,11 +9,12 @@
require 'git_topic'
module GitTopic
SubCommands = %w(
- work-on done status review comment comments accept reject install-aliases
+ work-on done abandon status review comment comments accept reject
+ install-aliases
)
Version = lambda {
h = YAML::load_file( "#{File.dirname( __FILE__ )}/../../VERSION.yml" )
if h.is_a? Hash
[h[:major], h[:minor], h[:patch], h[:build]].compact.join( "." )
@@ -32,17 +33,19 @@
Commands are:
#{SubCommands.join( "
" )}
Global Options:
- ".cleanup
+ ".unindent
version Version
opt :verbose,
"Verbose output, including complete traces on errors."
opt :completion_help,
"View instructions for setting up autocompletion."
+ opt :no_log,
+ "Disable logging."
stop_on SubCommands
end
@@ -60,53 +63,66 @@
This is to sidestep ruby issue 3465 which makes loading gems
through the generated wrapper far too slow for autocompletion.
For more information, see:
http://redmine.ruby-lang.org/issues/show/3465
- }.cleanup
+ }.unindent
exit 0
end
-
+ info ''
+ info ARGV.join( " " )
cmd = ARGV.shift
cmd_opts = Trollop::options do
case cmd
when "work-on"
banner "
- git[-topic] work-on <topic>
+ git[-topic] work-on <topic> [<upstream> | --continue]
Switches to a local work-in-progress (wip) branch for <topic>. The
branch (and a matching remote branch) is created if necessary.
If this is a rejected topic, work will continue from the state of
the rejected topic branch. Similarly, if this is a review topic,
the review will be pulled and work will continue on that topic.
- <topic>'s branches HEAD will point to <upstream>. If <upstream> is
- omitted, it will default to the current HEAD.
+ <topic>'s branch's HEAD will point to <upstream>, if supplied. If
+ --continue is supplied instead, HEAD will point to the most recent
+ review (i.e. submitted) of your topic branches. If you have just
+ submitted a topic with git done, git work-on next-topic --continue
+ would begin the next topic starting from where you had left off.
+
+ If both <upstream> and --continue are omitted, <topic>'s branch's
+ HEAD will default to the current HEAD.
Options:
- ".cleanup
+ ".unindent
+ when "abandon"
+ banner "
+ git[-topic] abandon [<topic>]
+
+ Deletes <topic> locally and remotely. Defaults to current topic if unspecified.
+ ".unindent
when /done(-with)?/
banner "
git[-topic] done
Indicate that this topic branch is ready for review. Push to a
remote review branch and switch back to master.
Options:
- ".cleanup
+ ".unindent
when "status"
banner "
git st
git-topic status
Print a status, showing rejected branches to work on and branches
that can be reviewed.
Options:
- ".cleanup
+ ".unindent
opt :prepended,
"
Prepend status to git status output (for a complete view of
status).
".oneline,
@@ -116,11 +132,11 @@
git[-topic] review [<topic>]
Review <topic>. If <topic> is unspecified, review the oldest (by HEAD) topic.
Options:
- ".cleanup
+ ".unindent
when "comment"
banner "
git[-topic] comment
Add your comments to the current topic. If this is the first time
@@ -151,11 +167,11 @@
3. Those line additions must all begin with any amount of
whitespace followed by a ‘#’ character. i.e. they should be
comments.
Options:
- ".cleanup
+ ".unindent
opt :force_update,
"
If you are commenting on the initial review and you wish to
edit your comments, you can pass this flag to do so.
@@ -167,30 +183,30 @@
View the comments for <topic>, which defaults to the current topic.
If your branch was rejected, you should read these comments so you
know what to do to appease the reviewer.
Options:
- ".cleanup
+ ".unindent
when "accept"
banner "
git[-topic] accept
Accept the current in-review topic, merging it to master and
cleaning up the remote branch. This will fail if the branch does
not merge as a fast-forward in master. If that happens, the topic
should either be rejected, or you can manually rebase.
Options:
- ".cleanup
+ ".unindent
when "reject"
banner "
git[-topic] reject
Reject the current in-review topic.
Options:
- ".cleanup
+ ".unindent
opt :save_comments,
"
If the current diff includes your comments (see git-topic
comment --help), this flag will autosave those comments before
@@ -209,11 +225,11 @@
reject topic reject
st topic status --prepended
Options:
- ".cleanup
+ ".unindent
opt :local,
"
Install aliases non-globally (i.e. in .git/config instead of
$HOME/.gitconfig
@@ -233,9 +249,12 @@
upstream = ARGV.shift
opts.merge!({
:upstream => upstream
})
work_on topic, opts
+ when "abandon"
+ topic = ARGV.shift
+ abandon topic
when /done(-with)?/
topic = ARGV.shift
done topic, opts
when "status"
status opts