Feature request: Rollback/Undo a refactoring

Hello

A great addition to R# would be to add the capability to undo the last
refactoring in all the affected source files.

Cheers

Gabriel Lozano-Moran


13 comments
Comment actions Permalink

Hi Gabriel,

there is a checkbox "To enable Undo, open all files with changes for
editing" on the refactoring dialogs. Is that what you are looking for?


Regards,
Stefan Lieser
--
http://nhplugin.lieser-online.de

Gabriel Lozano-Moran schrieb:

Hello

A great addition to R# would be to add the capability to undo the last
refactoring in all the affected source files.

Cheers

Gabriel Lozano-Moran

0
Comment actions Permalink

That would work if by "undo" you mean saving all files before doing a refactoring, doing the refactoring, and then "undo"ing it by telling the IDE to close all files, opt to not save any of them, and then re-open them to continue your work. I suspect Gabriel is looking for something a little more like an "undo" command. ;)

0
Comment actions Permalink

If you refactor and advice R# to open all files it has to changed you
can use the IDE's Undo command to undo all changes. So I don't
understand what functionality you are looking for that goes further?

Jeremy Gray schrieb:

That would work if by "undo" you mean saving all files before doing a refactoring, doing the refactoring, and then "undo"ing it by telling the IDE to close all files, opt to not save any of them, and then re-open them to continue your work. I suspect Gabriel is looking for something a little more like an "undo" command. ;)

0
Comment actions Permalink

"Undo" without me having to need to "close without save". I am not goign to
argue about design here but assume that a rename refactoring affects 27
files I want to be able to undo this rename refactoring with a simple
shortcut instead of having to manually close the 27 files without saving
them.

"Stefan Lieser" <stefan@lieser-online.de> wrote in message
news:g33bnb$a0t$1@is.intellij.net...

If you refactor and advice R# to open all files it has to changed you can
use the IDE's Undo command to undo all changes. So I don't understand what
functionality you are looking for that goes further?

>

Jeremy Gray schrieb:

>> That would work if by "undo" you mean saving all files before doing a
>> refactoring, doing the refactoring, and then "undo"ing it by telling the
>> IDE to close all files, opt to not save any of them, and then re-open
>> them to continue your work. I suspect Gabriel is looking for something a
>> little more like an "undo" command. ;)


0
Comment actions Permalink

Hello Gabriel Lozano-Moran,

After refactoring, or any other bulk change, if you keep files open Visual
Studio links individual changes together and then undo them in one go. So,
if rename changes 27 files, and you keep them open via checkbox on refactoring
dialog, undo command should revert all changes.

However, when you edit some files after bulk change, the link could have
been broken. Consider you have files A and B with single bulk change (rename).
Then you open file A and edit it. Then you open file B and attempt to perform
Undo operation. For file A, there are two changes on Undo stack - rename
and editing. On file B there is single change - rename. VS cannot perform
the linked undo, because this would break undo stack for file A, so links
between undo items are broken, and they become multiply independent undo
items.

Sincerely,
Ilya Ryzhenkov

JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"


G> "Undo" without me having to need to "close without save". I am not
G> goign to argue about design here but assume that a rename refactoring
G> affects 27 files I want to be able to undo this rename refactoring
G> with a simple shortcut instead of having to manually close the 27
G> files without saving them.
G>
G> "Stefan Lieser" <stefan@lieser-online.de> wrote in message
G> news:g33bnb$a0t$1@is.intellij.net...
G>
>> If you refactor and advice R# to open all files it has to changed you
>> can use the IDE's Undo command to undo all changes. So I don't
>> understand what functionality you are looking for that goes further?
>>
>> Jeremy Gray schrieb:
>>
>>> That would work if by "undo" you mean saving all files before doing
>>> a refactoring, doing the refactoring, and then "undo"ing it by
>>> telling the IDE to close all files, opt to not save any of them, and
>>> then re-open them to continue your work. I suspect Gabriel is
>>> looking for something a little more like an "undo" command. ;)
>>>


0
Comment actions Permalink

Interesting. I guess I have just become so used to the idea that this wouldn't work (or perhaps to a point in the past when it didn't) that I've avoided putting myself into a position to see it in action. I'll have to make a point to try this behaviour out very soon.

0
Comment actions Permalink

I have noticed that the undo does not even work anymore from the moment that
you set the focus to one of the 27 files without even touching it. You then
have to manually undo the files one by one. Therefore I belief that we need
a better support for undoing the latest refactoring. I realise that if you
start editing files that this no longer works but I can live with that.

Cheers

Gabriel Lozano-Moran

