1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205
|
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Patching your Gallery</title><meta name="generator" content="DocBook XSL Stylesheets V1.64.1"><link rel="home" href="index.html" title="Gallery Manual"><link rel="up" href="gallery1-admin.html" title="Chapter2.Gallery 1.x Administration Guide"><link rel="previous" href="gallery1-admin.offline.html" title="Creating an Offline Copy"><link rel="next" href="gallery1-admin.mirroring.html" title="Mirroring Gallery"><link rel="stylesheet" href="html.css"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Patching your Gallery</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="gallery1-admin.offline.html">Prev</a></td><th width="60%" align="center">Chapter2.Gallery 1.x Administration Guide</th><td width="20%" align="right"><a accesskey="n" href="gallery1-admin.mirroring.html">Next</a></td></tr></table><hr></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="gallery1-admin.patching"></a>Patching your Gallery</h2></div></div><div></div></div><div class="toc"><dl><dt><span class="sect2"><a href="gallery1-admin.patching.html#gallery1-admin.patching.whatare">What are patches?</a></span></dt><dt><span class="sect2"><a href="gallery1-admin.patching.html#gallery1-admin.patching.applying">Applying Patches</a></span></dt><dt><span class="sect2"><a href="gallery1-admin.patching.html#gallery1-admin.patching.creating">Creating Patches</a></span></dt></dl></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
This is pretty hard to explain to a beginner. Contributions are welcome.
</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="gallery1-admin.patching.whatare"></a>What are patches?</h3></div></div><div></div></div><p>
A patch is a set of instructions that tell you (or a program) what changes
to make to add a feature to your gallery. The advantage of a patch over just
getting the whole files, is that a patch can make the changes to files that
have already have changes to them. If you copied files over, you'd lose the
other changes.
</p><p>
Patches can be of three different forms "normal", context, and unified (and
unified-context). Here's what each looks like.
</p><p>
Let's say this is the original file:
</p><pre class="programlisting">
1 The rain
2 On the plain
3 -Says Alice
4
5 Let's keep this sentence.
6 Let's ditch this long
7 and boring sentence.
</pre><p>
And the changed file...
</p><pre class="programlisting">
1 The rain
2 In Spain
3 Falls mainly
4 On the plain
5 -Says Bob
6
7 Let's keep this sentence.
</pre><p>
</p><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="gallery1-admin.patching.whatare.normal"></a>Normal</h4></div></div><div></div></div><pre class="programlisting">
///we'll Append these after line 1 to become lines 2--3///
1a2,3
> In Spain
> Falls mainly
///we'll Change line 3, which in the new file is line 5///
3c5
< -Says Alice
---
> -Says Bob
///we'll Delete lines 6--7, but they would've been at line 7 in the new file///
6,7d7
< Let's ditch this long
< and boring sentence.
</pre></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="gallery1-admin.patching.whatare.context"></a>Context</h4></div></div><div></div></div><pre class="programlisting">
*** file.orig Sat Jan 01 00:00:00 2000 ///the original filename///
--- file Tue Apr 29 00:00:00 2003
///the start of a "hunk" of text to change///
***************
///start/end line numbers in your original file///
*** 1,8 ****
///lines with no "!", "-", or "+" are there for context///
The rain
On the plain
///the "!' means this line will have a change (see below)///
! -Says Alice
Let's keep this sentence.
///the "-" means this line should be deleted///
- Let's ditch this long
- and boring sentence.
///start/end line numbers in changed file///
--- 1,8 ----
The rain
///the "+" means this line should be added///
+ In Spain
+ Falls Mainly
On the plain
///this is the change for the line marked "!" up above///
! -Says Bob
Let's keep this sentence.
</pre></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="gallery1-admin.patching.whatare.unified"></a>Unified</h4></div></div><div></div></div><pre class="programlisting">
--- file.orig Sat Jan 01 00:00:00 2000 ///the original filename///
+++ file Tue Apr 29 00:00:00 2003
///''the start of a "hunk". "-#,#" gives the lines in the original file,
while "+#,#" gies the lines in the file once it's changed.''///
@@ -1,8 +1,8 @@
///again, lines with no "-" or "+" are contextual///
The rain
+In Spain
+Falls Mainly
On the plain
///the "replace" is made by a line delete followed by a line add///
--Says Alice
+-Says Bob
Let's keep this sentence.
-Let's ditch this long
-and boring sentence.
</pre></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="gallery1-admin.patching.applying"></a>Applying Patches</h3></div></div><div></div></div><p>
Applying patches is easiest with ssh or telnet access. Basically, just copy
the patch to the directory you'd like to patch. Then simply type
<span><b class="command">patch -p0 < patchfile.txt</b></span>
</p><p>
If you're using Windows, you need the <span><b class="command">patch.exe</b></span> program
from <a href="http://unxutils.sourceforge.net/" target="_top">http://unxutils.sourceforge.net/</a>.
Then simply using this command: <span><b class="command">patch -p0 -i patchfile.txt</b></span>.
</p><p>
If only have FTP access, you'll have to apply the patchfile manually. Add
lines with +, delete lines with -, and change lines with !. It's painful, but
you will get the hang of it.
</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>
Always back up your Gallery before patching it.
</p></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
If the patch was made with a different version of Gallery than you're using,
it probably won't work. You may need to apply at least part of the patch
manually.
</p></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="gallery1-admin.patching.creating"></a>Creating Patches</h3></div></div><div></div></div><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>
Before making a patch, especially to distribute to the public, make sure
you have throughly tested it! If possible, build patches aganist the
latest stable version and CVS version.
</p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="gallery1-admin.patching.creating.cvs"></a>Creating Patches with CVS</h4></div></div><div></div></div><p>
For more information about using CVS see: <a href="http://www.cvshome.org/" target="_top">http://www.cvshome.org</a>.
For more information about how to check Gallery out via CVS, see
<a href="http://sourceforge.net/cvs/?group_id=7130" target="_top">http://sourceforge.net/cvs/?group_id=7130</a>.
</p><p>
Once you have created the patch, simply type this command:
<span><b class="command">cvs diff -cu > patch.txt</b></span>. <tt class="filename">patch.txt</tt>
will now contain the patch.
</p><p>
Then build a zip file containing this patch and any new files that you have
created as part of this change. Upload them somewhere on the web, and
publish the link.
</p><p>
It's just as easy to make patches under Windows as it is under *nix. You
just need the correct tools installed. See the
<a href="http://gnuwin32.sf.net" target="_top">GNUWin32 Project</a> for the
"diffutils-bin" package and it's requirements. Also get "patch-bin" as well.
</p></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="gallery1-admin.offline.html">Prev</a></td><td width="20%" align="center"><a accesskey="u" href="gallery1-admin.html">Up</a></td><td width="40%" align="right"><a accesskey="n" href="gallery1-admin.mirroring.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Creating an Offline Copy</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">Mirroring Gallery</td></tr></table></div></body></html>
|