<table><tr><td style="">rjvbb created this revision.<br />rjvbb added a project: KDevelop.<br />Restricted Application added a subscriber: kdevelop-devel.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D7421" rel="noreferrer">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>This is a small patch introducing a feature that's part of my personal patchreview diff contextlines mod, but that might be useful for others too. It makes the patchreview toolview's update button do something.</p>

<p>The BranchManager will have disappeared by the time users can press this button, so the source branch remains fixed. But since the diff is against the branch currently checked out, this change makes it possible to check out another branch (via the BranchManager or externally) and simply hit the button to update the diff. Saves a few clicks and probably some CPU cycles related to reloading and reparsing open documents too.</p></div></div><br /><div><strong>TEST PLAN</strong><div><p>Tested on the 5.1 branch; works as expected.</p>

<p>This is a useful little change to the patch review plugin itself:</p>

<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);"> void PatchReviewPlugin::forceUpdate() {
     if( m_patch ) {
-        m_patch->update();
+        // only trigger an update if the plugin can update itself
+        VCSDiffPatchSource *vcsPatch = dynamic_cast<VCSDiffPatchSource*>(m_patch.data());
+        if (!vcsPatch || vcsPatch->m_updater) {
+            m_patch->update();
+            notifyPatchChanged();
+        }
+    }
+}</pre></div></div></div><br /><div><strong>REPOSITORY</strong><div><div>R33 KDevPlatform</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D7421" rel="noreferrer">https://phabricator.kde.org/D7421</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>vcs/dvcs/ui/branchmanager.cpp</div></div></div><br /><div><strong>To: </strong>rjvbb, KDevelop<br /><strong>Cc: </strong>kdevelop-devel, KDevelop, geetamc, Pilzschaf, akshaydeo, surgenight, arrowdodger<br /></div>