uncommit: Prevent stack trace for uncommit --to a merge
commitd1dd2342aed2fe274f7c9e9cbe893216d81919dc
authorJacob Keller <jacob.e.keller@intel.com>
Fri, 7 Dec 2012 21:51:56 +0000 (7 13:51 -0800)
committerPeter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
Wed, 23 Jan 2013 17:57:54 +0000 (23 09:57 -0800)
tree48064aa053babaa7619b57a81bb690a363c2face
parentbcb2361ab86abb535ac8d3b07df39c42f03c6c48
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>
stgit/commands/uncommit.py