D7421: patchreview: allow updating branch diffs

René J.V. Bertin noreply at phabricator.kde.org
Sat Aug 19 18:19:04 UTC 2017


rjvbb created this revision.
rjvbb added a project: KDevelop.
Restricted Application added a subscriber: kdevelop-devel.

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

REPOSITORY
  R33 KDevPlatform

REVISION DETAIL
  https://phabricator.kde.org/D7421

AFFECTED FILES
  vcs/dvcs/ui/branchmanager.cpp

To: rjvbb, #kdevelop
Cc: kdevelop-devel, #kdevelop, geetamc, Pilzschaf, akshaydeo, surgenight, arrowdodger
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20170819/f3abe551/attachment.html>


More information about the KDevelop-devel mailing list