{"thread":{"id":"12080","subject":"[PATCH] Fix \"stg branch --delete\" on a nonexistent branch","startedAt":"2008-02-13T22:25:29Z","lastAt":"2008-02-14T00:06:16Z","messageCount":2,"participants":["Toby Allsopp","Karl Hasselström"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"68683","messageId":"87r6fgjwoi.fsf@nav-akl-pcn-343.mitacad.com","threadId":"12080","inReplyTo":null,"subject":"[PATCH] Fix \"stg branch --delete\" on a nonexistent branch","fromName":"Toby Allsopp","fromEmail":"toby.allsopp@navman.co.nz","sentAt":"2008-02-13T22:25:29Z","receivedAt":"2008-02-13T22:25:29Z","isPatch":true,"sender":{"key":"toby.allsopp@navman.co.nz","avatar":null},"body":"Before this patch, I get the following:\n\n $ stg branch --delete tmp\n Deleting branch \"tmp\" ... Traceback (most recent call last):\n   File \"/usr/bin/stg\", line 43, in ?\n     main()\n   File \"/var/lib/python-support/python2.4/stgit/main.py\", line 281, in main\n     command.func(parser, options, args)\n   File \"/var/lib/python-support/python2.4/stgit/commands/branch.py\", line 190, in func\n     __delete_branch(args[0], options.force)\n   File \"/var/lib/python-support/python2.4/stgit/commands/branch.py\", line 100, in __delete_branch\n     doomed.delete(force)\n   File \"/var/lib/python-support/python2.4/stgit/stack.py\", line 758, in delete\n     except GitException:\n NameError: global name 'GitException' is not defined\n\nAfter it, I get:\n\n Deleting branch \"tmp\" ...\n   Warning: Could not delete branch \"tmp\"\n done\n\nSigned-off-by: Toby Allsopp <toby.allsopp@navman.co.nz>\n---\n stgit/stack.py           |    2 +-\n t/t1005-branch-delete.sh |    4 ++++\n 2 files changed, 5 insertions(+), 1 deletions(-)\n\ndiff --git a/stgit/stack.py b/stgit/stack.py\nindex 7fe9f2b..1f01295 100644\n--- a/stgit/stack.py\n+++ b/stgit/stack.py\n@@ -661,7 +661,7 @@ class Series(PatchSet):\n \n         try:\n             git.delete_branch(self.get_name())\n-        except GitException:\n+        except git.GitException:\n             out.warn('Could not delete branch \"%s\"' % self.get_name())\n \n         config.remove_section('branch.%s' % self.get_name())\ndiff --git a/t/t1005-branch-delete.sh b/t/t1005-branch-delete.sh\nindex 00fc9eb..e061baf 100755\n--- a/t/t1005-branch-delete.sh\n+++ b/t/t1005-branch-delete.sh\n@@ -19,6 +19,10 @@ test_expect_success 'Create a non-StGIT branch and delete it' '\n     stg branch --delete bar\n     '\n \n+test_expect_success 'Delete a nonexistent branch' '\n+   stg branch --delete bar\n+   '\n+\n test_expect_success 'Make sure the branch ref was deleted' '\n     [ -z \"$(git show-ref | grep master | tee /dev/stderr)\" ]\n     '\n-- \n1.5.4.1.97.g40aab-dirty\n"},{"id":"68686","messageId":"20080214000616.GB10335@diana.vm.bytemark.co.uk","threadId":"12080","inReplyTo":"87r6fgjwoi.fsf@nav-akl-pcn-343.mitacad.com","subject":"Re: [PATCH] Fix \"stg branch --delete\" on a nonexistent branch","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2008-02-14T00:06:16Z","receivedAt":"2008-02-14T00:06:16Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2008-02-14 11:25:29 +1300, Toby Allsopp wrote:\n\n>  stgit/stack.py           |    2 +-\n>  t/t1005-branch-delete.sh |    4 ++++\n>  2 files changed, 5 insertions(+), 1 deletions(-)\n\nThanks -- and with a test case! I'll push this out on\n\n  git://repo.or.cz/stgit/kha.git safe\n\nlater tonight.\n\n-- \nKarl Hasselström, kha@treskal.com\n      www.treskal.com/kalle\n"}]}