* [StGit PATCH] Do not crash if a patch log ref is missing
@ 2008-09-12 21:54 Catalin Marinas
2008-09-14 8:08 ` Karl Hasselström
0 siblings, 1 reply; 3+ messages in thread
From: Catalin Marinas @ 2008-09-12 21:54 UTC (permalink / raw)
To: git; +Cc: Karl Hasselström
Since we'll get rid of the individual patch logs, StGit should ignore if
such a ref is missing when deleting the compatibility patch files.
Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
---
stgit/lib/stack.py | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/stgit/lib/stack.py b/stgit/lib/stack.py
index 9cb3967..1059955 100644
--- a/stgit/lib/stack.py
+++ b/stgit/lib/stack.py
@@ -68,7 +68,11 @@ class Patch(object):
for f in os.listdir(self.__compat_dir):
os.remove(os.path.join(self.__compat_dir, f))
os.rmdir(self.__compat_dir)
- self.__stack.repository.refs.delete(self.__log_ref)
+ try:
+ # this compatibility log ref might not exist
+ self.__stack.repository.refs.delete(self.__log_ref)
+ except KeyError:
+ pass
def set_commit(self, commit, msg):
self.__write_compat_files(commit, msg)
self.__stack.repository.refs.set(self.__ref, commit, msg)
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [StGit PATCH] Do not crash if a patch log ref is missing
2008-09-12 21:54 [StGit PATCH] Do not crash if a patch log ref is missing Catalin Marinas
@ 2008-09-14 8:08 ` Karl Hasselström
2008-09-14 21:01 ` Catalin Marinas
0 siblings, 1 reply; 3+ messages in thread
From: Karl Hasselström @ 2008-09-14 8:08 UTC (permalink / raw)
To: Catalin Marinas; +Cc: git
On 2008-09-12 22:54:58 +0100, Catalin Marinas wrote:
> Since we'll get rid of the individual patch logs, StGit should
> ignore if such a ref is missing when deleting the compatibility
> patch files.
I agree this is a good idea from a robustness perspective. Did you
encounter a case where the deletion actually failed?
--
Karl Hasselström, kha@treskal.com
www.treskal.com/kalle
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [StGit PATCH] Do not crash if a patch log ref is missing
2008-09-14 8:08 ` Karl Hasselström
@ 2008-09-14 21:01 ` Catalin Marinas
0 siblings, 0 replies; 3+ messages in thread
From: Catalin Marinas @ 2008-09-14 21:01 UTC (permalink / raw)
To: Karl Hasselström; +Cc: git
On 14/09/2008, Karl Hasselström <kha@treskal.com> wrote:
> On 2008-09-12 22:54:58 +0100, Catalin Marinas wrote:
>
> > Since we'll get rid of the individual patch logs, StGit should
> > ignore if such a ref is missing when deleting the compatibility
> > patch files.
>
>
> I agree this is a good idea from a robustness perspective. Did you
> encounter a case where the deletion actually failed?
Yes, I was deleting some older patches and it happened for one of them
not to have a log reference. It left the stack in a pretty undefined
state (and used the stable StGit to delete the rest of the patches as
it is more tolerant :-)).
--
Catalin
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-09-14 21:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-12 21:54 [StGit PATCH] Do not crash if a patch log ref is missing Catalin Marinas
2008-09-14 8:08 ` Karl Hasselström
2008-09-14 21:01 ` Catalin Marinas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).