{"thread":{"id":"14250","subject":"Can I remove stg sync --undo ?","startedAt":"2008-07-02T07:25:24Z","lastAt":"2008-07-08T04:14:25Z","messageCount":7,"participants":["Karl Hasselström","Catalin Marinas"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"81930","messageId":"20080702072524.GA26805@diana.vm.bytemark.co.uk","threadId":"14250","inReplyTo":null,"subject":"Can I remove stg sync --undo ?","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2008-07-02T07:25:24Z","receivedAt":"2008-07-02T07:25:24Z","isPatch":false,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"I'm preparing a patch that removes all the old --undo flags, and\ndiscovered that stg sync has an --undo flag backed by\nstack.undo_refresh().\n\nIs it OK if I remove it? \"stg undo\" will allow you to undo the whole\ncommand, or, in case of conflicts, either the whole command or just\nthe last conflicting push. But it does not allow for undoing the last\nrefresh (whether it succeeded or not). I don't know how refresh is\nused, so I can't really tell if \"stg undo\" is currently insufficient.\n\n-- \nKarl Hasselström, kha@treskal.com\n      www.treskal.com/kalle\n"},{"id":"82165","messageId":"b0943d9e0807031502x5f7c4babtd65511d7966c69f6@mail.gmail.com","threadId":"14250","inReplyTo":"20080702072524.GA26805@diana.vm.bytemark.co.uk","subject":"Re: Can I remove stg sync --undo ?","fromName":"Catalin Marinas","fromEmail":"catalin.marinas@gmail.com","sentAt":"2008-07-03T22:02:28Z","receivedAt":"2008-07-03T22:02:28Z","isPatch":false,"sender":{"key":"catalin.marinas@gmail.com","avatar":null},"body":"Hi Karl,\n\nSorry for the delay, I've been really busy recently.\n\n2008/7/2 Karl Hasselström <kha@treskal.com>:\n> I'm preparing a patch that removes all the old --undo flags, and\n> discovered that stg sync has an --undo flag backed by\n> stack.undo_refresh().\n\nThe current --undo flag restores the state of the patch before a\nsuccessful sync. If the sync fails with a conflict and it needs a\nrefresh after resolving, I think it loses the previous state of the\npatch and just restores to whatever it was before the refresh.\n\n> Is it OK if I remove it? \"stg undo\" will allow you to undo the whole\n> command, or, in case of conflicts, either the whole command or just\n> the last conflicting push. But it does not allow for undoing the last\n> refresh (whether it succeeded or not). I don't know how refresh is\n> used, so I can't really tell if \"stg undo\" is currently insufficient.\n\nThe sync performs three operations - push, merge and refresh (if the\nrefresh is automatic after merge, it doesn't update the backup\ninformation since it was done by merge).\n\nIf merge fails, the refresh is manual after solving the conflicts. I\nsuspect this will be recorded as a separate step for undo (BTW, is\nresolved take into account for undo?).\n\n-- \nCatalin\n"},{"id":"82196","messageId":"20080704020918.GA30669@diana.vm.bytemark.co.uk","threadId":"14250","inReplyTo":"b0943d9e0807031502x5f7c4babtd65511d7966c69f6@mail.gmail.com","subject":"Re: Can I remove stg sync --undo ?","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2008-07-04T02:09:18Z","receivedAt":"2008-07-04T02:09:18Z","isPatch":false,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2008-07-03 23:02:28 +0100, Catalin Marinas wrote:\n\n> Sorry for the delay, I've been really busy recently.\n\nNo problem.\n\n> 2008/7/2 Karl Hasselström <kha@treskal.com>:\n>\n> > I'm preparing a patch that removes all the old --undo flags, and\n> > discovered that stg sync has an --undo flag backed by\n> > stack.undo_refresh().\n>\n> The current --undo flag restores the state of the patch before a\n> successful sync. If the sync fails with a conflict and it needs a\n> refresh after resolving, I think it loses the previous state of the\n> patch and just restores to whatever it was before the refresh.\n\n[...]\n\n> The sync performs three operations - push, merge and refresh (if the\n> refresh is automatic after merge, it doesn't update the backup\n> information since it was done by merge).\n>\n> If merge fails, the refresh is manual after solving the conflicts. I\n> suspect this will be recorded as a separate step for undo\n\nYeah, the new undo stuff will currently handle sync just like e.g.\npush and pop: write one log entry when the command's all done, plus\none extra just before the conflicting push if there is one. So you can\nalways undo the entire command; and in case of conflicts, you also\nhave the option of undoing just the conflicting push. Is this enough\nfor sync?\n\n> (BTW, is resolved take into account for undo?).\n\nHmmm, what do you mean by \"resolved\"?\n\n-- \nKarl Hasselström, kha@treskal.com\n      www.treskal.com/kalle\n"},{"id":"82258","messageId":"b0943d9e0807041505oc15660bpcd62a62100e517b9@mail.gmail.com","threadId":"14250","inReplyTo":"20080704020918.GA30669@diana.vm.bytemark.co.uk","subject":"Re: Can I remove stg sync --undo ?","fromName":"Catalin Marinas","fromEmail":"catalin.marinas@gmail.com","sentAt":"2008-07-04T22:05:11Z","receivedAt":"2008-07-04T22:05:11Z","isPatch":false,"sender":{"key":"catalin.marinas@gmail.com","avatar":null},"body":"2008/7/4 Karl Hasselström <kha@treskal.com>:\n> On 2008-07-03 23:02:28 +0100, Catalin Marinas wrote:\n>> The sync performs three operations - push, merge and refresh (if the\n>> refresh is automatic after merge, it doesn't update the backup\n>> information since it was done by merge).\n>>\n>> If merge fails, the refresh is manual after solving the conflicts. I\n>> suspect this will be recorded as a separate step for undo\n>\n> Yeah, the new undo stuff will currently handle sync just like e.g.\n> push and pop: write one log entry when the command's all done, plus\n> one extra just before the conflicting push if there is one. So you can\n> always undo the entire command; and in case of conflicts, you also\n> have the option of undoing just the conflicting push. Is this enough\n> for sync?\n\nThere are two operations that can conflict for sync - pushing a patch\nand the actual sync'ing, i.e. a three-way merge with the patch to be\nsynchronised with (kind of fold).\n\n>> (BTW, is resolved take into account for undo?).\n>\n> Hmmm, what do you mean by \"resolved\"?\n\nThe current resolved command - the clearing of the conflicting entries\nin the index.\n\n-- \nCatalin\n"},{"id":"82276","messageId":"20080705083348.GA21097@diana.vm.bytemark.co.uk","threadId":"14250","inReplyTo":"b0943d9e0807041505oc15660bpcd62a62100e517b9@mail.gmail.com","subject":"Re: Can I remove stg sync --undo ?","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2008-07-05T08:33:48Z","receivedAt":"2008-07-05T08:33:48Z","isPatch":false,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2008-07-04 23:05:11 +0100, Catalin Marinas wrote:\n\n> 2008/7/4 Karl Hasselström <kha@treskal.com>:\n>\n> > On 2008-07-03 23:02:28 +0100, Catalin Marinas wrote:\n> >\n> > > The sync performs three operations - push, merge and refresh (if\n> > > the refresh is automatic after merge, it doesn't update the\n> > > backup information since it was done by merge).\n> > >\n> > > If merge fails, the refresh is manual after solving the\n> > > conflicts. I suspect this will be recorded as a separate step\n> > > for undo\n> >\n> > Yeah, the new undo stuff will currently handle sync just like e.g.\n> > push and pop: write one log entry when the command's all done,\n> > plus one extra just before the conflicting push if there is one.\n> > So you can always undo the entire command; and in case of\n> > conflicts, you also have the option of undoing just the\n> > conflicting push. Is this enough for sync?\n>\n> There are two operations that can conflict for sync - pushing a\n> patch and the actual sync'ing, i.e. a three-way merge with the patch\n> to be synchronised with (kind of fold).\n\nMy guess is that conflicts of the first type would work out of the box\n(i.e. they'd get an extra log entry) while conflicts of the second\ntype would not.\n\nWe need a sync undo test.\n\n> > > (BTW, is resolved take into account for undo?).\n> >\n> > Hmmm, what do you mean by \"resolved\"?\n>\n> The current resolved command - the clearing of the conflicting\n> entries in the index.\n\nWith just \"stg undo\" (or reset or redo), you get the usual\nnew-infrastructure check about dirty index and working tree (the whole\nindex must be clean, and the parts of the worktree we need to touch\nmust be clean). Which prevents you from undoing a conflicting push,\nfor example.\n\nWith the --hard flag, any uncleanliness in index or worktree simply\ngets zapped (just like with git reset --hard). I'm not 100% happy with\nthis -- what I'd really like is to zap only the files that we need to\ntouch. But I haven't figured out a good way to do that.\n\n-- \nKarl Hasselström, kha@treskal.com\n      www.treskal.com/kalle\n"},{"id":"82489","messageId":"b0943d9e0807071347n17e2e09ai761b849d2d03bc9c@mail.gmail.com","threadId":"14250","inReplyTo":"20080705083348.GA21097@diana.vm.bytemark.co.uk","subject":"Re: Can I remove stg sync --undo ?","fromName":"Catalin Marinas","fromEmail":"catalin.marinas@gmail.com","sentAt":"2008-07-07T20:47:13Z","receivedAt":"2008-07-07T20:47:13Z","isPatch":false,"sender":{"key":"catalin.marinas@gmail.com","avatar":null},"body":"2008/7/5 Karl Hasselström <kha@treskal.com>:\n> On 2008-07-04 23:05:11 +0100, Catalin Marinas wrote:\n>\n>> 2008/7/4 Karl Hasselström <kha@treskal.com>:\n>>\n>> > On 2008-07-03 23:02:28 +0100, Catalin Marinas wrote:\n>> >\n>> > > The sync performs three operations - push, merge and refresh (if\n>> > > the refresh is automatic after merge, it doesn't update the\n>> > > backup information since it was done by merge).\n>> > >\n>> > > If merge fails, the refresh is manual after solving the\n>> > > conflicts. I suspect this will be recorded as a separate step\n>> > > for undo\n>> >\n>> > Yeah, the new undo stuff will currently handle sync just like e.g.\n>> > push and pop: write one log entry when the command's all done,\n>> > plus one extra just before the conflicting push if there is one.\n>> > So you can always undo the entire command; and in case of\n>> > conflicts, you also have the option of undoing just the\n>> > conflicting push. Is this enough for sync?\n>>\n>> There are two operations that can conflict for sync - pushing a\n>> patch and the actual sync'ing, i.e. a three-way merge with the patch\n>> to be synchronised with (kind of fold).\n>\n> My guess is that conflicts of the first type would work out of the box\n> (i.e. they'd get an extra log entry) while conflicts of the second\n> type would not.\n\nI don't really care as long as I can get back to the patch state\nbefore running the sync command if anything goes wrong. So, one undo\nlevel would be enough.\n\n> We need a sync undo test.\n\nYes but not sure what how undo would behave in this situation yet.\n\n>> > > (BTW, is resolved take into account for undo?).\n>> >\n>> > Hmmm, what do you mean by \"resolved\"?\n>>\n>> The current resolved command - the clearing of the conflicting\n>> entries in the index.\n>\n> With just \"stg undo\" (or reset or redo), you get the usual\n> new-infrastructure check about dirty index and working tree (the whole\n> index must be clean, and the parts of the worktree we need to touch\n> must be clean). Which prevents you from undoing a conflicting push,\n> for example.\n>\n> With the --hard flag, any uncleanliness in index or worktree simply\n> gets zapped (just like with git reset --hard). I'm not 100% happy with\n> this -- what I'd really like is to zap only the files that we need to\n> touch. But I haven't figured out a good way to do that.\n\nOK, not much to comment here, it's your implementation :-).\n\n-- \nCatalin\n"},{"id":"82541","messageId":"20080708041425.GA2247@diana.vm.bytemark.co.uk","threadId":"14250","inReplyTo":"b0943d9e0807071347n17e2e09ai761b849d2d03bc9c@mail.gmail.com","subject":"Re: Can I remove stg sync --undo ?","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2008-07-08T04:14:25Z","receivedAt":"2008-07-08T04:14:25Z","isPatch":false,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2008-07-07 21:47:13 +0100, Catalin Marinas wrote:\n\n> 2008/7/5 Karl Hasselström <kha@treskal.com>:\n>\n> > On 2008-07-04 23:05:11 +0100, Catalin Marinas wrote:\n> >\n> > > There are two operations that can conflict for sync - pushing a\n> > > patch and the actual sync'ing, i.e. a three-way merge with the\n> > > patch to be synchronised with (kind of fold).\n> >\n> > My guess is that conflicts of the first type would work out of the\n> > box (i.e. they'd get an extra log entry) while conflicts of the\n> > second type would not.\n>\n> I don't really care as long as I can get back to the patch state\n> before running the sync command if anything goes wrong. So, one undo\n> level would be enough.\n>\n> > We need a sync undo test.\n>\n> Yes but not sure what how undo would behave in this situation yet.\n\nOK, then I'll write a simple test that makes sure undo and sync\ninteract the way I imagine they should. ;-)\n\n> > With just \"stg undo\" (or reset or redo), you get the usual\n> > new-infrastructure check about dirty index and working tree (the\n> > whole index must be clean, and the parts of the worktree we need\n> > to touch must be clean). Which prevents you from undoing a\n> > conflicting push, for example.\n> >\n> > With the --hard flag, any uncleanliness in index or worktree\n> > simply gets zapped (just like with git reset --hard). I'm not 100%\n> > happy with this -- what I'd really like is to zap only the files\n> > that we need to touch. But I haven't figured out a good way to do\n> > that.\n>\n> OK, not much to comment here, it's your implementation :-).\n\nBut you too get to live with the design decisions ...\n\n-- \nKarl Hasselström, kha@treskal.com\n      www.treskal.com/kalle\n"}]}