Create and apply patches

Source: Internet
Author: User
Tags tortoisesvn
Create and apply patches

For open-source projects (such as this project), everyone has read access to the repository, and anyone can modify the project. How can we control these changes? If anyone can submit their own changes, the project may always be in an unstable state, and it is likely to be paralyzed forever. In this casePatchThe file format is first submitted to the development team with write access permissions. The development team can review the patch file and then decide to submit it to the repository or return it to the author.

The patch file simply uses a uniform differential description file to show the differences between your work copy and the basic version.

Create a patch file

First, you need to modify and test the modification content. Then, use tortoisesvn in the parent directory → create a patch... to replace tortoisesvn → submit ....

Figure 5.42. Patch creation dialog box

Now you can select the file to be included in the patch, just as you need to complete the submission. This will generate a single file, which includes a summary of all the modifications you have made to the selected file since the last update from the repository.

In this dialog box, the column can be customized as in the check and modify dialog box. For more details, see "local and remote status ".

You can create independent patches that contain modifications to different file sets. Of course, if you create a patch fileSame copyMore modifications to the file will create another patch file. The second patch file containsAll.

You can use a selected file name to save the patch file. The patch file can have any extension..patchOr.diffAs the extension, you are now ready to submit your patch file.

You can also save the patch to the clipboard instead of a file. In this way, you can paste it into an email for others' review. Or you have two working copies on the machine and want to pass the modifications to another copy. Patches on the clipboard facilitate these operations.

Apply a patch file

Patch files are applied to your working copy. this shoshould be done from the same folder level as was used to create the patch. if you are not sure what this is, just look at the first line of the patch file. for example, if the first file being worked on wasdoc/source/english/chapter1.xmlAnd the first line in the patch file isIndex: english/chapter1.xmlThen you need to apply the patch todoc/source/Folder. However, provided you are in the correct working copy, if you pick the wrong folder level, tortoisesvn will notice and suggest the correct level.

To patch your work copy, you must at least read the code base. Because the merging program must refer to the modifications made by other developers in the revised version.

From the context menu for that folder, click on tortoisesvn → Apply patch... this will bring up a file open dialog allowing you to select the patch file to apply. By default only.patchOr.diffFiles are shown, but you can opt for "All Files". If you previusly saved a patch to the clipboard, you can use open from clipboard... in the file open dialog.

If the patch file.patchOr.diffIf it is an extension, you can right-click the patch file and select tortoisesvn → Apply the patch... in this case, the system will prompt you to enter the location of the Work copy.

These two methods only provide different ways to do the same thing. The first method is to select a working copy and then browse the patch file. The second method is to select a patch file and then browse the working copy.

Once you have selected the location of the patch file and work copy, tortoisemerge will merge the pudding file into your work copy. A small window pops up to list all changed files. Double-click each file, check the changes, and save the merged file. The remote developer patch has now been applied to your work copy. You need to submit it so that everyone can access these modifications from the code base.

The remote developer patch has now been applied to your work copy. You need to submit it so that everyone can access these modifications from the code base.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.