OSDN Git Service

d0eb137175fd1db36deadb0083047d482a2703ea
[tortoisegit/TortoiseGitJp.git] / doc / source / en / TortoiseGit / tsvn_dug / dug_patch.xml
1 <?xml version="1.0" encoding="UTF-8"?>\r
2 <!DOCTYPE sect1 SYSTEM "../../../dtd/dblite.dtd">\r
3 <sect1 id="tsvn-dug-patch">\r
4         <title>Creating and Applying Patches</title>\r
5         <indexterm>\r
6                 <primary>patch</primary>\r
7         </indexterm>\r
8         <indexterm>\r
9                 <primary>diff</primary>\r
10         </indexterm>\r
11         <indexterm>\r
12                 <primary>unified diff</primary>\r
13         </indexterm>\r
14         <?dbhh topicname="HIDD_FORMAT_PATCH"?>\r
15         <?dbhh topicname="HIDD_APPLY_PATCH_LIST"?>\r
16         <?dbhh topicname="HIDD_CREATEPATCH"?>\r
17         <para>\r
18                 For open source projects (like this one) everyone has read\r
19                 access to the repository, and anyone can make a contribution\r
20                 to the project. So how are those contributions controlled?\r
21                 If just anyone could commit changes, the project would be permanently\r
22                 unstable and probably permanently broken. In this situation the\r
23                 change is managed by submitting a <firstterm>patch</firstterm> file\r
24                 to the development team, who do have write access.\r
25                 They can review the patch first, and then either submit it to the\r
26                 repository or reject it back to the author.\r
27         </para>\r
28         <para>\r
29                 Patch files are simply Unified-Diff files showing the differences\r
30                 between your working copy and the base revision.\r
31         </para>\r
32         <sect2 id="tsvn-dug-patch-1">\r
33                 <title>Creating a Patch File</title>\r
34                 <para>\r
35                         First you need to make <emphasis>and test</emphasis> your changes.\r
36                         Then instead of using\r
37                         <menuchoice>\r
38                                 <guimenu>TortoiseGit</guimenu>\r
39                                 <guimenuitem>Commit...</guimenuitem>\r
40                         </menuchoice>\r
41                         on the parent folder, you select\r
42                         <menuchoice>\r
43                                 <guimenu>TortoiseGit</guimenu>\r
44                                 <guimenuitem>Create Patch Serial...</guimenuitem>\r
45                         </menuchoice>\r
46                 </para>\r
47                 <figure id="tsvn-dug-patch-dia-1">\r
48                         <title>The Create Patch dialog</title>\r
49                         <graphic fileref="../images/CreatePatch.png"/>\r
50                 </figure>\r
51                 <para>\r
52                         <guilabel>Directory</guilabel> is output directory of patch.\r
53                         Patch file name will be created by commit subject. \r
54                 <para>\r
55                         <guilabel>Since</guidlabel> create patch from point. You can click\r
56                         <guibutton>...</guibutton> to launch refbrowse dialog to choose branch or tag.\r
57                 </para>\r
58                 <para>\r
59                         <guilabel>Number Commits</guilabel> is limited how much patch will created.\r
60                 </para>\r
61                 <para>\r
62                         <guilabel>Range</guilabel> is choose range of <guilabel>from</guilabel> commit \r
63                         to <guilabel>to</guilabel>. You can click <guibutton>...</guibutton> to launch\r
64                         log dialog to choose commit.\r
65                 </para>\r
66                 <para>\r
67                         <guilabel>Send Mail after create</guilabel> launch send mail dialog after patches created.\r
68                 </para>\r
69         </sect2>\r
70         <sect2 id="tsvn-dug-patch-2">\r
71                 <title>Applying a Patch File</title>\r
72                 <para>\r
73                         Patch files are applied to your working copy. This should be done\r
74                         from the same folder level as was used to create the patch.\r
75                         If you are not sure what this is, just look at the first line of\r
76                         the patch file. For example, if the first file being worked on was\r
77                         <filename>doc/source/english/chapter1.xml</filename>\r
78                         and the first line in the patch file is\r
79                         <filename>Index: english/chapter1.xml</filename>\r
80                         then you need to apply the patch to the\r
81                         <filename>doc/source/</filename> folder.\r
82                         However, provided you are in the correct working copy, if you\r
83                         pick the wrong folder level, TortoiseGit will notice and suggest the\r
84                         correct level.\r
85                 </para>\r
86                 <!--\r
87                 <para>\r
88                         In order to apply a patch file to your working copy, you need\r
89                         to have at least read access to the repository.\r
90                         The reason for this is that the merge program must\r
91                         reference the changes back to the revision against\r
92                         which they were made by the remote developer.\r
93                 </para>\r
94                 -->\r
95                 <para>\r
96                         From the context menu for that folder, click on\r
97                         <menuchoice>\r
98                                 <guimenu>TortoiseGit</guimenu>\r
99                                 <guimenuitem>Apply Patch Serial...</guimenuitem>\r
100                         </menuchoice>\r
101                         <figure id="tsvn-dug-apply-patch">\r
102                                 <title>The Apply Patch Dialog</title>\r
103                                 <graphic fileref="../images/ApplyPatch.png"/>\r
104                         </figure>\r
105                 </para>\r
106                 <para>\r
107                         Alternatively, if the patch file has a <filename>.patch</filename>\r
108                         or <filename>.diff</filename> extension, you can right click on it\r
109                         directly and select\r
110                         <menuchoice>\r
111                                 <guimenu>TortoiseGit</guimenu>\r
112                                 <guimenuitem>Apply Patch...</guimenuitem>\r
113                         </menuchoice>.\r
114                         In this case you will be prompted to enter a working copy location.\r
115                         <figure id="tsvn-dug-choose-repository">\r
116                                 <title>The Choose Repository Dialog</title>\r
117                                 <graphic fileref="../images/ChooseRepository.png"/>\r
118                         </figure>\r
119                 </para>\r
120                 <para>\r
121                         <guibutton>Add</guibutton> insert patch\r
122                 </para>\r
123                 <para>\r
124                         <guibutton>Up</guibutton> Move chosen patch up.\r
125                 </para>\r
126                 <para>\r
127                         <guibutton>Down</guibutton> Move Chosen patch down.\r
128                 </para>\r
129                 <para>\r
130                         <guibutton>Remove</guibutton> Remove Chosen patch.\r
131                 </para>\r
132                 <para>\r
133                         <guibutton>Apply</guibutton> start apply patch one by one\r
134                 </para>\r
135         </sect2>\r
136 </sect1>\r