{"thread":{"id":"8473","subject":"[PATCH 2/2] Fix removal of series to nuke the formatversion config item.","startedAt":"2007-06-06T21:05:12Z","lastAt":"2007-06-12T22:16:03Z","messageCount":6,"participants":["Yann Dirson","Catalin Marinas"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"44189","messageId":"20070606205852.7657.69286.stgit@gandelf.nowhere.earth","threadId":"8473","inReplyTo":null,"subject":"[StGIT PATCH 0/2] Fix issues with series deletion","fromName":"Yann Dirson","fromEmail":"ydirson@altern.org","sentAt":"2007-06-06T21:05:12Z","receivedAt":"2007-06-06T21:05:12Z","isPatch":true,"sender":{"key":"ydirson@altern.org","avatar":"https://avatars.githubusercontent.com/u/1190950?v=4"},"body":"The following series fixes 2 problems with series deletion.\n\nI am however not happy at all with the way we delete patches and\nseries, starting with an existence check and then deleting.  If any\nerror occurs midway, then we are left with an inconsistent state that\nthe user has to cleanup by hand.  IMHO, we should have those methods\nbe as robust as possible, maybe starting by removing the formatversion\nitem, and printing a \"cleaning up zombie stack\" if does not find it.\nSo at least after fixing a \"delete\" bug, we could rerun the same\ncommand and get to a sane state again.\n\nDoes that make sense ?\n\n-- \nYann Dirson    <ydirson@altern.org> |\nDebian-related: <dirson@debian.org> |   Support Debian GNU/Linux:\n                                    |  Freedom, Power, Stability, Gratis\n     http://ydirson.free.fr/        | Check <http://www.debian.org/>\n"},{"id":"44188","messageId":"20070606210517.7657.97905.stgit@gandelf.nowhere.earth","threadId":"8473","inReplyTo":"20070606205852.7657.69286.stgit@gandelf.nowhere.earth","subject":"[PATCH 1/2] Fix removal of series with non-existant trash dir.","fromName":"Yann Dirson","fromEmail":"ydirson@altern.org","sentAt":"2007-06-06T21:05:17Z","receivedAt":"2007-06-06T21:05:17Z","isPatch":true,"sender":{"key":"ydirson@altern.org","avatar":"https://avatars.githubusercontent.com/u/1190950?v=4"},"body":"\nOtherwise it is not possible to delete a stack that never had a patch\ndeleted (eg. a newborn stack).\n\nSigned-off-by: Yann Dirson <ydirson@altern.org>\n\n---\n\n stgit/stack.py |    9 +++++----\n 1 files changed, 5 insertions(+), 4 deletions(-)\n\ndiff --git a/stgit/stack.py b/stgit/stack.py\nindex 26b0561..30fcca7 100644\n--- a/stgit/stack.py\n+++ b/stgit/stack.py\n@@ -679,10 +679,11 @@ class Series(StgitObject):\n             for p in patches:\n                 Patch(p, self.__patch_dir, self.__refs_dir).delete()\n \n-            # remove the trash directory\n-            for fname in os.listdir(self.__trash_dir):\n-                os.remove(os.path.join(self.__trash_dir, fname))\n-            os.rmdir(self.__trash_dir)\n+            # remove the trash directory if any\n+            if os.path.exists(self.__trash_dir):\n+                for fname in os.listdir(self.__trash_dir):\n+                    os.remove(os.path.join(self.__trash_dir, fname))\n+                os.rmdir(self.__trash_dir)\n \n             # FIXME: find a way to get rid of those manual removals\n             # (move functionality to StgitObject ?)\n"},{"id":"44187","messageId":"20070606210522.7657.13508.stgit@gandelf.nowhere.earth","threadId":"8473","inReplyTo":"20070606205852.7657.69286.stgit@gandelf.nowhere.earth","subject":"[PATCH 2/2] Fix removal of series to nuke the formatversion config item.","fromName":"Yann Dirson","fromEmail":"ydirson@altern.org","sentAt":"2007-06-06T21:05:22Z","receivedAt":"2007-06-06T21:05:22Z","isPatch":true,"sender":{"key":"ydirson@altern.org","avatar":"https://avatars.githubusercontent.com/u/1190950?v=4"},"body":"\nSince this parameter is now used to decide if the branch has already\nbeen initialised, not removing it forbids to create a stack with the\nsame name as one that was deleted.\n\nSigned-off-by: Yann Dirson <ydirson@altern.org>\n\n---\n\n stgit/stack.py |    1 +\n 1 files changed, 1 insertions(+), 0 deletions(-)\n\ndiff --git a/stgit/stack.py b/stgit/stack.py\nindex 30fcca7..e2bf6ac 100644\n--- a/stgit/stack.py\n+++ b/stgit/stack.py\n@@ -718,6 +718,7 @@ class Series(StgitObject):\n         config.unset('branch.%s.remote' % self.__name)\n         config.unset('branch.%s.merge' % self.__name)\n         config.unset('branch.%s.stgit.parentbranch' % self.__name)\n+        config.unset('branch.%s.stgitformatversion' % self.__name)\n \n     def refresh_patch(self, files = None, message = None, edit = False,\n                       show_patch = False,\n"},{"id":"44266","messageId":"b0943d9e0706071450u1587d109x1e592bfa453c0c0@mail.gmail.com","threadId":"8473","inReplyTo":"20070606205852.7657.69286.stgit@gandelf.nowhere.earth","subject":"Re: [StGIT PATCH 0/2] Fix issues with series deletion","fromName":"Catalin Marinas","fromEmail":"catalin.marinas@gmail.com","sentAt":"2007-06-07T21:50:00Z","receivedAt":"2007-06-07T21:50:00Z","isPatch":true,"sender":{"key":"catalin.marinas@gmail.com","avatar":null},"body":"On 06/06/07, Yann Dirson <ydirson@altern.org> wrote:\n> I am however not happy at all with the way we delete patches and\n> series, starting with an existence check and then deleting.  If any\n> error occurs midway, then we are left with an inconsistent state that\n> the user has to cleanup by hand.  IMHO, we should have those methods\n> be as robust as possible, maybe starting by removing the formatversion\n> item, and printing a \"cleaning up zombie stack\" if does not find it.\n> So at least after fixing a \"delete\" bug, we could rerun the same\n> command and get to a sane state again.\n\nThis sounds OK for a quick fix. Longer term, I think we should support\nsome kind of transactions. One idea is to put the StGIT metadata in a\nsingle file (or maybe two if we include the config) that gets checked\nin after every operation.\n\n-- \nCatalin\n"},{"id":"44478","messageId":"20070609184317.GM6992@nan92-1-81-57-214-146.fbx.proxad.net","threadId":"8473","inReplyTo":"b0943d9e0706071450u1587d109x1e592bfa453c0c0@mail.gmail.com","subject":"Re: [StGIT PATCH 0/2] Fix issues with series deletion","fromName":"Yann Dirson","fromEmail":"ydirson@altern.org","sentAt":"2007-06-09T18:43:17Z","receivedAt":"2007-06-09T18:43:17Z","isPatch":true,"sender":{"key":"ydirson@altern.org","avatar":"https://avatars.githubusercontent.com/u/1190950?v=4"},"body":"On Thu, Jun 07, 2007 at 10:50:00PM +0100, Catalin Marinas wrote:\n> On 06/06/07, Yann Dirson <ydirson@altern.org> wrote:\n> >I am however not happy at all with the way we delete patches and\n> >series, starting with an existence check and then deleting.  If any\n> >error occurs midway, then we are left with an inconsistent state that\n> >the user has to cleanup by hand.  IMHO, we should have those methods\n> >be as robust as possible, maybe starting by removing the formatversion\n> >item, and printing a \"cleaning up zombie stack\" if does not find it.\n> >So at least after fixing a \"delete\" bug, we could rerun the same\n> >command and get to a sane state again.\n> \n> This sounds OK for a quick fix. Longer term, I think we should support\n> some kind of transactions. One idea is to put the StGIT metadata in a\n> single file (or maybe two if we include the config) that gets checked\n> in after every operation.\n\nSpeaking of transactions, did you have a chance to read the proposal I\nposted some time ago ?  As stated in another mail, I fear that\napproach does generalize easily to core git - but for lack of a better\nsolution, we may want to go this way anyway...\n\nBest regards,\n-- \nYann\n"},{"id":"44878","messageId":"b0943d9e0706121516k77709f3u8361a818f14a318e@mail.gmail.com","threadId":"8473","inReplyTo":"20070609184317.GM6992@nan92-1-81-57-214-146.fbx.proxad.net","subject":"Re: [StGIT PATCH 0/2] Fix issues with series deletion","fromName":"Catalin Marinas","fromEmail":"catalin.marinas@gmail.com","sentAt":"2007-06-12T22:16:03Z","receivedAt":"2007-06-12T22:16:03Z","isPatch":true,"sender":{"key":"catalin.marinas@gmail.com","avatar":null},"body":"On 09/06/07, Yann Dirson <ydirson@altern.org> wrote:\n> Speaking of transactions, did you have a chance to read the proposal I\n> posted some time ago ?  As stated in another mail, I fear that\n> approach does generalize easily to core git - but for lack of a better\n> solution, we may want to go this way anyway...\n\nYes, I managed to read most of it at that time. I'll try to reply to\nthe individual points in that e-mail. My idea was to store all the\nstack state, including patch information, in a single file rather than\nhaving them scattered around (maybe XML, sounds cool :-) but it's not\neasily parseable from shell-scripts).\n\n-- \nCatalin\n"}]}