"Ilya Ryzhenkov" <orangy@jetbrains.com> wrote in message
news:76a2bd0b15a3748ca9de651acff42@news.intellij.net...

Hello Gabriel Lozano-Moran,

>

After refactoring, or any other bulk change, if you keep files open Visual
Studio links individual changes together and then undo them in one go. So,
if rename changes 27 files, and you keep them open via checkbox on
refactoring dialog, undo command should revert all changes.

>

However, when you edit some files after bulk change, the link could have
been broken. Consider you have files A and B with single bulk change
(rename). Then you open file A and edit it. Then you open file B and
attempt to perform Undo operation. For file A, there are two changes on
Undo stack - rename and editing. On file B there is single change -
rename. VS cannot perform the linked undo, because this would break undo
stack for file A, so links between undo items are broken, and they become
multiply independent undo items.

>

Sincerely,
Ilya Ryzhenkov

>

JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

>
>

G> "Undo" without me having to need to "close without save". I am not
G> goign to argue about design here but assume that a rename refactoring
G> affects 27 files I want to be able to undo this rename refactoring
G> with a simple shortcut instead of having to manually close the 27
G> files without saving them.
G> G> "Stefan Lieser" <stefan@lieser-online.de> wrote in message
G> news:g33bnb$a0t$1@is.intellij.net...
G>

>>> If you refactor and advice R# to open all files it has to changed you
>>> can use the IDE's Undo command to undo all changes. So I don't
>>> understand what functionality you are looking for that goes further?
>>>
>>> Jeremy Gray schrieb:
>>>
>>>> That would work if by "undo" you mean saving all files before doing
>>>> a refactoring, doing the refactoring, and then "undo"ing it by
>>>> telling the IDE to close all files, opt to not save any of them, and
>>>> then re-open them to continue your work. I suspect Gabriel is
>>>> looking for something a little more like an "undo" command. ;)
>>>>
>



0
Comment actions Permalink

I am on the fence on this one. On the one hand, it would be nice to have a "bulk" undo, but on the other hand that is closer to a source control issue than something for RS. On the other hand (assuming more hands are available), it would be great to have a "Cleanup all open files" and "Cleanup up all checked out files" option. I think that once the RS internals evolve to deal with "all open" or "all checked out", then it would be nice to have a "snapshot/restore" capability. But since source control already provided "snapshot/restore", I don't think it should be a high priority for RS.

Yes I know that not all software uses source control, but I think users should be encouraged to make use of existing capabilities rather than have RS jump through hoops to provide said capability.

0
Comment actions Permalink

So what you are saying is that you want me to commit before I perform a refactoring and then revert if I don't like it? Sorry, but there is no way that that is going to happen, given the requirements on commits in each and every one of the environments I've worked in. And before you say it: please don't get started on layering on distributed revision control so that I can manage my own work in progress. DRCS has its place, but making up for undo is not it. ;)

0
Comment actions Permalink

We are not talking about simple refactorings here, just "bulk" refactoring that affects many files. What I am suggesting is that right now a developer can simpy "commit" the code before undertaking a significant refactoring (and implicitly that a significant refactoring should only be undertaken on committable code, step by step), and if desired during the refactoring, simply "undo pending changes". Given that ability, I would not place "bulk unrefactor" as a feature I would want RS developers to be working on, and in particular based on my experience I would much prefer a "cleanup all open files" and/or "cleanup all pending files" feature.

I don't see a need for RS to provide source versioning given the vast number of tools on the market that already support version control.

0
Comment actions Permalink

I'm not looking for R# to provide source control. The original poster of this thread is looking for R# to support stronger Undo scenarios. For my part, I'm only asking you to stop telling me to violate my client's source control policy or start using git or Mercurial or what have you in order to have stronger Undo.

0
Comment actions Permalink

I tend to lean on the version control software for this with commits after
testing each bulk change, or a revert if a bulk change had an unintended
side effect. It's fairly easy to do with Subversion and either AnkhSVN or
VisualSVN and it's a lot safer than relying on undo. I also prefer to commit
smallish changes as I'm refactoring a code base so I don't loose too much
work if I make a cough mistake or something bad happens.

"Gabriel Lozano-Moran" <gabriel@lozano-moran.name> wrote in message
news:g2tp2h$eue$1@is.intellij.net...

Hello

>

A great addition to R# would be to add the capability to undo the last
refactoring in all the affected source files.

>

Cheers

>

Gabriel Lozano-Moran

0
Comment actions Permalink

does R# not support in-app-version-control like Webstorm? - I just overwrote a file during a rename-refactor and retrieved the content of the overwritten file via main toolbar > VCS > Local History #woohoo - it's no 'command-z' but it's good enough for me. 

0

Please sign in to leave a comment.