PyCharm 2024.2 Help

Apply Patch dialog

Use the dialog to apply changes from a patch file. For more information, refer to Use patches

Item

Tooltip and Shortcut

Description

Patch file name

Specify the name of the *.patch file that you want to apply. Enter the fully qualified name or click Browse the Browse button and select the patch file in the dialog that opens.

Show diff

Ctrl+D

Open the Diff Viewer that shows the differences between your local working copy, the repository version, and the patch.

Change Directory Paths

Choose how you want directory paths to be displayed:

  • Map base directory: in the dialog that opens, select the directory relative to which file names in the patch file will be interpreted. You can map a base directory to a single file, directory, or selection.

  • Remove Leading Directory: apply the changes to files located in different directories from the ones specified in the patch. Clicking this button removes one slash in the path to the target file. Click the button as many times as many leading directories you need to remove. The number of removed slashes is indicated in square brackets.

  • Remove All Leading Directories: remove all leading directories with one click and apply the patch to the file with the specified name in the base directory.

  • Restore Leading Directory: revert the last Remove Leading Directory action. Click the button as many times as many previously stripped leading directories you need to restore.

  • Restore All Leading Directories: revert the Remove All Leading Directories action.

Refresh

Click this button to synchronize the tree with the current state of the file system.

Group By

Click to select how you want to group files modified in the patch.

Name

Select an existing changelist or type the name of a new changelist where you want the patch to be added.

Comment

Enter a comment to the new changelist.

Set active

Select this checkbox to set the active status for the new changelist right after the changes are restored in it. When this checkbox is cleared, the current active changelist remains active.

Track context

Select this checkbox to have PyCharm preserve the context of the task associated with the new changelist on its deactivation and restore the context when the changelist becomes active. For more information, refer to Manage tasks.

Analyze and apply patch from clipboard on the fly

Select this option if you want PyCharm to automatically detect patches in clipboard contents and suggest applying them.

Import to Shelf

Click this button to move the patch contents to a shelf instead of applying it. A new changelist will the patch file be added to the Shelf tab of the Commit tool window Alt+0. You can review the changes and unshelve them when needed.

If the patch cannot be applied without conflicts, conflicting lines are highlighted in red.

Last modified: 28 June 2024