• <div><p>Fixes this issue of the CoreDNS: https://github.com/coredns/coredns/issues/2138</p><p>该提问来源于开源项目：miekg/dns</p></div>
• Original Link: http://blogs.flexerasoftware.com/installtalk/2011/10/i-take-it-all-back-using-windows-installer-msi-rollback-actions.html#sthash.KIIUKl0s.dpuf ByRobert Dickau Sometimes an installer ....
Original Link: http://blogs.flexerasoftware.com/installtalk/2011/10/i-take-it-all-back-using-windows-installer-msi-rollback-actions.html#sthash.KIIUKl0s.dpuf
By Robert Dickau
Sometimes an installer just needs to do something that Windows Installer doesn't normally do. When that happens, it's a simple matter of writing a custom action, right? Unfortunately, it's not that simple. In this post, we'll look at techniques for reversing changes made by a custom action.
When you launch an installation, it first runs in what's called immediate mode or script-generation mode. As your installer runs in this immediate mode, it generates an internal to-do list of what it will do on a system—"First I'll install files, then I'll create shortcuts, then I'll write to the registry, and then..."—but doesn't yet make any system changes.
After immediate mode is done, your installer then switches to something called deferred mode or script-execution mode. In deferred mode, your installer performs the actions listed in this script: "Now I'm installing files, now I'm creating shortcuts, now I'm writing to the registry, and now I'm..." (The internal to-do list, or script, is fixed at this point, which is why you can't set property values outside of immediate mode, for example).
As your installer runs in deferred mode, it simultaneously creates a rollback script describing how to undo changes made by the standard actions. While the installer installs files, for example, it adds to the rollback script specific information about what it would have to do to get the system back to its pre-installer state: "To get the system back to how it was, I'd need to remove sample.exe and readme.txt, and also restore the original version of sample.dll that I replaced." (Windows Installer will also temporarily hold on to resources such as files that it needs to restore in case of rollback.) If the installer runs to completion, the rollback script and any cached resources are deleted. But if the installation encounters a fatal error, or if the user cancels the installation during deferred mode, the rollback script runs.
A big reason to use standard Windows Installer actions instead of custom actions is that standard actions handle their own cleanup during uninstallation or rollback. When you use a custom action, Windows Installer has no idea what the executable, DLL, InstallScript, etc., that you used did to the system, and therefore has no idea how to roll back the changes the custom action made. If your deferred custom action makes any system changes, you should create a corresponding rollback action.
Immediate mode actions don't write to the rollback script, which means that immediate-mode actions that make system changes won't get rolled back if the installation fails. This is one of several reasons not to make system changes during immediate mode
(Bonus grammar tip: The noun and adjective are one word, rollback, while the verb is two words, roll back. "If my rollback action runs, it will roll back my changes." An easy trick is to see if it's appropriate to form the past tense by adding -ed: You'd say "rolled back", not "rollbacked", and the present tense would be the same number of words. Same goes for cleanup vs. clean up, setup vs. set up, and so on. Anyway.)
With InstallShield, you mark a custom action as being a rollback action using its In-Script Execution setting.

Because the rollback script is created as deferred execution is taking place, and not beforehand, a rollback action must be placed in the Execute sequence before the action it rolls back. (Anywhere before the action being rolled back is fine, but for readability's sake and other reasons, placing the rollback action immediately before the action it rolls back seems to work best.) If you write a deferred custom action called "ChangeSomething", its corresponding rollback action "ChangeSomethingBack" should appear in the sequences immediately before it.

Double Negatives
Things start to get confusing with uninstallation custom actions. Without a condition, an action always runs, both during the initial installation as well as maintenance mode, including a complete uninstallation. By setting a condition on an action, you can specify during which modes it should run: Not Installed for the initial installation, REMOVE="ALL" for complete uninstallation, and so on.
The same holds for rollback actions. If you have a deferred action that makes system changes during the initial installation, you'll need a rollback action in case the installation fails or the user cancels it. You'll also probably need an uninstallation action that reverses the changes during uninstallation; and also an uninstallation rollback action, in case the uninstallation fails or the user cancels it, and you need to undo whatever you just undid. Luckily, the same condition logic applies: if your deferred uninstallation action uses condition REMOVE="ALL", your uninstall-rollback action can use the same condition.
And Finally...
If your deferred action saves any temporary data—similar to how the InstallFiles action temporarily caches files it might need to restore—your rollback action can clean up that data when it reverses the effects of the original action. But what if the rollback action never runs?
Windows Installer defines yet another type of action, called a commit action, which runs only if the installation successfully runs to completion. If a rollback action runs, a commit action won't run; and if a commit action runs, it's too late for rollback. Defining an action as a commit action in InstallShield also involves the In-Script Execution setting, and follows the same condition logic as other deferred and rollback actions.
To summarize, if you create a custom action that makes changes to a target system, you might wind up making several others to handle rollback, uninstallation, uninstallation rollback, and cleanup. If that's not a good argument for avoiding custom actions that duplicate Windows Installer functionality, I don't know what is.
For more information and some hands-on experience—plus information about how things get trickier with all these deferred, rollback, and commit actions needing to read property values—come visit us at our Advanced Windows Installer (MSI) Using InstallShield Training Course.

转载于:https://www.cnblogs.com/cindy-hu-23/p/3748175.html
展开全文
• I am using windows 10 with hantek6022BE. I was able to test the openhantek. now I like to go back to original firmware. can you please guide me to revert the openhantek firmware to original hantek...
• The Windows Update History doesn´t let me uninstall the updates which changed the NETFramework Version and i can´t seem to install 4.7.2 since Windows detects a newer version and cancels the ...
• <ul><li>Browser: Chrome 75.0.3770.100</li><li>Operating system: Windows 10 1903</li></ul> <h3>Additional context <p>Add any other context about the problem here.</p><p>该提问来源于开源项目：...
• </li><li>Cordova version: 8.1.2</li><li>iOS/Android/Windows version: 4.5.5/6.4.0/-</li><li>Does this reproduce on a debug build or release build?release</li><li>Does this reproduce on a simulator, or ...
• <div><p>When I <code>ExecuteSqlCommand</code> query that creates table and it fails ...Operating system: Windows 10 IDE: Visual Studio 2017 15.9.11</p><p>该提问来源于开源项目：dotnet/ef6</p></div>
• ESC is not working for rollback (although it is suggested in the quicktip of the rollback button).\n\n<strong>Operating system:</strong>\nWindows XP/2003/2000</p><p>该提问来源于开源项目：...
• <p>When running under Windows and the Microsoft "ODBC Driver 11 for SQL Server" driver, I don't experience this problem. <p>I also tried it on a baseline startproject/startapp project and ...
• 强大电脑系统恢复还原软件(RollBack Rx)是一款功能强大的优秀系统恢复还原软件，是全面的Windows系统还原解决方案，程序可以帮助用户和IT管理员轻松地在几秒钟内恢复他们的个人电脑到任何以前的状态。 系统出错或...
• <div><p>On windows 8.1: <pre><code> lnd Error: panic: Rollback failed: truncate C:\Users\fresheneesz\AppData\Local\Lnd\data\testnet3\bitcoin\reg_filter_headers.bin: Access is denied. goroutine 28 ...
• <div><p>A huge bug!... - OS: Windows - Node Version: 12 <p><strong>Additional context Contact me if need to show it. </p><p>该提问来源于开源项目：aws-amplify/amplify-cli</p></div>
• WindowsXP SP3 Sun Java 1.6.0_04 In your view, is this a defect or a feature request? It is a defect. </code></pre> <p>Original issue reported on code.google....
• Being able to switch versions of a project was one of my favorite features of GUI git programs on windows, I would love to see that functionality come to git-cola. </p><p>该提问来源于开源项目：...
• 在使用TortoiseSVN的时候，不小心CheckIn错了东西，想RollBack回上一次代码。经过搜索发现如下方法：第一种方法: 使用TortoiseSVN进行回滚. 很明显, 这种方法只适用于windows平台. 以下摘自 TortoiseSVN文档:B.4. ...
在使用TortoiseSVN的时候，不小心CheckIn错了东西，想RollBack回上一次代码。经过搜索发现如下方法：第一种方法: 使用TortoiseSVN进行回滚. 很明显, 这种方法只适用于windows平台. 以下摘自 TortoiseSVN文档:

B.4. 回滚版本库里的版本

B.4.1. 使用版本日志对话框

如果想恢复某个版本或者版本范围的变更，最简单的方法是使用版本日志对话框。这种方法也可以用来撤销最近的若干次变更，把以前的某个版本变成最新版。

选中想要恢复变更的文件或者文件夹。如果想要恢复所有的变更，需要选中最顶层的文件夹。

选择TortoiseSVN → 显示日志，显示出版本列表。有可能需要使用全部显示或者下100 按钮，把想要恢复的版本显示出来。

选中想要恢复的版本。如果想要恢复一个版本范围，选中想要恢复的第一个版本，按住shift键，然后选中想要恢复的最后一个版本。注意，当恢复多个版本的时候，这些版本必须在列表中是连续的。用鼠标右键点击选中的版本（段），然后选择右键菜单 → 恢复这些版本的变更。

如果想要把以前的某个版本变成最新版本，右键点击选中的版本（范围），然后选择右键菜单 → 恢复到此版本。就能够撤销被选中版本后面所有的变更。

工作拷贝已经恢复到了变更以前的状态。检查恢复后的结果，然后提交变更。

B.4.2. 使用合并对话框

如果要撤销更大版本范围的变更，可以使用合并对话框。上一个方法在后台使用了合并的机制，在这个方法里我们直接使用合并功能。

在工作拷贝上选择TortoiseSVN → 合并。

在起始：文本框里输入想要恢复的变更所在的分支或标签的URL。它也将作为默认URL。

在起始版本文本框里输入当前工作拷贝的版本号。如果能够保证没有其他人会提交变更，可以使用最新版本。

确认使用“起始：”的 URL检查框处于被选中的状态。

在结束版本里输入想要恢复到的版本号。比如，想要恢复的最小版本号的前一个版本号。

点击合并按钮完成合并。

工作拷贝已经恢复到了变更以前的状态。检查恢复后的结果，然后提交变更。

B.4.3. 使用svndumpfilter

因为TortoiseSVN绝不会丢弃数据，所以那些被回滚的版本仍然以中间版本的形式被保留在版本库里。只是最新版本已经回到了以前的状态。如果想让版本库里的某些版本彻底消失，擦去这些版本曾经存在过的所有痕迹，就必须采取更极端的手段。不推荐使用这种方法，除非有很好的理由。比如某人向一个公开的版本库里提交了一份机密文件。
从版本库里删除数据的唯一方法就是使用svnadmin这个Subversion命令行工具。具体如何实现请参考Subversion手册。

第二种方法: 使用SubVersion自带的svn merge 命令. 这种方法适用于任何能使用SubVersion的平台. 以下摘自 <使用SubVersion进行版本控制> 4.4.2节:

svn merge另一个常用的做法是取消已经做得提交，假设你愉快的在/calc/trunk工作，你发现303版本对integer.c的修改完全错了，它不应该被提交，你可以使用svn merge来“取消”这个工作拷贝上所作的操作，然后提交本地修改到版本库，你要做得只是指定一个相反的区别：
$svn merge -r 303:302 http://svn.example.com/repos/calc/trunkU integer.c$ svn statusM  integer.c$svn diff…# verify that the change is removed…$ svn commit -m "Undoing change committed in r303."Sending        integer.cTransmitting file data .Committed revision 350.
我们可以把版本库修订版本想象成一组修改（一些版本控制系统叫做修改集），通过-r选项，你可以告诉svn merge来应用修改集或是一个修改集范围到你的工作拷贝，在我们的情况例子里，我们使用svn merge合并修改集#303到工作拷贝。
记住回滚修改和任何一个svn merge命令都一样，所以你应该使用svn status或是svn diff来确定你的工作处于期望的状态中，然后使用svn commit来提交，提交之后，这个特定修改集不会反映到HEAD版本了。
继续，你也许会想：好吧，这不是真的取消提交吧！是吧？版本303还依然存在着修改，如果任何人取出calc的303-349版本，他还会得到错误的修改，对吧？
是的，这是对的。当我们说“删除”一个修改时，我们只是说从HEAD删除，原始的修改还保存在版本库历史中，在多数情况下，这是足够好的。大多数人只是对追踪HEAD版本感兴趣，在一些特定情况下，你也许希望毁掉所有提交的证据（或许某个人提交了一个秘密文件），这不是很容易的，因为Subversion设计用来不丢失任何信息，每个修订版本都是不可变的目录树 ，从历史删除一个版本会导致多米诺效应，会在后面的版本导致混乱甚至会影响所有的工作拷贝。 [9]

解释一下,  svn merge -r 303:302 http://svn.example.com/repos/calc/trunk 这个命令是把当前目录当作工作拷贝.  如果想指定工作拷贝路径(如: c:/test), 则命令变成以下:

svn merge -r 303:302 http://svn.example.com/repos/calc/trunk  c:/test

Roll back revisions in the repository

Use the revision log dialog

The easiest way to revert the changes from a single revision, or from a range of revisions, is to use the revision log dialog. This is also the method to use of you want to discard recent changes and make an earlier revision the new HEAD.

Select the file or folder in which you need to revert the changes. If you want to revert all changes, this should be the top level folder.

Select TortoiseSVN → Show Log to display a list of revisions. You may need to use Get All or Next 100 to show the revision(s) you are interested in.

Select the revision you wish to revert. If you want to undo a range of revisions, select the first one and hold the shift key while selecting the last one. Note that for multiple revisions, the range must be unbroken with no gaps. Right click on the selected revision(s), then select Context Menu → Revert changes from this revision.

Or if you want to make an earlier revision the new HEAD revision, right click on the selected revision(s), then select Context Menu → Revert to this revision. This will discard all changes after the selected revision.

You have reverted the changes within your working copy. Check the results, then commit the changes.

Use the merge dialog

To undo a larger range of revisions, you can use the Merge dialog. The previous method uses merging behind the scenes; this method uses it explicitly.

In your working copy select TortoiseSVN → Merge.

In the From: field enter the full folder url of the branch or tag containing the changes you want to revert in your working copy. This should come up as the default URL.

In the From Revision field enter the revision number that you are currently at. If you are sure there is no-one else making changes, you can use the HEAD revision.

make sure the Use "From:" URL checkbox is checked.

In the To Revision field enter the revision number that you want to revert to, ie. the one before the first revision to be reverted.

Click OK to complete the merge.

You have reverted the changes within your working copy. Check the results, then commit the changes.

Use svndumpfilter

Since TortoiseSVN never loses data, your “rolled back” revisions still exist as intermediate revisions in the repository. Only the HEAD revision was changed to a previous state. If you want to make revisions disappear completely from your repository, erasing all trace that they ever existed, you have to use more extreme measures. Unless there is a really good reason to do this, it is not recommended. One possible reason would be that someone committed a confidential document to a public repository.
The only way to remove data from the repository is to use the Subversion command line tool svnadmin. You can find a description of how this works in the Subversion Book .

信息来源：http://blog.csdn.net/riag/archive/2007/05/30/1630819.aspxhttp://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-howto-rollback.html
展开全文
• <p>Commit and Rollback both raise exceptions when used in Promise form. <pre><code> connection.commit().then(connection.close()); </code></pre> <h2>Error message <pre><code> Error: NJS-032: connection...

...