Add a couple of safety checks to series creation
- we must check first whether the operation can complete, instead of
bombing out halfway. That means checking that nothing will prevent
the creation of stgit data (note that calling is_initialised() is
not enough, as it does not catch a bogus file), which is tested by
the 3 first couple of testcases, and fixed in stack.py
- creating the git branch unconditionally before knowing whether
creation of the stgit stuff can be completed is a problem as well:
being atomic would be much much better. To emulate atomicity (which
comeds in the next patch), this patch does a somewhat dirty hack to
branch.py: we first attempt to create the stgit stuff, and if that
succeeds, we create the git branch: it is much easier to do at first
a quick check that the latter will succeed. Testcase 7/8 ensure
that such a safety check has not been forgotten.
- when git already reports a problem with that head we would like to
create, we should catch it. Testcase 9/10 creates such a situation,
and the fix to git.py allows to catch the error spit out by
git-rev-parse. I cannot tell why the stderr lines were not included
by the Popen3 object.
Signed-off-by: Yann Dirson <ydirson@altern.org>