patchreview: allow updating branch diffs
ClosedPublic

Authored by rjvbb on Aug 19 2017, 6:18 PM.

Details

Summary

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.

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.

Test Plan

Tested on the 5.1 branch; works as expected.

This is a useful little change to the patch review plugin itself:

 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();
+        }
+    }
+}

Diff Detail

Repository
R33 KDevPlatform
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
rjvbb created this revision.Aug 19 2017, 6:18 PM
Restricted Application added a subscriber: kdevelop-devel. · View Herald TranscriptAug 19 2017, 6:18 PM
apol accepted this revision.Sat, Sep 9, 11:16 PM
apol added a subscriber: apol.

I like the feature. Thanks!

I'm pretty sure it wasn't implemented because the VcsDiff VCSDiffUpdater::update() API sucks, but I guess we can look into that in another iteration.

This revision is now accepted and ready to land.Sat, Sep 9, 11:16 PM
This revision was automatically updated to reflect the committed changes.
apol added a comment.Sun, Sep 10, 11:09 AM

Rene, you submitted it to the wrong repository.

This should go to kdevelop.

El dia 10 set. 2017 2:41 a. m., "René J.V. Bertin" <
noreply@phabricator.kde.org> va escriure:

I planned to do a 5.1 -> 5.2 branch merge and then realised I couldn't. It's been committed to kdevelop too.