uncommit: Prevent stack trace for uncommit --to a merge

This patch fixes a bug caused when attempting to stg uncommit --to a merge,
which stgit is not able to handle. Previously stg uncommit would output a nasty
stack trace instead of a clean warning message. This was due to checking for
multiple parents only inside the get_parent function.

The fix is to instead check for parent before appending patch to the list of
patches. Do this by creating a "check_and_append" function which will be called
instead of commits.append(n). The bug was present because of the logic for --to
not calling "get_parent" at the final "to" commit.

Note that the addition of out.done in the exception is to enable slightly better
formatting of the output message (start it on a new line instead of the previous one)

Reported-by: Matthew Vick <matthew.vick@intel.com>
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
1 file changed