Re: [PATCH 13/17] revert: Introduce a layer of indirection over pick_commits
- From
Ramkumar Ramachandra <artagnon@gmail.com>
- Date
- Jul 18, 2011, 21:24 UTC
- Message-ID
- <CALkWK0nYMuDeoGuvGWtmcs6Odoo0g7B_CkY63MBo38UvOHyX8g@mail.gmail.com>
- In-Reply-To
- <20110712200324.GD14909@elie>
Hi,
New commit message. The "--reset" part might jump out, but it's a result of the recent rebasing.
revert: Make pick_commits functionally act on a commit list
Apart from its central objective of calling into the picking mechanism, pick_commits creates a sequencer directory, prepares a todo list, and even acts upon the "--reset" subcommand. This makes for a bad API since the central worry of callers is to figure out whether or not any conflicts were encountered during the cherry picking. The current API is like:
if (pick_commits(opts) < 0) print "Something failed, we're not sure what"
So, change pick_commits so that it's only responsible for picking commits in a loop and reporting any errors, leaving the rest to a new function called pick_revisions. Consequently, the API of pick_commits becomes much clearer:
act_on_subcommand(opts->subcommand); todo_list = prepare_todo_list(); if (pick_commits(todo_list, opts) < 0) print "Error encountered while picking commits"
Now, callers can easily call-in to the cherry-picking machinery by constructing an arbitrary todo list along with some options.
-- Ram