Skip to content

Issue578 compare and replace folders

Created originally on Bitbucket by colin-hurley (Colin Hurley)

Was already merged in Bitbucket before import, marked as merged by the import user

  • Remove obsolete class ActionCompareWithParent

    It appears that this class became OBE in version 2.5.0 with the action-to-command refactoring. There may be more OBE classes in the com.vectrace.MercurialEclipse.team package, but I have not confirmed this.

  • Fix method name typo

    This typo was found after my previous PR was submitted

  • Add some javadoc and comments to MercurialStatusCache

  • Add javadoc to SafeUIJob and SafeWorkspaceJob

    The javadoc explains exactly what these classes do and why developers should generally avoid them and use the normal UIJob and WorkspaceJob classes instead.

  • Improve Compare With and Replace With commands to support folders and projects

    The Compare With commands required only relatively minor changes and were changed to use mostly pre-existing code. There are several utility methods in CompareUtils and a few of them do not support folders and projects. For the most part, I only needed to change the Compare With commands to use another method on CompareUtils that did support folders and projects.

    However, the Replace With commands required more significant refactoring. The existing code was not well suited for reverting folders and projects, especially when file additions and removals were involved. This is largely a result of the implementation of the revert dialog. It was cumbersome to try and retrofit proper support for reverting folders and projects into the existing code (ActionRevert and the classes it uses), so I opted to implement a new base class for the Replace WIth commands (BaseReplaceWithHandler) and a new general-purpose RevertJob class. These new classes borrow the relevant bits of code from ActionRevert, etc., but remain simple and easy to follow.

    The Replace With Another Changeset command now uses the ordinary revision chooser dialog, instead of the revert dialog. This is consistent with the Compare With Another Changeset command and enables greater flexibility when the revert is performed. Since the selected folder/project is used as the argument for the revert command, rather than enumerating all of the files within that folder/project, Mercurial is able to restore files that were removed. This is not possible with the current revert dialog, since the files to restore would need to be passed to the revert command, but the revert dialog doesn't know about files that are not present in the currently checked-out revision.

    For the Compare With Parent Changeset and Replace With Parent Changeset commands, I did need to adjust how the "previous" revision for a resource was being calculated. The hg parents command doesn't work on directories, so I implemented the getPreviousChangeset method on the HgLogClient, which uses a small revset query to figure out the most recent revision that modified the file.

    Refs #578 (closed)

Merge request reports

Loading