From: Yann Dirson Date: Sun, 16 Apr 2006 10:52:32 +0000 (+0200) Subject: Add a couple of safety checks to series creation X-Git-Tag: v0.10~31 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/stgit/commitdiff_plain/fe847176ac839e64d426e6bf8ab7ad67ba3129d6?hp=fe847176ac839e64d426e6bf8ab7ad67ba3129d6 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 ---