Initial Commit
[packages] / xemacs-packages / xemacs-devel / texi / patcher.texi
1 \input texinfo
2
3 @c patcher.texi --- Patcher documentation
4
5 @c Copyright (C) 2002, 2003, 2004, 2007, 2008, 2009, 2010 Didier Verna.
6
7 @c Author:        Didier Verna <didier@xemacs.org>
8 @c Maintainer:    Didier Verna <didier@xemacs.org>
9 @c Created:       Sun Apr 21 21:34:06 2002
10 @c Last Revision: Wed Feb 10 18:00:51 2010
11
12 @c This file is part of Patcher.
13
14 @c Patcher is free software; you can redistribute it and/or modify
15 @c it under the terms of the GNU General Public License version 2,
16 @c as published by the Free Software Foundation.
17
18 @c Patcher is distributed in the hope that it will be useful,
19 @c but WITHOUT ANY WARRANTY; without even the implied warranty of
20 @c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21 @c GNU General Public License for more details.
22
23 @c You should have received a copy of the GNU General Public License
24 @c along with this program; if not, write to the Free Software
25 @c Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26
27
28 @c Commentary:
29
30 @c Contents management by FCM version 0.1.
31
32
33 @c %** start of header
34 @setfilename patcher.info
35 @settitle Patcher
36 @setchapternewpage odd
37 @setcontentsaftertitlepage
38 @dircategory Emacs
39 @direntry
40 * Patcher: (patcher). Automatic archive-based projects maintenance.
41 @end direntry
42 @c %** end of header
43
44
45 @c ====================================================================
46 @c Definitions
47 @c ====================================================================
48 @set VERSION 3.11
49 @set COPYRIGHT_DATE 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010
50
51
52 @c ====================================================================
53 @c Copyright
54 @c ====================================================================
55 @ifinfo
56 This file contains the documentation for Patcher version
57 @value{VERSION}, an XEmacs package for automating the maintenance of
58 archive-based projects.
59
60 Copyright @copyright{} @value{COPYRIGHT_DATE} Didier Verna.
61
62 Permission is granted to make and distribute verbatim copies of this
63 manual provided the copyright notice and this permission notice are
64 preserved on all copies.
65
66 @ignore
67 Permission is granted to process this file through TeX and print the
68 results, provided the printed document carries a copying permission
69 notice identical to this one except for the removal of this paragraph
70 (this paragraph not being relevant to the printed manual).
71
72 @end ignore
73 Permission is granted to copy and distribute modified versions of this
74 manual under the conditions for verbatim copying, provided also that the
75 sections entitled ``Copying'' and ``GNU General Public License'' are
76 included exactly as in the original, and provided that the entire
77 resulting derived work is distributed under the terms of a permission
78 notice identical to this one.
79
80 Permission is granted to copy and distribute translations of this manual
81 into another language, under the above conditions for modified versions,
82 except that this permission notice may be stated in a translation
83 approved by the Free Software Foundation.
84 @end ifinfo
85
86
87
88 @c ====================================================================
89 @c Title Page
90 @c ====================================================================
91 @titlepage
92 @title Patcher
93 @subtitle Automatic archive-based projects maintenance from within XEmacs
94 @subtitle Version @value{VERSION}
95 @author Didier Verna <@email{didier@@xemacs.org}>
96 @page
97 @vskip 0pt plus 1filll
98 Copyright @copyright{} @value{COPYRIGHT_DATE} Didier Verna.
99
100
101 Permission is granted to make and distribute verbatim copies of this
102 manual provided the copyright notice and this permission notice are
103 preserved on all copies.
104
105 Permission is granted to copy and distribute modified versions of this
106 manual under the conditions for verbatim copying, provided also that the
107 sections entitled ``Copying'' and ``GNU General Public License'' are
108 included exactly as in the original, and provided that the entire
109 resulting derived work is distributed under the terms of a permission
110 notice identical to this one.
111
112 Permission is granted to copy and distribute translations of this manual
113 into another language, under the above conditions for modified versions,
114 except that this permission notice may be stated in a translation
115 approved by the Free Software Foundation.
116 @end titlepage
117
118
119
120 @c ====================================================================
121 @c Master menu
122 @c ====================================================================
123 @ifnottex
124 @node Top, Copying, , (dir)
125 @comment  node-name,  next,  previous,  up
126 @top Patcher
127
128 Patcher is an XEmacs package designed to automate and ease the
129 maintenance of archive-based projects. It provides assistance in
130 building, reporting and committing patches, as well as in handling the
131 corresponding ChangeLog entries, for example by creating skeletons.
132
133 This info file documents Patcher version @value{VERSION}.
134
135 @menu
136 * Copying::          The GNU General Public License
137 * Introduction::     What Patcher is all about
138 * Installation::     How to get and install Patcher
139 * Quick Start::      For the brave and the impatient
140 * User Manual::      A step-by-step guide to using Patcher
141 * XEmacs Devel::     How to setup Patcher for XEmacs Development
142 * Variables Index::
143 * Functions Index::
144 * Keystrokes Index::
145 @end menu
146
147 Patcher is developed by Didier Verna @email{didier@@xemacs.org}.
148
149 @end ifnottex
150
151
152
153 @c ====================================================================
154 @c Copying
155 @c ====================================================================
156 @node Copying, Introduction, Top, Top
157 @comment  node-name,  next,  previous,  up
158 @unnumbered Copying
159
160 Patcher is free software; you can redistribute it and/or modify it under
161 the terms of the GNU General Public License version 2,
162 as published by the Software Foundation.
163
164 Patcher is distributed in the hope that it will be useful, but WITHOUT
165 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
166 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
167 more details.
168
169 You should have received a copy of the GNU General Public License
170 along with this program; if not, write to the Free Software
171 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
172
173
174
175 @c ====================================================================
176 @c Introduction
177 @c ====================================================================
178 @node Introduction, Installation, Copying, Top
179 @comment  node-name,  next,  previous,  up
180 @chapter Introduction
181
182 When a project becomes important in size, or when the development is
183 performed cooperatively by several people across the Internet, it is a
184 common practice to help maintaining it by using a development control
185 system. Such tools (Git, Mercurial, Subversion, Darcs, CVS, PRCS to name
186 a few) usually work by maintaining a centralized or distributed project
187 archive (also called a repository) that keeps track of the history of
188 the changes, lets you develop different ``branches'' at the same time
189 and perform operations like merges between these different project
190 branches.
191
192 In such ``archive-based'' maintenance models, making the project evolve
193 usually involves repeatedly the same few steps, some of which can be
194 tedious: you work on your local copy of the project; once you're
195 satisfied with your changes, you create a patch by diffing your local
196 copy against the project's archive; then (or progressively), you
197 construct the ChangeLog entries. Finally, you propose your changes by
198 sending a mail to the developers list with your patch and the ChangeLog
199 entries included, hoping that your proposition will be accepted. If
200 you're one of the maintainers, you will still probably send the message
201 to the list, simply announcing the modification, and immediately commit
202 the patch with an informative log message.
203
204 Patcher is an XEmacs package designed to automate this process. Patcher
205 can't work on the project for you. However, as soon as you give it some
206 basic knowledge on the project structure and repository, it can
207 automatically build a patch by comparing your local copy with the
208 repository, create ChangeLog entries, prepare a mail announcing the
209 changes, and even commit the patch for you with a informative log
210 message. All of this is done in just a few keystrokes. Additionally,
211 Patcher can perform some sanity checks, like verifying that your local
212 copy is up-to-date, that you did not forget some ChangeLog entries, that
213 the commit operation went well and so on.
214
215 If you're brave and impatient, and want to start using the basics of
216 Patcher as soon as possible, see @ref{Quick Start}. It is recommended to
217 read it anyway, since it gives an overview of how Patcher works. If you
218 know the basics and want a more detailed guide, see @ref{User Manual}.
219
220 Enjoy using Patcher !
221
222
223
224 @c ====================================================================
225 @c Installation
226 @c ====================================================================
227 @node Installation, Quick Start, Introduction, Top
228 @comment  node-name,  next,  previous,  up
229 @chapter Installation
230
231 @menu
232 * Distribution::                How to get Patcher
233 * Requirements::                What you need to get Patcher running
234 * Insinuation::                 How to plug Patcher into other libraries
235 @end menu
236
237
238 @c Distribution =======================================================
239 @node Distribution, Requirements, , Installation
240 @comment  node-name,  next,  previous,  up
241 @section Distribution
242
243 Patcher is available either as a standalone package, or as part of the
244 standard @file{xemacs-devel} XEmacs package.
245
246 You can get @file{xemacs-devel} in three different ways:
247 @itemize @bullet
248 @item
249 You can install @file{xemacs-devel} from within XEmacs via the package
250 user interface (accessible from the @samp{Tools} menu or via @kbd{M-x
251 list-packages}).
252
253 @item
254 You can also download the @file{xemacs-devel-<version>-pkg.tar.gz}
255 tarball from @uref{ftp://ftp.xemacs.org/pub/xemacs/packages/}, and
256 unpack it where you put the other packages.
257
258 @item
259 @file{xemacs-devel} sources are available from the XEmacs CVS
260 repository. The module name is @samp{xemacs-devel}. See
261 @uref{http://www.xemacs.org/Develop/cvsaccess.html} for more information
262 about the XEmacs CVS repository.
263 @end itemize
264
265
266 I also provide Patcher as a standalone package. This is mainly for my
267 personal usage (when developing and debugging new versions) but you
268 might want to use it if you're not interested in the rest of
269 @file{xemacs-devel}. The standalone version of Patcher can be found at
270 @uref{http://www.lrde.epita.fr/~didier/software/xemacs.php}.
271 You will also find different inlined versions of this documentation at
272 that place. For installation instructions, please read the
273 @file{INSTALL} file.
274
275
276 @c Requirements =======================================================
277 @node Requirements, Insinuation, Distribution, Installation
278 @comment  node-name,  next,  previous,  up
279 @section Requirements
280
281 Patcher currently works only with XEmacs 21.4 or later. I'm not sure it
282 works with earlier versions of XEmacs, but I'm sure it does @strong{not}
283 work with GNU Emacs (see below).
284
285 Patcher might also have some other requirements, depending on how you use
286 it:
287
288 @itemize @bullet
289 @item
290 If you let Patcher create ChangeLogs for you (@pxref{ChangeLogs
291 Handling}), you will need the @file{add-log} library from the
292 @file{xemacs-base} package, version 2.21 or later, installed on your
293 system. That's actually the may reason for Patcher not being able to run
294 in GNU Emacs, though I have not tried to port it yet.
295
296 @item
297 If you want to send mails from Patcher (@pxref{Mail Methods}), you will
298 need a mail user agent. Patcher currently supports @file{sendmail},
299 @file{message} and @file{Gnus} natively and through the
300 @file{compose-mail} interface. Other MUA might be partly supported when
301 used with @code{compose-mail}. Patcher will probably suffer from non
302 critical deficiencies in that case however (it will issue warnings).
303 @end itemize
304
305
306 @c Insinuation ========================================================
307 @node Insinuation, , Requirements, Installation
308 @comment  node-name,  next,  previous,  up
309 @section Insinuation
310
311 With a proper installation of Patcher (either way), you don't need any
312 special trickery in your @file{.emacs} file because all entry points to
313 the library should be autoloaded.
314
315 However, Patcher has the ability to hook into external libraries, but
316 won't do so unless requested. Currently, Patcher has hooks for Gnus
317 only. If you're using Gnus as your MUA, you might want to add the
318 following line to your @file{gnusrc} file:
319
320 @example
321 (patcher-insinuate-gnus)
322 @end example
323
324 This will add some facilities described along the text.
325
326
327
328 @c ====================================================================
329 @c Quick Start
330 @c ====================================================================
331 @node Quick Start, User Manual, Installation, Top
332 @comment  node-name,  next,  previous,  up
333 @chapter Quick Start
334
335 In this chapter, we quickly setup the basic Patcher configuration for
336 hacking on XEmacs. Adapt the example as you wish. Let's make some
337 assumptions first:
338
339 @itemize @bullet
340 @item
341 You own a computer.
342
343 @item
344 You have the @file{add-log} library from the @file{xemacs-base} package,
345 version 1.48 or later, installed on your system.
346
347 @item
348 You're using XEmacs from the CVS repository.
349
350 @item
351 Your local copy of the repository is located in
352 @file{/usr/local/src/XEmacs-21.5}.
353
354 @item
355 Your local copy of the repository is up-to-date, but you've done some
356 hacking in the sources that you'd like to submit.
357
358 @item
359 Since you're lazy, you didn't write the ChangeLog entries yet.
360 @end itemize
361
362
363 @menu
364 * Setting up Patcher::     Making Patcher aware of your project
365 * Calling Patcher::        Preparing a patch and a message
366 * Filling the ChangeLogs:: Patcher only creates skeletons
367 * Filling the Message::    You should insert the ChangeLog entries
368 * Committing the Patch::   Applying your modifications to the archive
369 * Sending the Message::    Telling people about your modifications
370 @end menu
371
372
373 @c The Project Descriptor =============================================
374 @node Setting up Patcher, Calling Patcher, Quick Start, Quick Start
375 @comment  node-name,  next,  previous,  up
376 @section Setting up Patcher
377
378 The first thing to do is to make patcher aware of your ``XEmacs''
379 project. Put this in your @file{.emacs} file:
380
381 @lisp
382 (setq patcher-projects
383       '(("XEmacs" "/usr/local/src/XEmacs-21.5"
384          :to-address "xemacs-patches@@xemacs.org")
385         ))
386 @end lisp
387
388 @vindex patcher-projects
389 As you can imagine, @code{patcher-projects} is a user option in which
390 you store information about the projects you want to manage with
391 Patcher. It is actually a list of what's called @dfn{project
392 descriptors}. Here's the meaning of the only project descriptor we have
393 in the example above: we have a project named ``XEmacs'', located in
394 @file{/usr/local/src/XEmacs-21.5} and for which emails should be sent to
395 @email{xemacs-patches@@xemacs.org}.
396
397 Note the particular syntax for specifying the mailing address. This is
398 what's called a @dfn{project option}. Contrary to the project's name and
399 directory, which are mandatory and always appear as the first and second
400 elements of a project descriptor, project options are optional and can
401 appear in any order.
402
403
404 @c Calling Patcher ====================================================
405 @node Calling Patcher, Filling the ChangeLogs, Setting up Patcher, Quick Start
406 @comment  node-name,  next,  previous,  up
407 @section Calling Patcher
408
409 Now you want to build a patch with your changes, and prepare a message
410 to submit them. The way Patcher works is currently to setup the message
411 first, and then to control all subsequent operations from there. In
412 other words, to create a patch, you actually ask Patcher to prepare a
413 mail. Type this:
414
415 @lisp
416 M-x patcher-mail
417 @end lisp
418
419 @findex patcher-mail
420 First, you're prompted (with completion) for a project name (the first
421 element of each project descriptor, remember ?). We currently only have
422 an ``XEmacs'' project, so hitting @kbd{TAB} will directly fill the
423 minibuffer in with this only choice. Then, you're prompted for a subject
424 line that will be used in the mail. Say something sensible.
425
426 Three operations are now executed in turn:
427
428 @enumerate
429 @item
430 @vindex patcher-default-to-address
431 @vindex :to-address
432 Patcher prepares a mail buffer. The message will be sent to the address
433 you specified with the @code{:to-address} project option, and the
434 subject line now reads ``[PATCH] something sensible''.
435
436 @item
437 Patcher now builds the patch. The command used to do this is @samp{cvs
438 -q diff -u} (this is also a project option). Upon successful completion
439 of this command (we assume that's indeed the case), the patch is
440 inserted into the mail buffer. Some information about the patch is
441 provided just above it (the command used, the files affected and so on).
442
443 @item
444 Finally, Patcher generates ChangeLog skeletons from what it understands
445 of the patch. This involves visiting the appropriate ChangeLog files,
446 and creating initial entries.
447 @end enumerate
448
449
450 @c Filling the ChangeLogs =============================================
451 @node Filling the ChangeLogs, Filling the Message, Calling Patcher, Quick Start
452 @comment  node-name,  next,  previous,  up
453 @section Filling the ChangeLogs
454
455 Patcher has just created initial ChangeLog entries for you. You must now
456 browse through the ChangeLog file(s) and fill the entries as you see
457 fit. Once you're done, you can very well save the ChangeLog buffers.
458 However, don't kill them ! Don't even think about it. Patcher still
459 needs them. Now, please return to the mail buffer.
460
461
462 @c Inserting the ChangeLog entries ====================================
463 @node Filling the Message, Committing the Patch, Filling the ChangeLogs, Quick Start
464 @comment  node-name,  next,  previous,  up
465 @section Filling the message
466
467 Now that you're satisfied with your ChangeLog entries and you've
468 returned to the mail buffer, you want to write some explanation text in
469 the message. I'll let you do that. You also want to insert the ChangeLog
470 entries corresponding to your patch, since they are usually much more
471 readable than the patch itself.
472
473 @findex patcher-insert-change-logs
474 @kindex C-c C-p i
475 Inserting your ChangeLog entries in the mail buffer is as simple as
476 typing @samp{C-c C-p i}. This actually calls the function
477 @code{patcher-insert-change-logs}, which places them just above the
478 patch, with a short information line (per ChangeLog file) on top.
479
480
481 @c Committing the Patch ===============================================
482 @node Committing the Patch, Sending the Message, Filling the Message, Quick Start
483 @comment  node-name,  next,  previous,  up
484 @section Committing the Patch
485
486 If you have commit access to your project, you should read this.
487 Otherwise, you may directly see @ref{Sending the Message}.
488
489 Committing your changes involves three steps: preparing the commit
490 command, preparing the commit log message, and actually committing the
491 changes. Although Patcher can do all of this in one shot, it lets you
492 control each step by default.
493
494 @findex patcher-commit-change
495 @kindex C-c C-p c
496 In order to start the commit process, simply type @samp{C-c C-p c}. This
497 calls the function @code{patcher-commit-change}. Congratulations. You've
498 just been transported to a new buffer, the @code{*Patcher Log Message*}
499 buffer. This buffer lets you edit the log message that will accompany
500 your commit. Note that the message is initialized with the subject line
501 of your mail. This is also a project option.
502
503 @findex patcher-logmsg-commit
504 @kindex C-c C-c
505 Once you're satisfied with the log message, type @samp{C-c C-c}. This
506 calls the function @code{patcher-logmsg-commit}, which computes the
507 commit command to use. The command is displayed in a special buffer, the
508 @code{*Patcher Commit Command*} buffer. The default commit command is
509 @samp{cvs commit}, which of course is also a project option. Note that
510 Patcher stores the log message in a temporary file and uses the
511 @option{-F} @kbd{cvs commit} option. Finally, note that Patcher has
512 automatically appended the affected ChangeLog files to the commit
513 command.
514
515 At this point, you have the opportunity to abort the commit operation.
516 Otherwise, answer positively and the commit will be executed. If you had
517 not previously saved the ChangeLog files, Patcher will do it for you
518 just before committing.
519
520
521 @c Sending the Message ================================================
522 @node Sending the Message, , Committing the Patch, Quick Start
523 @comment  node-name,  next,  previous,  up
524 @section Sending the Message
525
526 Sending the message has actually nothing to do with Patcher. It depends
527 on the method you use for sending mails, but will usually be done via a
528 @samp{C-c C-c} command of some sort. On thing to note however: if you've
529 committed your changes via Patcher, the message has been slightly
530 modified: the subject line now reads ``[COMMIT] something sensible''
531 instead of ``[PATCH] @dots{}'', and a short commit notice has been
532 inserted just at the beginning of the message's body.
533
534 That's it. That was easy. Congratulations on your first shot at Patcher,
535 anyway ! Of course, Patcher is much more powerful and customizable than
536 what has been described in this chapter. For a complete documentation on
537 how to use and customize Patcher, please refer to @ref{User Manual}.
538
539
540
541 @c ====================================================================
542 @c User Manual
543 @c ====================================================================
544 @node User Manual, XEmacs Devel, Quick Start, Top
545 @comment  node-name,  next,  previous,  up
546 @chapter User Manual
547
548 This chapter provides a step-by-step guide to using Patcher. Everything
549 there is to know about Patcher is here, though the features are
550 introduced progressively.
551
552 All user options that are going to be presented in this manual can be
553 found in the @code{patcher} customization group, or a subgroup of it.
554
555 @menu
556 * Project Descriptors::  The project specification mechanism
557 * Mail Preparation::     Customizing Patcher messages
558 * Patch Generation::     Specifying how a patch is to be constructed
559 * ChangeLogs Handling::  How Patcher behaves with respect to ChangeLogs
560 * Project Check In::     Committing your changes from Patcher
561 * Mail Sending::         Sending the message and cleaning up the place
562 * More On Commands::     Error handling and other generalities
563 * More On Subprojects::  Defining permanent subprojects
564 @end menu
565
566 @ignore
567 The manual is currently organized in a rather sequential way: one
568 chapter for source patches, one for ChangeLogs. This might not be the
569 best way to do it. Another way is to split the information in terms of
570 patch/ChangeLog creation, and Patch/ChangeLog appearance in messages.
571 @end ignore
572
573 @c Project Descriptors ================================================
574 @node Project Descriptors, Mail Preparation, User Manual, User Manual
575 @comment  node-name,  next,  previous,  up
576 @section Project Descriptors
577
578 @vindex patcher-projects
579 Projects specifications are stored in @code{patcher-projects}. This user
580 option is actually a list of @dfn{project descriptors}. Each project
581 descriptor has the following form: @samp{(@var{NAME} @var{DIR}
582 @var{:OPTION} @var{VALUE} @dots{})}
583
584 @vindex patcher-default-to-address
585 @vindex :to-address
586 @var{NAME} is a string naming your project, @var{DIR} is a string
587 specifying the directory in which it resides. The remainder of a project
588 descriptor is a sequence of zero or more option/value pairs, that we
589 call @dfn{project options}. All option names start with a colon. The
590 type of a value depends on the corresponding option. For example, there
591 is a project option named @code{:to-address}, whose value should be a
592 string giving the email address to which you want to send Patcher
593 messages.
594
595 When Patcher needs the value for a particular project option, it looks
596 for it directly in the project descriptor, but also in other places.
597 This process is described below.
598
599 @menu
600 * Themes::                 Collections of options
601 * Project inheritance::    Getting options from other projects
602 * Fallbacks::              Default values for project options
603 * Retrieval::              The process of getting an option's value
604 * Inheritance or theme ?:: The proper way to factor out option values
605 @end menu
606
607 @node Themes, Project inheritance, , Project Descriptors
608 @comment  node-name,  next,  previous,  up
609 @subsection Themes
610
611 If you have several projects sharing the same option set, you might want
612 to setup a theme. Themes are named collections of project options.
613
614 @vindex patcher-themes
615 Themes are stored in the @code{patcher-themes} user option. This option
616 is a list of themes. Each theme has the following form:
617 @samp{(@var{NAME} @var{:OPTION} @var{VALUE} @dots{})}.
618
619 @var{NAME} is the theme's name (a symbol). The remainder of the list is
620 a sequence of zero or more option/value pairs, just like in project
621 descriptors.
622
623 @vindex patcher-default-themes
624 @vindex :themes
625 In order to use a theme in a given project, a @code{:themes} project
626 option is provided. It is a list of theme names (symbols). Use this
627 option in your project descriptor, and the project will implicitly
628 inherit all options from the corresponding theme.
629
630 One important note: as @code{:themes} is a project option, it can appear
631 in a theme. In other words, themes can inherit from other themes. When
632 Patcher tries to retrieve an option, the themes tree is traversed in
633 depth first.
634
635 @vindex patcher-max-theme-depth
636 Because themes can contain themes, a bogus setting might lead to an
637 infinite loop (a cycle in a theme graph). To prevent this, the
638 @code{patcher-max-theme-depth} user option is provided. It represents
639 the expected maximum theme nesting level, and defaults to 8.
640
641 @vindex patcher-built-in-themes
642 Patcher comes with a set of built-in themes for several revision control
643 systems. These are Git, Mercurial (Hg), Darcs, Subversion (Svn) and CVS
644 and PRCS. Look at the value of @code{patcher-built-in-themes} to see
645 what's in them. Each of these themes have a @code{-ws} counterpart which
646 eliminates white-space differences in diff outputs. This comes in handy
647 if you perform some kind of automatic white-space cleanup in the files
648 you edit, especially when you let Patcher generate the ChangeLog
649 entries.
650
651 While you can't modify the value of @code{patcher-built-in-themes},
652 you're free to do whatever you want in @code{patcher-themes},
653 including creating a theme with the same name as a built-in one. This
654 new theme will take precedence over the other. Having this built-in
655 variable (a constant, actually) lets me modify its value from release
656 to release without risking to smash your own adjustments.
657
658 @node Project inheritance, Fallbacks, Themes, Project Descriptors
659 @comment  node-name,  next,  previous,  up
660 @subsection Project inheritance
661
662 When two projects are very similar, you might want to use the project
663 inheritance mechanism described below.
664
665 @vindex :inheritance
666 There is a special project option called @code{:inheritance}. This
667 option must be a list of project names (strings). The inheritance of a
668 project defines a list of projects from which to inherit options.
669
670 One important note: inherited projects might have their own
671 @code{:inheritance} option set to other projects in turn. In other
672 words, the project inheritance can be more than one level deep. When
673 Patcher tries to retrieve an option, the inheritance tree is traversed
674 in depth first.
675
676 @vindex patcher-max-inheritance-depth
677 Because inherited projects can inherit from projects, a bogus setting
678 might lead to an infinite loop (a cycle in a project graph). To prevent
679 this, the @code{patcher-max-inheritance-depth} user option is provided.
680 It represents the expected maximum project inheritance level, and
681 defaults to 8.
682
683 The @code{:inheritance} project option is somewhat special in the sense
684 that it can't appear in a theme. We will encounter other exceptions
685 later in this manual.
686
687
688 @node Fallbacks, Retrieval, Project inheritance, Project Descriptors
689 @comment  node-name,  next,  previous,  up
690 @subsection Fallbacks
691
692 @vindex patcher-default-to-address
693 @vindex :to-address
694 For each existing project option, Patcher also has a @dfn{fallback} user
695 option with a default value that would be shared among all (or some of)
696 your projects. The name of the fallback is obtained by replacing the
697 colon in the project option's name with the prefix
698 @code{patcher-default-}. For example, the fallback corresponding to the
699 @code{:to-address} project option is named
700 @code{patcher-default-to-address}.
701
702 The @code{:inheritance} project option is also special in the sense that
703 it doesn't have a corresponding fallback. We will encounter other
704 exceptions later in this manual.
705
706 In the remainder of this manual, we will rarely mention the fallbacks
707 again. When we introduce a new project option, just remember that it
708 always has a corresponding fallback (well, not always, as you just
709 discovered).
710
711
712 @node Retrieval, Inheritance or theme ?, Fallbacks, Project Descriptors
713 @comment  node-name,  next,  previous,  up
714 @subsection Retrieval
715
716 When Patcher needs the value of a particular project option, it looks
717 for it in the following manner:
718
719 @itemize @bullet
720 @item
721 First, it looks directly in the project descriptor to see if the option
722 is given.
723
724 @item
725 @vindex patcher-default-themes
726 @vindex :themes
727 @vindex patcher-themes
728 If that fails, it next tries the given themes, if any. This involves
729 recursively traversing the project's themes tree. Options successfully
730 retrieved in themes are said to be @dfn{themed}.
731
732 @item
733 @vindex :inheritance
734 If that still fails, it then tries the inherited projects, if any. This
735 involves recursively traversing the project's inheritance tree. Options
736 successfully retrieved in inherited projects are said to be
737 @dfn{inherited}. Note that in turn, such options could have been
738 actually themed in the inherited project.
739
740 @item
741 If that fails again, it finally falls back to the value given in the
742 corresponding fallback (if it exists). In such a case, the option is
743 said to be @dfn{fallbacked}.
744 @end itemize
745
746 Note that a value of @code{nil} for a project option @strong{is an
747 actual value}. It is not equivalent to an option being unset. As a
748 consequence, if Patcher finds a project option with a value of
749 @code{nil} somewhere, it will use it and stop the search, even if a non
750 nil value could be retrieved later from a theme, an inherited project or
751 a fallback. This provides you with a way to annihilate themed,
752 inherited or fallbacked options.
753
754
755 @node Inheritance or theme ?, , Retrieval, Project Descriptors
756 @comment  node-name,  next,  previous,  up
757 @subsection Inheritance or theme ?
758
759 At that point, you might be wondering why the themes and inheritance
760 concepts were both designed, since they actually perform very similar
761 tasks. Good question. Here is a good answer.
762
763 Projects might share options for different reasons. For example, my
764 ``XEmacs'' (source) and ``XEmacs Packages'' projects share many options
765 (@code{To:} address, @code{From:} address, diff and commit commands and
766 so on) because they both relate to XEmacs. On the other hand I have
767 personal but totally unrelated projects that share the same commands
768 because they are all handled through a common system: Darcs.
769
770 In other words, you should rather use the inheritance mechanism when
771 projects relate to each other, and the theme mechanism for settings that
772 are orthogonal the projects they apply to.
773
774
775
776 @c Mail Preparation ===================================================
777 @node Mail Preparation, Patch Generation, Project Descriptors, User Manual
778 @comment  node-name,  next,  previous,  up
779 @section Mail Preparation
780
781 Patcher currently uses the mail buffers as ``master'' buffers for
782 controlling all operations: building a patch, creating the ChangeLog
783 entries, committing@dots{} all is done from the mail buffer. Note
784 however that you don't need to actually send mails to use Patcher
785 (@pxref{Fake Mail Method}).
786
787 To use Patcher on a certain project, you start by preparing a (possibly
788 fake) mail. There are several ways to do so: you could start a brand new
789 message, ``adapt'' a message already in preparation to Patcher, or even
790 compose some sort of a Patcher reply to another message.
791
792 @defun patcher-mail
793 Start composing a brand new Patcher message. This function interactively
794 prompts you for the name of the project and for a (mail) subject line.
795 @end defun
796
797 @defun patcher-mail-adapt
798 Assuming that you are already editing a message (with your usual MUA),
799 this function ``adapts'' it to Patcher by prompting you for the name of
800 a project. Note that this function does @emph{not} prompt you for a
801 subject.
802 @end defun
803
804 If you're using Gnus to read mail and have properly insinuated it
805 (@pxref{Insinuation}), Patcher offers different Gnus-like ways to answer
806 mails and adapt them to Patcher. All the functions below are available
807 from both the Gnus Summary and the Article buffer.
808
809 @defun patcher-gnus-summary-followup
810 @kindex C-c C-p f
811 Compose a followup to the article, and adapt it to Patcher. This
812 function is bound to @kbd{C-c C-p f}.
813 @end defun
814
815 @defun patcher-gnus-summary-followup-with-original
816 @kindex C-c C-p F
817 Idem, but also cite the original article. This function is bound to
818 @kbd{C-c C-p F}.
819 @end defun
820
821 @defun patcher-gnus-summary-reply
822 @kindex C-c C-p r
823 Like @code{patcher-gnus-summary-followup}, but compose a reply. This
824 function is bound to @kbd{C-c C-p r}.
825 @end defun
826
827 @defun patcher-gnus-summary-reply-with-original
828 @kindex C-c C-p R
829 Idem, but also cite the original article. This function is bound to
830 @kbd{C-c C-p R}.
831 @end defun
832
833
834 In any case, Patcher starts working on the project (by first creating
835 the patch) after the message is prepared. Because of this, we'll start
836 by reviewing the mail-related customizations you might want to setup.
837
838 @menu
839 * Mail Methods::          Using a particular mailer
840 * Message Customization:: Specifying initial contents for messages
841 @end menu
842
843 @node Mail Methods, Message Customization, Mail Preparation, Mail Preparation
844 @comment  node-name,  next,  previous,  up
845 @subsection Mail Methods
846
847 @vindex patcher-default-mail-method
848 @vindex :mail-method
849 Since there are different mail packages working in XEmacs, Patcher
850 supports different methods for preparing messages. You can specify the
851 method you prefer in the @code{:mail-method} project option. The value
852 must be a symbol.
853
854 @menu
855 * Standard Mail Methods:: Patcher supports standard mail packages
856 * Fake Mail Method::      Patcher supports not sending mails
857 * Other Mail Methods::    Patcher supports everything
858 @end menu
859
860 @node Standard Mail Methods, Fake Mail Method, Mail Methods, Mail Methods
861 @comment  node-name,  next,  previous,  up
862 @subsubsection Standard Mail Methods
863
864 Patcher currently supports @file{sendmail}, @file{message} and
865 @file{Gnus} natively and through the @file{compose-mail} interface.
866 Other MUA might be partly supported when used with @code{compose-mail}.
867 Patcher will probably suffer from non critical deficiencies in that case
868 however (it will issue warnings).
869
870 @table @code
871 @item compose-mail
872 @findex compose-mail
873 @findex patcher-mail-compose-mail
874 @vindex mail-user-agent
875 This is the default. It is implemented via the function
876 @code{patcher-mail-compose-mail} which calls @code{compose-mail} to
877 prepare the message. If you are not familiar with @samp{compose-mail},
878 you might also want to throw an eye to the user option
879 @code{mail-user-agent}. If your project does not specify an address to
880 send the message to (@pxref{Message Customization}), it is prompted for.
881
882 @item sendmail
883 @findex mail
884 @findex patcher-mail-sendmail
885 A direct interface to the @code{mail} function from the @code{sendmail}
886 package. It is implemented via the function
887 @code{patcher-mail-sendmail}. If your project does not specify an
888 address to send the message to (@pxref{Message Customization}), it is
889 prompted for.
890
891 @item message
892 @findex message-mail
893 @findex patcher-mail-message
894 A direct interface to the @code{message-mail} function from the
895 @code{message} library (it is part of @code{Gnus}). It is implemented
896 via the function @code{patcher-mail-message}. If your project does not
897 specify an address to send the message to (@pxref{Message
898 Customization}), it is prompted for.
899
900 @item gnus
901 @findex gnus-post-news
902 @findex patcher-mail-gnus
903 A direct interface to the @code{gnus-post-news} function from the
904 @code{Gnus} package (it can also send mails@dots{}). It is implemented
905 via the function @code{patcher-mail-gnus}. This mail method is
906 interesting when you maintain a special mail group for messages that you
907 send with Patcher, most probably because they are sent to some
908 mailing-list, such as @email{xemacs-patches@@xemacs.org}.
909
910 @vindex patcher-default-gnus-group
911 @vindex :gnus-group
912 This method uses a Gnus group name and acts as if you had type @samp{C-u
913 a} on that group in the @code{*Group*} buffer, hence honoring the group
914 parameters and posting-styles. If your project does not specify a Gnus
915 group name (@pxref{Message Customization}), it is prompted for.
916 @end table
917
918 This last mail method is special in the sense that it requires a running
919 Gnus session to work. If that's needed, Patcher can start Gnus for you
920 in several ways, according to the following user options:
921
922 @table @code
923 @item patcher-mail-run-gnus
924 @vindex patcher-mail-run-gnus
925 If @code{nil}, Patcher will never start Gnus and abort the operation
926 instead. If @code{t}, Patcher will always start Gnus when needed. If
927 @code{'prompt}, Patcher will ask you what (you want) to do. This is the
928 default behavior.
929
930 @item patcher-mail-run-gnus-other-frame
931 @vindex patcher-mail-run-gnus-other-frame
932 Used when Patcher has to start Gnus by itself. If @code{nil}, continue
933 using the current frame. If @code{t}, start Gnus in another frame (this
934 is the default). If @code{'follow}, start Gnus in another frame, and use
935 this new frame to prepare the Patcher mail.
936 @end table
937
938 @node Fake Mail Method, Other Mail Methods, Standard Mail Methods, Mail Methods
939 @comment  node-name,  next,  previous,  up
940 @subsubsection Fake Mail Method
941
942 @findex patcher-mail-fake
943 At that point, you might be wondering why the mail method is a project
944 option and not simply a user option, since you probably only use one
945 mail agent at all. Right. But you might one day work on projects for
946 which you don't need to send messages at all. This could happen if you
947 start using Patcher on a project of your own for instance. For that
948 reason, there is a @code{fake} mail method available. It is implemented
949 via the @code{patcher-mail-fake} function and calls no particular mail
950 user agent. Once you type @samp{C-c C-c} to virtually send the fake
951 message, it only performs some cleanup.
952
953 All right. But did we really need this fake method ? I mean, one could
954 use the usual mail method, and simply not send the message in the end.
955 Huh, yeah, ok@dots{} Actually, it is very probable that in a future
956 release of Patcher, the mail buffer won't be the master buffer anymore,
957 and mail sending will be just another optional step in the process. In
958 that case, the mail method is likely to move away from project option
959 to standard user option.
960
961 @node Other Mail Methods, , Fake Mail Method, Mail Methods
962 @comment  node-name,  next,  previous,  up
963 @subsubsection Other Mail Methods
964
965 @vindex patcher-default-mail-method
966 @vindex :mail-method
967 If you're not satisfied with the provided mail methods (want a @code{vm}
968 one ?), you can provide your own, more or less. Here's what to do: set
969 your @code{:mail-method} project option to, say, @code{foo}, and write
970 your own function which must be named @code{patcher-mail-foo}.
971
972 This function must take two arguments (a project descriptor and a string
973 containing the subject of the message), and prepare a mail buffer. If
974 you want to do this, you should see how it's done for the built-in
975 methods.
976
977 Note that the mail adaptation facility won't be available for your
978 custom method. For that, I would have to hack the internals of Patcher.
979
980
981 @node Message Customization, , Mail Methods, Mail Preparation
982 @comment  node-name,  next,  previous,  up
983 @subsection Message Customization
984
985 When preparing a message, Patcher can fill some parts of it for you.
986 Here's a list of mail-related project options.
987
988 @table @code
989 @item :user-name
990 @vindex patcher-default-user-name
991 @vindex :user-name
992 The name (your name) to use when composing the message. It will affect
993 the @code{From:} header. This option is used by all mail methods but
994 @code{fake}. If not given, @code{user-full-name} is used.
995
996 @item :user-mail
997 @vindex patcher-default-user-mail
998 @vindex :user-mail
999 The mail (your mail) address to use when composing the message. It will
1000 affect the @code{From:} header. This option is used by all mail methods but
1001 @code{fake}. If not given, @code{user-mail-address} is used.
1002
1003 @item :to-address
1004 @vindex patcher-default-to-address
1005 @vindex :to-address
1006 The address to send messages to (a string). This option is used by all
1007 mail methods but @code{gnus} and @code{fake}. If not given, it is
1008 prompted for when calling @code{patcher-mail}.
1009
1010 @item :gnus-group
1011 @vindex patcher-default-gnus-group
1012 @vindex :gnus-group
1013 The Gnus group name to use for posting messages (a string). This option
1014 is used only by the @code{gnus} mail method. If not given, it is
1015 prompted for when calling @code{patcher-mail}.
1016
1017 Note that if you configured your name and mail in Gnus, for instance
1018 through posting styles, these configurations take precedence over the
1019 corresponding Patcher options.
1020
1021 @item :subject-prefix
1022 @vindex patcher-default-subject-prefix
1023 @vindex :subject-prefix
1024 A prefix for the subject line of messages. It can be @code{nil} or a
1025 string. By default, ``[PATCH]'' is used. This part of subjects is never
1026 prompted for. A @samp{%n} occurring in this string will be replaced with
1027 the project name. Also, a space is inserted between the prefix and the
1028 remainder of the subject, when appropriate.
1029
1030 @item :subject
1031 @vindex patcher-default-subject
1032 @vindex :subject
1033 A default value for prompted subjects (a string). A @samp{%n} occurring
1034 in this string will be replaced with the project's name
1035 (@pxref{Subproject Naming}). Please note that this is used @strong{only}
1036 to provide a default value for prompted subjects. Subjects are
1037 @strong{always} prompted for.
1038
1039 @item :mail-prologue
1040 A prologue to insert just at the top of a message body (a string).
1041 @end table
1042
1043 @c Patch Generation ===================================================
1044 @node Patch Generation, ChangeLogs Handling, Mail Preparation, User Manual
1045 @comment  node-name,  next,  previous,  up
1046 @section Patch Generation
1047
1048 Patcher creates patches by diffing your local copy of the project
1049 against the repository. This is done automatically after preparing a
1050 message, so you shouldn't normally bother to do it manually. That
1051 situation might still happen from time to time, like, if you further
1052 modify the sources, or if the initial operation failed for some reason
1053 (@pxref{More On Commands}).
1054
1055 @findex patcher-generate-diff
1056 @kindex C-c C-p d
1057 The way to (re)generate the patch manually is to call
1058 @code{patcher-generate-diff} from the mail buffer. This function is
1059 bound to @samp{C-c C-p d} in this buffer. You can both customize the
1060 diff command used to (re)generate the patch, and restrict the diff to a
1061 subset of the project's files.
1062
1063 When possible, Patcher also tries to check that your project is
1064 up-to-date with respect to the archive, and will inform you otherwise.
1065
1066 @menu
1067 * Diff Command::        Specifying the command to generate the patch
1068 * Diff Headers::        Associating hunks with files
1069 * Diff Line Filter::    Omitting lines from the diff output
1070 * Patch Restriction::   Specifying the files affected by the patch
1071 * Patcher Instances::   You can have several instances of Patcher
1072 * Diff Prologue::       A header is inserted above the patch
1073 @end menu
1074
1075 By the way, (re)generating the patch does not necessarily mean that it
1076 is directly inserted into the mail buffer. This also depends on the
1077 ChangeLogs behavior (@pxref{ChangeLogs Handling}).
1078
1079 @node Diff Command, Diff Headers, Patch Generation, Patch Generation
1080 @comment  node-name,  next,  previous,  up
1081 @subsection Diff Command
1082
1083 @vindex patcher-default-diff-command
1084 @vindex :diff-command
1085 @findex patcher-mail
1086 The diff command used to generate the patch is specified by the
1087 @code{:diff-command} project option. You can also punctually change this
1088 command by calling @code{patcher-mail} or @code{patcher-generate-diff}
1089 with a prefix argument. Patcher will then prompt you for a new command
1090 and use it exclusively for this particular patch.
1091
1092 For detail about the format of this option, see @ref{Patch Restriction}.
1093 See also @ref{More On Commands}.
1094
1095 @node Diff Headers, Diff Line Filter, Diff Command, Patch Generation
1096 @comment  node-name,  next,  previous,  up
1097 @subsection Diff Headers
1098
1099 When Patcher generates a diff, it needs to associate every hunk with the
1100 corresponding source file (and possibly with the corresponding ChangeLog
1101 file as well). Unfortunately, different revision control systems might
1102 generate different diff outputs, making this association difficult to
1103 establish.
1104
1105 @vindex patcher-default-diff-header
1106 @vindex :diff-header
1107 Patcher provides a @code{:diff-header} project option to help. Its value
1108 is of the form @code{(REGEXP NUMBER1 NUMBER2)}. @code{REGEXP} is used to
1109 match the beginning of a diff output while NUMBER1 and NUMBER2 are the
1110 parenthesized levels in which to find the corresponding old and new file
1111 names.
1112
1113 When the change involves modifying a file's contents, the old and new
1114 file names will be the same. However, they can be different in several
1115 situations, like when a file is renamed, created or deleted. In case of
1116 creation or deletion, some revision control systems use
1117 ``@code{/dev/null}'' to denote a virtual old or new file.
1118
1119 @vindex patcher-built-in-themes
1120 If you want to see some examples, have a look at the built-in themes in
1121 @code{patcher-built-in-themes} (@pxref{Themes}). They contain presets
1122 for different revision control systems, along with suitable
1123 @code{:diff-header} options.
1124
1125 Also, you should pay attention to the fact that the values of the
1126 @code{:diff-header} and @code{:diff-command} options may depend on one
1127 another to work properly. For instance, the diff output of Mercurial
1128 looks different when you use the @code{--git} option.
1129
1130
1131 @node Diff Line Filter, Patch Restriction, Diff Headers, Patch Generation
1132 @comment  node-name,  next,  previous,  up
1133 @subsection Diff Line Filter
1134 When generating a global diff, that is, without specifying the files
1135 affected by the patch explicitly (@pxref{Patch Restriction}), some
1136 uninformative lines might be present in the output. A typical example is
1137 files present in your local copy but unknown to the CVS server. Such
1138 files are indicated by a question mark in diff outputs.
1139
1140 @vindex patcher-default-diff-line-filter
1141 @vindex :diff-line-filter
1142 Patcher has a project option named @code{:diff-line-filter} that lets
1143 filter out such unwanted lines when inserting the diff in the mail
1144 buffer. This must be a regular expression matching a whole line. Caution
1145 however: do not put beginning or end of lines markers in your regexp.
1146 Patcher will do it for you.
1147
1148 By default, the value is @code{"\\? .*"}, which excludes files unknown
1149 to the CVS server.
1150
1151 @node Patch Restriction, Patcher Instances, Diff Line Filter, Patch Generation
1152 @comment  node-name,  next,  previous,  up
1153 @subsection Patch Restriction
1154
1155 Sometimes, you don't want to generate a global patch, but instead work
1156 on a subset of the project's files. Patcher understands this concept as
1157 working on a @dfn{subproject}.
1158
1159 As for working on whole projects, there are several alternatives to
1160 start working on a subproject:
1161
1162 @defun patcher-mail-subproject
1163 @findex patcher-mail
1164 This function behaves exactly like @code{patcher-mail}, except that it
1165 also prompts you for the files affected by the patch. You can specify
1166 files as well as directories, use wildcards, just as you would construct
1167 a command line diff.
1168 @end defun
1169
1170 @defun patcher-mail-adapt-subproject
1171 @findex patcher-mail-adapt
1172 Idem, with respect to @code{patcher-mail-adapt}.
1173 @end defun
1174
1175 @findex patcher-gnus-summary-followup
1176 @findex patcher-gnus-summary-followup-with-original
1177 @findex patcher-gnus-summary-reply
1178 @findex patcher-gnus-summary-reply-with-original
1179 Finally, all the Gnus-specific reply functions (@pxref{Mail
1180 Preparation}) take an optional prefix argument that make them work on
1181 subprojects.
1182
1183
1184 Two important things are to be kept in mind when working on subprojects:
1185 @itemize @bullet
1186 @item
1187 It is not necessary (it is even forbidden) to specify the ChangeLog
1188 files. Patcher will automatically find them for you. In other words,
1189 only specify source files, not ChangeLog files.
1190
1191 @item
1192 @findex patcher-mail
1193 @findex patcher-mail-subproject
1194 @findex patcher-generate-diff
1195 Don't mistake the prefix argument of @code{patcher-mail},
1196 @code{patcher-mail-subproject} and @code{patcher-generate-diff} as a way
1197 to specify files. It is not meant for that. It is meant only to
1198 temporarily modify the diff command itself, not the files to which it
1199 applies.
1200 @end itemize
1201
1202 @vindex patcher-default-diff-command
1203 @vindex :diff-command
1204 When working on a subproject, Patcher uses the same diff command as the
1205 one used for the whole project, that is, the value of the
1206 @code{:diff-command} project option. In the case of a subproject
1207 however, Patcher has to know where to put the files on the command line
1208 (even if it's usually the last part of it). This is done with the special
1209 construct @samp{%f}: a @samp{%f} appearing in the diff command will be
1210 replaced with the specified files (and the computed ChangeLog files) for
1211 a subproject, and will simply be removed when working on the whole
1212 project.
1213
1214 For example, the built-in CVS theme (@pxref{Themes}) has the
1215 @code{:diff-command} option set to @samp{cvs -q diff -u %f}.
1216
1217 There is another special construct available in this command: a
1218 @samp{%n} will be replaced with the project's name (@pxref{Subproject
1219 Naming}). This may be useful in commands with weird options syntax, like
1220 PRCS.
1221
1222 For a more advanced way of handling subprojects, see @ref{More On
1223 Subprojects}.
1224
1225 @node Patcher Instances, Diff Prologue, Patch Restriction, Patch Generation
1226 @comment  node-name,  next,  previous,  up
1227 @subsection Patcher Instances
1228
1229 The concept of subprojects brings up the question of having Patcher
1230 working on different patches at the same time. It is possible under some
1231 conditions:
1232
1233 @itemize @bullet
1234 @item
1235 You can have as many simultaneous Patcher instances as you want on
1236 different projects (you would not define two projects sharing the same
1237 directory, would you ?).
1238
1239 @item
1240 You can have as many simultaneous Patcher instances as you want on the
1241 same project, as long as there is no overlapping between each
1242 subproject. This means that you can't have source files, or even
1243 ChangeLog files in common.
1244 @end itemize
1245
1246 This last point will be subject to improvements in the future.
1247
1248
1249 @node Diff Prologue, , Patcher Instances, Patch Generation
1250 @comment  node-name,  next,  previous,  up
1251 @subsection Diff Prologue
1252
1253 Patcher can (and does) insert a special prologue just above a patch in
1254 the message in preparation. This prologue gives information such as the
1255 diff command used, the files affected and so on.
1256
1257 @vindex patcher-default-diff-prologue-function
1258 @vindex :diff-prologue-function
1259 @findex patcher-default-diff-prologue
1260 The function used to generate this prologue can be specified with the
1261 @code{:diff-prologue-function} project option. A value of @code{nil}
1262 means don't insert any prologue. By default, the internal function
1263 @code{patcher-default-diff-prologue} is used. If you want to provide
1264 your own, here how to do it.
1265
1266 Your function should take one argument indicating the kind of diff (a
1267 symbol), and perform insertion at current point in the current buffer.
1268 The possible values for the argument are:
1269
1270 @table @code
1271 @item sources
1272 indicates a source diff only,
1273
1274 @item change-logs
1275 indicates a ChangeLog diff only,
1276
1277 @item mixed
1278 indicates a diff on both source and ChangeLog files.
1279 @end table
1280
1281 The following variables are bound (when appropriate) when this function
1282 is executed:
1283
1284 @table @code
1285 @item name
1286 the name of the current Patcher project,
1287 @item source-diff
1288 the command used to create a source diff,
1289 @item change-log-diff
1290 the command used to create a ChangeLog diff,
1291 @item source-files
1292 sources files affected by the current patch,
1293 @item change-log-files
1294 ChangeLog files affected by the current patch.
1295 @end table
1296
1297  In the case of a mixed diff, a @code{nil} value for
1298 @code{change-log-diff} indicates that the same command was used for both
1299 the source and ChangeLog files.
1300
1301
1302
1303 @c ChangeLog Handling =================================================
1304 @node ChangeLogs Handling, Project Check In, Patch Generation, User Manual
1305 @comment  node-name,  next,  previous,  up
1306 @section ChangeLogs Handling
1307
1308 ChangeLogs management in Patcher involves two aspects: how ChangeLog
1309 entries are created, and how they appear in the messages. Both aspects
1310 can be customized beyond your craziest dreams.
1311
1312 @menu
1313 * ChangeLogs Updating::   How Patcher deals with ChangeLogs
1314 * ChangeLogs Appearance:: How ChangeLogs appear in messages
1315 * ChangeLogs Prologue::   A header is inserted above the ChangeLogs
1316 @end menu
1317
1318 @node ChangeLogs Updating, ChangeLogs Appearance, ChangeLogs Handling, ChangeLogs Handling
1319 @comment  node-name,  next,  previous,  up
1320 @subsection ChangeLogs Updating
1321
1322 @vindex patcher-default-change-logs-updating
1323 @vindex :change-logs-updating
1324 The way Patcher deals with ChangeLogs is controlled via the
1325 @code{:change-logs-updating} project option. Its value (a symbol) must
1326 be one of @code{automatic} (the default), @code{manual} or @code{none}.
1327
1328 @menu
1329 * Automatic ChangeLogs::        Automatic creation of ChangeLog skeletons
1330 * Manual ChangeLogs::           When ChangeLog entries already exist
1331 * No ChangeLogs::               For project that don't use ChangeLog files
1332 @end menu
1333
1334 @node Automatic ChangeLogs, Manual ChangeLogs, , ChangeLogs Updating
1335 @comment  node-name,  next,  previous,  up
1336 @subsubsection Automatic ChangeLogs
1337
1338 Automatic ChangeLogs mode is the default. Each time you (re)generate a
1339 diff, Patcher (re)creates ChangeLog skeletons in the appropriate
1340 ChangeLog files, by analyzing the generated diff. You then need to fill
1341 the entries manually.
1342
1343 @menu
1344 * Skeleton Generation:: How skeletons are created.
1345 * Skeleton Parameters:: What the skeletons look like.
1346 * ChangeLog Files::     Noticing and saving ChangeLogs.
1347 @end menu
1348
1349 @node Skeleton Generation, Skeleton Parameters, Automatic ChangeLogs, Automatic ChangeLogs
1350 @comment  node-name,  next,  previous,  up
1351
1352 @findex patch-to-change-log
1353 @vindex patcher-default-diff-cleaner
1354 @findex patcher-generic-diff-cleaner
1355 @vindex :diff-cleaner
1356 ChangeLog skeletons are not generated by Patcher directly, but rather by
1357 the function @code{patch-to-change-log} of the @code{add-log} library
1358 from the @code{xemacs-base} package. This function supports only
1359 standard and CVS diff, in unified format. For revision control systems
1360 that output something different, Patcher provides a @code{:diff-cleaner}
1361 option. This option names a function that will be used to ``cleanup''
1362 the diff (so that it looks like a standard one, just before calling
1363 @code{patch-to-change-log}. Patcher also comes with a generic cleaner
1364 function named @code{patcher-generic-diff-cleaner} which is used by
1365 default and works correctly with Git, Mercurial, Darcs and PRCS, as long
1366 as you use the corresponding built-in themes (@pxref{Themes}), or in
1367 fact, as long as the corresponding @code{:diff-header} option is correct
1368 (@pxref{Diff Headers}).
1369
1370 @vindex patcher-default-kill-source-files-after-diffing
1371 @vindex :kill-source-files-after-diffing
1372 In order to build the ChangeLog skeletons, the source files must be
1373 visited. Patcher has a @code{:kill-source-files-after-diffing} project
1374 option that lets you decide whether you want to kill the source buffers
1375 just after diffing or not. The value can be either @code{nil} or
1376 @code{t}. By default, the behavior is to preserve the source files,
1377 since you might need them for reference when filling the ChangeLog
1378 entries. If you don't use automatic ChangeLogs mode, it makes sense to
1379 set this option to @code{t}.
1380
1381 @node Skeleton Parameters, ChangeLog Files, Skeleton Generation, Automatic ChangeLogs
1382 @comment  node-name,  next,  previous,  up
1383
1384 @vindex patcher-default-change-logs-user-name
1385 @vindex :change-logs-user-name
1386 @vindex patcher-default-user-name
1387 @vindex :user-name
1388 @vindex patcher-default-change-logs-user-mail
1389 @vindex :change-logs-user-mail
1390 @vindex patcher-default-user-mail
1391 @vindex :user-mail
1392 @findex patch-to-change-log
1393 @vindex user-full-name
1394 @vindex user-mail-address
1395 Patcher has two project options that give you some control on the
1396 generated ChangeLog skeleton: @code{:change-logs-user-name} and
1397 @code{:change-logs-user-mail}. As you might expect, these are strings
1398 defining your name and mail address for ChangeLog entries'headers. When
1399 @code{nil}, Patcher falls back to (respectively) the @code{:user-name}
1400 and @code{:user-mail} project options. If in turn set to nil, Patcher
1401 lets the function @code{patch-to-change-log} decide what to use (most
1402 probably what the user options @code{user-full-name} and
1403 @code{user-mail-address} say).
1404
1405 @node ChangeLog Files, , Skeleton Parameters, Automatic ChangeLogs
1406 @comment  node-name,  next,  previous,  up
1407
1408 Normally, you don't modify source files when working with Patcher.
1409 However, ChangeLog files need update and saving in automatic mode.
1410 Patcher provides two hooks for plugging in additional processing on
1411 ChangeLog files.
1412
1413 @itemize @bullet
1414 @item @code{:notice-change-log-hook}
1415 @vindex patcher-default-notice-change-log
1416 @vindex :notice-change-log-hook
1417 This hook is run every time Patcher ``notices'' a ChangeLog file. 
1418 Noticing a ChangeLog file in this context means figuring out that it is
1419 involved in the current patch. Every function in this hook will be given
1420 the ChangeLog file name (relative to the project's directory) as
1421 argument.
1422 @item @code{:after-save-change-log-hook}
1423 @vindex patcher-default-after-save-change-log-hook
1424 @vindex :after-save-change-log-hook
1425 This hook is run every right after you save a ChangeLog file. The
1426 functions in this hook are executed in the ChangeLog's buffer.
1427 @end itemize
1428
1429 @node Manual ChangeLogs, No ChangeLogs, Automatic ChangeLogs, ChangeLogs Updating
1430 @comment  node-name,  next,  previous,  up
1431 @subsubsection Manual ChangeLogs
1432
1433 In manual mode, Patcher assumes that you create ChangeLog entries
1434 manually, as you write the code, so it won't create ChangeLog skeletons.
1435 It is important to understand that in this situation, ChangeLog entries
1436 @strong{must} have been written @strong{before} you call Patcher.
1437 Patcher won't let you write them in the process.
1438
1439 Even in @code{manual} mode, Patcher might still need to know the
1440 affected ChangeLog files (for the commit process) and your exact
1441 ChangeLog entries in each of these files (for insertion in the message).
1442 The ChangeLog files are automatically deduced from the patch. When
1443 that's required, however, you will be presented with each ChangeLog file
1444 in turn, and invited to precise the number of ChangeLog entries
1445 concerning this patch. These entries must of course appear at the top of
1446 the file.
1447
1448 @node No ChangeLogs, , Manual ChangeLogs, ChangeLogs Updating
1449 @comment  node-name,  next,  previous,  up
1450 @subsubsection No ChangeLogs
1451
1452 This mode is for projects that don't do ChangeLogs. Patcher won't try to
1453 create ChangeLog entries, and won't expect that you have written
1454 ChangeLog entries either.
1455
1456 Note that if you @emph{do} have ChangeLog files in this mode, they will
1457 be regarded just as normal ones. As a consequence, this is a case where
1458 it is not forbidden to list them explicitly as part of a subproject
1459 (@pxref{Patch Restriction}), although I don't see why you would want to
1460 do that.
1461
1462
1463 @node ChangeLogs Appearance,  ChangeLogs Prologue, ChangeLogs Updating, ChangeLogs Handling
1464 @comment  node-name,  next,  previous,  up
1465 @subsection ChangeLogs Appearance
1466
1467 @findex patcher-insert-change-logs
1468 @kindex C-c C-p i
1469 When Patcher has to deal with ChangeLog files, you insert ChangeLog
1470 entries in the message buffer by calling the function
1471 @code{patcher-insert-change-logs}. It is bound to @samp{C-c C-p i} in
1472 the mail buffer. Note that if ChangeLogs are written in advance, you
1473 don't have to do that, as Patcher will do it automatically. You have to
1474 call this function by hand only in @code{automatic} updating mode
1475 (@pxref{ChangeLogs Updating}).
1476
1477 In all circumstances however, you can use this function to
1478 @strong{reinsert} the ChangeLog entries into the mail buffer. That might
1479 come in handy if you further modified them after the initial insertion
1480 (it's never too late to fix a typo).
1481
1482 @vindex patcher-default-change-logs-appearance
1483 @vindex :change-logs-appearance
1484 The appearance of ChangeLog entries in the message is controlled by the
1485 @code{:change-logs-appearance} project option. Its value must be a
1486 symbol from the following:
1487
1488 @table @code
1489 @item verbatim
1490 This is the default. ChangeLog entries appear just as text in the
1491 message, above the patch. Most people prefer this kind of appearance
1492 since it is the most readable.
1493
1494 @item packed
1495 ChangeLog entries appear as a patch (they are diff'ed against the
1496 archive). This patch is however distinct from the source patch, and
1497 appears above it.
1498
1499 @item patch
1500 ChangeLog entries appear as a patch (they are diff'ed against the
1501 archive), and this patch is integrated into the source patch. In other
1502 words, the message looks like a global patch integrating both the
1503 sources and the ChangeLogs.
1504 @end table
1505
1506 @vindex patcher-default-change-logs-diff-command
1507 @vindex :change-logs-diff-command
1508 When the ChangeLogs appearance is either @code{packed} or @code{patch},
1509 the diff command used to generate the patch is controlled by the
1510 @code{:change-logs-diff-command} project option. The value can be the
1511 symbol @code{diff}, meaning that the same diff command is to be used as
1512 for the sources (@pxref{Diff Command}), or it can be a string specifying
1513 an alternate command.
1514
1515 When diffing ChangeLog files, it is strongly recommended that you remove
1516 contexts from the diff, because otherwise, ChangeLog patches often fail
1517 to apply correctly.
1518
1519 @vindex patcher-default-diff-command
1520 @vindex :diff-command
1521 As in the case of the @code{:diff-command} project option (@pxref{Patch
1522 Restriction}), a @code{%f} serves to indicate where to put the ChangeLog
1523 files on the diff command line, and a @samp{%n} is replaced with the
1524 project's name (@pxref{Subproject Naming}). See also @ref{More On
1525 Commands}.
1526
1527 @vindex patcher-default-change-logs-diff-command
1528 @vindex :change-logs-diff-command
1529 Given these two remarks, you should now understand why the default value
1530 for @code{patcher-default-change-logs-diff-command} is @samp{cvs -q diff
1531 -U 0 %f}.
1532
1533 @node ChangeLogs Prologue, , ChangeLogs Appearance, ChangeLogs Handling
1534 @comment  node-name,  next,  previous,  up
1535 @subsection ChangeLogs Prologue
1536
1537 ChangeLog prologues are small pieces of informative text that Patcher
1538 adds above each ChangeLog insertion in the mail buffer.
1539
1540 @vindex patcher-default-change-logs-prologue
1541 @vindex :change-logs-prologue
1542 When the ChangeLogs appearance is @code{verbatim}, Patcher inserts one
1543 prologue per ChangeLog file. The prologue's contents is controlled by
1544 the @code{:change-logs-prologue} project option (a string). A @samp{%f}
1545 appearing in this string will be replaced with the ChangeLog filename.
1546 The default value for @code{patcher-default-change-logs-prologue} is
1547 @code{"%f addition:"}.
1548
1549 @vindex patcher-default-diff-prologue-function
1550 @vindex :diff-prologue-function
1551 @findex patcher-default-diff-prologue
1552 When the ChangeLogs appearance is @code{packed}, Patcher inserts only
1553 one prologue for the whole ChangeLogs patch. When @code{patch}, there is
1554 a single prologue for both the ChangeLogs and the sources. For
1555 customizing the prologue in both of these cases, see @ref{Diff
1556 Prologue}.
1557
1558
1559 @c Project Check In ===================================================
1560 @node Project Check In, Mail Sending, ChangeLogs Handling, User Manual
1561 @comment  node-name,  next,  previous,  up
1562 @section Project Check In
1563
1564 @findex patcher-commit-change
1565 @kindex C-c C-p c
1566 If you have the privilege to commit your changes yourself, you might do
1567 so directly from the mail buffer, as the last operation before actually
1568 sending the message. This is done by calling the function
1569 @code{patcher-commit-change} which is bound to @samp{C-c C-p c} in the
1570 mail buffer.
1571
1572 Committing directly from Patcher has the advantage that both the commit
1573 command line and the commit log message (@pxref{Log Message Handling})
1574 are constructed automatically. Of course, you still have an in-depth
1575 control on the commit process.
1576
1577 @menu
1578 * Commit Command::       Specifying the command to commit the patch
1579 * Log Message Handling:: Building a commit log message
1580 * Commit Operation::     Actually committing your changes
1581 @end menu
1582
1583 @node Commit Command, Log Message Handling, Project Check In, Project Check In
1584 @comment  node-name,  next,  previous,  up
1585 @subsection Commit Command
1586
1587 @findex patcher-commit-change
1588 @vindex patcher-default-commit-command
1589 @vindex :commit-command
1590 The command used to to commit a patch is specified by the
1591 @code{:commit-command} project option (a string). You can also
1592 temporarily change the command in question by calling
1593 @code{patcher-commit-change} with a prefix argument. As usual, note that
1594 this prefix argument is not meant to modify the affected files on the
1595 command line. It's meant only to punctually modify the commit command
1596 itself. The affected files are computed automatically by Patcher.
1597
1598 The commit command accepts (and maybe requires) special constructs:
1599
1600 @itemize
1601 @item
1602 A @code{%n} occurring in the string will be replaced with the project's
1603 name (@pxref{Subproject Naming}).
1604
1605 @item
1606 A @code{%f} occurring in the string will be replaced with the files
1607 affected by the patch (ChangeLogs included, this time), or discarded if
1608 the patch is global.
1609
1610 @item
1611 A @code{%?f@{blabla@}} occurring in the string will be replaced with
1612 ``blabla'' if @code{%f} would expand to something, or discarded
1613 otherwise (this is an ``if @code{%f}'' form).
1614
1615 @item
1616 A @code{%!f@{blabla@}} occurring in the string will be replaced with
1617 ``blabla'' if @code{%f} would expand to nothing, or discarded otherwise
1618 (this is an ``if not @code{%f}'' form).
1619
1620 @item
1621 A @code{%s} occurring in the string will be replaced with the name of
1622 a file containing the commit log message (@pxref{Log Message Handling}).
1623 This file is a temporary file handled by Patcher.
1624
1625 @item
1626 A @code{%S} occurring in the string will be replaced with the commit log
1627 message itself (@pxref{Log Message Handling}). Since the intent here is
1628 to use the message as a command-line argument, it is quoted against
1629 shell expansion.
1630 @end itemize
1631
1632 Please note that a @code{%f} is required in your commit commands, unless
1633 you know for sure that you will never ever work on a subproject
1634 (@pxref{Patch Restriction}). But you never know that. Besides, you
1635 should always also provide either a @code{%s} or a @code{%S}, unless
1636 your archival software does not support log messages.
1637
1638 @vindex patcher-default-commit-command
1639 @vindex :commit-command
1640 Given that, you should now understand why the default value for
1641 @code{patcher-default-commit-command} is @samp{cvs commit -F %s %f}.
1642
1643 @node Log Message Handling, Commit Operation, Commit Command, Project Check In
1644 @comment  node-name,  next,  previous,  up
1645 @subsection Log Message Handling
1646
1647 Most project management tools understand the concept of a @dfn{log
1648 message}: a short yet informative message that accompany the commit
1649 operation, which is also stored in the repository.
1650
1651 Before a commit operation, Patcher always builds an initial log message,
1652 based on certain elements under your control (@pxref{Log Message
1653 Elements}). Afterwards, you can decide on whether you want some further
1654 (manual) edition of log message, or whether you want to commit
1655 immediately.
1656
1657 @vindex patcher-default-edit-log-message
1658 @vindex :edit-log-message
1659 The @code{:edit-log-message} project option lets you specify this
1660 behavior. If @code{t} (the default), you will be able to manually edit
1661 the log message. If @code{nil}, Patcher will proceed directly to the
1662 commit operation.
1663
1664 Please note that Patcher stores log messages in temporary files that
1665 will be used later by the commit command.
1666
1667 @menu
1668 * Log Message Elements:: Elements Patcher can add automatically
1669 * Log Message Editing::  Manually modifying the log message
1670 @end menu
1671
1672 @node Log Message Elements, Log Message Editing, Log Message Handling, Log Message Handling
1673 @comment  node-name,  next,  previous,  up
1674 @subsubsection Log Message Elements
1675
1676 @vindex patcher-default-log-message-items
1677 @vindex :log-message-items
1678 Patcher has the ability to initialize the log message with different
1679 elements. These elements are specified with the
1680 @code{:log-message-items} project option. Its value is either
1681 @code{nil}, meaning that you don't want any initialization, or a list of
1682 symbols specifying the elements you desire. The available items are:
1683
1684 @table @code
1685 @item subject
1686 The subject of the message. The subject's prefix is automatically
1687 removed.
1688
1689 @item compressed-change-logs
1690 The ``compressed'' ChangeLog entries. Only the most important part of
1691 the ChangeLogs is preserved, so the entries appear in a more compact
1692 fashion.
1693
1694 @item change-logs
1695 The raw ChangeLog entries.
1696 @end table
1697
1698 @vindex patcher-default-change-logs-separator
1699 @vindex :change-logs-separator
1700 By default, only the message's subject is used. When using more than one
1701 item, they appear in the order specified above. If anything appears
1702 before the raw ChangeLog entries, a separator string is used. This
1703 string is specified by the @code{:change-logs-separator} project option.
1704 By default the string looks like ``--- ChangeLog entries follow: ---''.
1705
1706
1707 @node Log Message Editing, , Log Message Elements, Log Message Handling
1708 @comment  node-name,  next,  previous,  up
1709 @subsubsection Log Message Editing
1710
1711 If so required, Patcher lets you manually edit the log message after
1712 having initialized it. Log message edition happens in a special buffer,
1713 the @code{*Patcher Log Message*} buffer.
1714
1715 While editing this buffer, commands to insert the items described in
1716 @ref{Log Message Elements} are at your disposal. These commands perform
1717 insertion at point:
1718
1719 @table @code
1720 @item patcher-logmsg-insert-subject
1721 @findex patcher-logmsg-insert-subject
1722 @kindex C-c C-p s
1723 Bound to @samp{C-c C-p s}. Insert the message's subject (sans the
1724 prefix).
1725
1726 @item patcher-logmsg-insert-compressed-change-logs
1727 @findex patcher-logmsg-insert-compressed-change-logs
1728 @kindex C-c C-p c
1729 Bound to @samp{C-c C-p c}. Insert the compressed ChangeLog entries.
1730
1731 @item patcher-logmsg-insert-change-logs
1732 @findex patcher-logmsg-insert-change-logs
1733 @kindex C-c C-p l
1734 Bound to @samp{C-c C-p l}. Insert the raw ChangeLog entries. Use a
1735 prefix argument if you also want the ChangeLogs separator string to be
1736 inserted.
1737 @end table
1738
1739 @findex patcher-logmsg-init-message
1740 @kindex C-c C-p i
1741 In addition to these commands, you can also completely reinitialize the
1742 log message according to the specified items, by calling the function
1743 @code{patcher-logmsg-init-message}, bound to @samp{C-c C-p i}. Caution:
1744 this command first erases the buffer.
1745
1746 @findex patcher-logmsg-commit
1747 @kindex C-c C-c
1748 Finally, once you're happy with your log message, you proceed to the
1749 commit operation by calling the function @code{patcher-logmsg-commit},
1750 bound to @samp{C-c C-c}.
1751
1752 @node Commit Operation, , Log Message Handling, Project Check In
1753 @comment  node-name,  next,  previous,  up
1754 @subsection Commit Operation
1755
1756 @kindex C-c C-p c
1757 @kindex C-c C-c
1758 The commit operation occurs after typing @samp{C-c C-p c} from the mail
1759 buffer, if you have not required log message edition, or after typing
1760 @samp{C-c C-c} from the @code{*Patcher Log Message*} buffer otherwise.
1761
1762 @vindex patcher-default-confirm-commits
1763 @vindex :confirm-commits
1764 At that point, Patcher has constructed a proper commit command. You
1765 still have an option to abort the process, though: the
1766 @code{:confirm-commits} project option lets you specify whether to
1767 require confirmation before committing. If @code{t} (the default),
1768 Patcher will display the constructed commit command and ask for a
1769 confirmation before proceeding. If @code{nil}, Patcher will commit
1770 immediately.
1771
1772 After the commit operation, Patcher changes some parts of the mail
1773 buffer in the following manner:
1774
1775 @itemize @bullet
1776 @item
1777 @vindex patcher-default-subject-committed-prefix
1778 @vindex :subject-committed-prefix
1779 The subject prefix is changed to that specified by the
1780 @code{:subject-committed-prefix} project option (a string), unless it is
1781 @code{nil}. By default, ``[COMMIT]'' is used.
1782
1783 @item
1784 @vindex patcher-default-committed-notice
1785 @vindex :committed-notice
1786 A commit notice is added right at the beginning of the message's body.
1787 This notice is specified by the @code{:committed-notice} project option.
1788 It can be @code{nil} or a string. By default, it reads ``NOTE: this
1789 patch has been committed.''.
1790 @end itemize
1791
1792
1793 @c Mail Sending =======================================================
1794 @node Mail Sending, More On Commands, Project Check In, User Manual
1795 @comment  node-name,  next,  previous,  up
1796 @section Mail Sending
1797
1798 Sending the message will most probably be done by typing @samp{C-c C-c}
1799 in the mail buffer. This is also the case when you're using the fake
1800 mail method, by the way.
1801
1802 @menu
1803 * Before Sending:: Patcher does some checkings
1804 * After Sending::  patcher does some cleanup
1805 @end menu
1806
1807 @node Before Sending, After Sending, Mail Sending, Mail Sending
1808 @comment  node-name,  next,  previous,  up
1809 @subsection Before Sending
1810
1811 There are circumstances in which Patcher will perform some checkings on
1812 your message when you send it, just before it is actually sent:
1813
1814 @itemize @bullet
1815 @item ChangeLogs insertion
1816
1817 @vindex patcher-mail-check-change-logs-insertion
1818 In case of manual ChangeLog insertion (@pxref{ChangeLogs Appearance}),
1819 Patcher can check that you have indeed inserted the ChangeLog entries
1820 before sending the message. This behavior is controlled by the
1821 @code{patcher-mail-check-change-logs-insertion} user option. A value of
1822 @code{nil} means never check (the message will be sent as-is). A value
1823 of t means check, and abort the sending if the ChangeLog entries are
1824 missing. A value of @code{ask} (the default) means ask for your opinion
1825 on this terrible matter.
1826
1827 @item Commit Operation
1828
1829 @vindex patcher-default-commit-privilege
1830 @vindex :commit-privilege
1831 Patcher has a @code{:commit-privilege} project option; a boolean
1832 specifying whether you're likely to commit your changes by yourself.
1833
1834 @vindex patcher-mail-check-commit-action
1835 In case of commit privilege, Patcher can check that you have indeed
1836 committed your changes before sending the message. This behavior is
1837 controlled by the @code{patcher-mail-check-commit-action} user option. A
1838 value of @code{nil} means never check (the message will be sent as-is).
1839 A value of t means check, and abort the sending if the commit operation
1840 has not been performed. A value of @code{ask} (the default) means ask
1841 for your opinion on this rather unfortunate situation.
1842 @end itemize
1843
1844
1845 Two notes on these checkings:
1846
1847 @itemize @bullet
1848 @item
1849 For uninteresting technical reasons, Patcher does not currently (and
1850 will probably never) offer you an automatic ChangeLogs insertion or
1851 commit operation, at mail sending time, but just abort the sending
1852 process in some circumstances. That's not a big deal though.
1853
1854 @item
1855 For other uninteresting technical reasons, these checkings require a
1856 native knowledge of your mail user agent. Patcher does not currently
1857 support all mail user agents on earth (I'll add them on demand however).
1858 If that's the case, you will be warned and invited to send me a message.
1859 Also, you can send me one on April 21st: it's my birthday.
1860 @end itemize
1861
1862 @node After Sending, , Before Sending, Mail Sending
1863 @comment  node-name,  next,  previous,  up
1864 @subsection After Sending
1865
1866 After sending the message, Patcher also performs some cleanup
1867 operations, that you can customize. The cleanup is controlled by the
1868 following project options. Each one is a boolean option which defaults
1869 to @code{t}.
1870
1871 @table @code
1872 @item :kill-source-files-after-sending
1873 @vindex patcher-default-kill-source-files-after-sending
1874 @vindex :kill-source-files-after-sending
1875 Whether to kill source files after sending the message. If @code{nil},
1876 the source files will remain visited.
1877
1878 @item :kill-change-logs-after-sending
1879 @vindex patcher-default-kill-change-logs-after-sending
1880 @vindex :kill-change-logs-after-sending
1881 Whether to kill ChangeLog files after sending the message. If
1882 @code{nil}, the ChangeLog files will remain visited.
1883 @end table
1884
1885
1886 @c More On Commands ===================================================
1887 @node More On Commands, More On Subprojects, Mail Sending, User Manual
1888 @comment  node-name,  next,  previous,  up
1889 @section More On Commands
1890
1891 This section deals with information that apply to all commands used by
1892 Patcher (diff and commit operations).
1893
1894 @menu
1895 * Prefixing Commands::  Bypassing a firewall
1896 * Error Handling::      Dealing with errors
1897 @end menu
1898
1899 @node Prefixing Commands, Error Handling, , More On Commands
1900 @comment  node-name,  next,  previous,  up
1901 @subsection Prefixing Commands
1902
1903 If you're working on a distant archive and you're behind a firewall, you
1904 might need to prefix all your commands with something like
1905 @code{runsocks}. Of course, this can be done manually in all your
1906 command settings, but Patcher offers you a simpler way to do it.
1907
1908 @vindex patcher-default-pre-command
1909 @vindex :pre-command
1910 There is a project option named @code{:pre-command} which can be used
1911 for this kind of thing. It must be a string that will be prepended to
1912 all operations performed by Patcher.
1913
1914
1915 @node Error Handling, , Prefixing Commands, More On Commands
1916 @comment  node-name,  next,  previous,  up
1917 @subsection Error Handling
1918
1919 @vindex patcher-default-failed-command-regexp
1920 @vindex :failed-command-regexp
1921 From time to time, commands may fail for different reasons. Patcher
1922 tracks the failures in these commands and lets you know when that
1923 happens. The @code{:failed-command-regexp} project option lets you
1924 specify a regular expression to match with the output of an aborted
1925 command. By default, the value is @code{"^cvs \\[[^]]* aborted\\]"}.
1926
1927
1928 @c More On Subprojects ===============================================
1929 @node More On Subprojects, , More On Commands, User Manual
1930 @comment  node-name,  next,  previous,  up
1931 @section More On Subprojects
1932
1933 We've already seen how to work punctually on a subproject, that is, on a
1934 subset of a project's files (@pxref{Patch Restriction}). If you happen
1935 to work more than once on the same project subset, it will quickly
1936 become annoying to have to specify explicitly the same files over and
1937 over again. Patcher offers you a way to permanently define subprojects.
1938
1939 @menu
1940 * Defining Subprojects::  Storing subprojects definitions
1941 * Subproject Naming::     When different projects have the same name
1942 * Command Directory::     For non local revision control systems
1943 @end menu
1944
1945
1946 @node Defining Subprojects, Subproject Naming, , More On Subprojects
1947 @comment  node-name,  next,  previous,  up
1948 @subsection Defining Subprojects
1949
1950 @vindex patcher-subprojects
1951 The user option @code{patcher-subprojects} stores a list of
1952 @dfn{subproject descriptors}. A subproject descriptor is almost the same
1953 as a project descriptor, with a few exceptions:
1954
1955 @itemize @bullet
1956 @item
1957 Instead of the project directory field (the second field in a project
1958 descriptor), you rather specify the name of the project this subproject
1959 is based on.
1960
1961 @item
1962 In addition to the standard project options we've already seen, two
1963 subproject options are available:
1964 @table @code
1965 @item :subdirectory
1966 @vindex :subdirectory
1967 This lets you specify a subdirectory of the original project's directory
1968 in which the whole subproject resides.
1969
1970 @item :files
1971 @vindex :files
1972 This lets you specify a list of files or directories composing the
1973 subproject. Each file specification can contain wildcards. If a
1974 @code{:subdirectory} subproject option is given, these files or
1975 directories should be relative to this subdirectory. Otherwise, they
1976 should be relative to the parent project's directory.
1977 @end table
1978
1979 Please note that these subproject options have no corresponding fallback
1980 (that would be meaningless). They can't appear in a theme either.
1981
1982 @item
1983 @vindex :inheritance
1984 Subprojects don't have an @code{:inheritance} mechanism. Instead, they
1985 implicitly inherit from their base project (which in turn can inherit
1986 from other projects).
1987 @end itemize
1988
1989 Here are some important remarks about subprojects:
1990
1991 @itemize @bullet
1992 @item
1993 @vindex :subdirectory
1994 @vindex :files
1995 A subproject with neither a @code{:subdirectory} nor a @code{:files}
1996 option is exactly the same as the base project, apart from project
1997 options that you would override.
1998
1999 @item
2000 @findex patcher-mail
2001 @findex patcher-mail-subproject
2002 @findex patcher-mail-adapt
2003 @findex patcher-mail-adapt-subproject
2004 Since permanent subprojects are defined statically, they should be used
2005 with the normal Patcher functions like @code{patcher-mail}. You don't
2006 need to use the @code{*-subproject} versions any more.
2007
2008 @item
2009 Because of that, projects and subprojects can't have names in common. If
2010 that happens to be the case, Patcher will blindly use a subproject
2011 rather than a project of that name
2012
2013 @item
2014 So what happens if you persist in using a @code{*-subproject} function
2015 on a permanent subproject ? Well, you punctually work on a
2016 subsubproject@dots{}
2017 @end itemize
2018
2019
2020 @node Subproject Naming, Command Directory, Defining Subprojects, More On Subprojects
2021 @comment  node-name,  next,  previous,  up
2022 @subsection Subproject Naming
2023
2024 @vindex patcher-projects
2025 @vindex patcher-subprojects
2026 As you already know, Patcher distinguishes projects by their @var{NAME}
2027 field in the @code{patcher-projects} and @code{patcher-subprojects} user
2028 options. This is problematic, however, if you define different patcher
2029 projects for a single physical project, and the commands require the
2030 project's name. That might for instance be the case with PRCS
2031 (decidedly) weird options syntax.
2032
2033 @vindex patcher-default-name
2034 @vindex :name
2035 To remedy this problem, patcher provides a @code{:name} project option.
2036 If set, it will actually be used for all @code{%n} substitutions where
2037 the project's name (in the Patcher sense) would normally be used.
2038
2039 If you want to use the project's name in the Patcher sense, regardless
2040 of the value of the @code{:name} option, use @code{%N} instead of
2041 @code{%n}.
2042
2043
2044 @node Command Directory, , Subproject Naming, More On Subprojects
2045 @comment  node-name,  next,  previous,  up
2046 @subsection Command Directory
2047
2048 Some revision control systems, like CVS, work on a per-file basis. Some
2049 others, like PRCS, work only globally. This has an important implication
2050 for subprojects being sudirectories of other projects. Indeed, while
2051 CVS, for instance, can be executed anywhere, PRCS can only be run in the
2052 base project's root directory.
2053
2054 @vindex :command-directory
2055 @vindex patcher-default-command-directory
2056 If you want to define projects for which the revision control system can
2057 be executed in only one directory, Patcher provides you with the
2058 @code{:command-directory} project option (a string). This directory can
2059 be specified relative to the project's directory (but note that it must
2060 go upwards).
2061
2062 All commands (diff and commit ones) will be executed from there. Also,
2063 note that the command directory does not change the way you might
2064 specify files. Patcher modifies all needed paths automatically to handle
2065 the command directory properly.
2066
2067
2068 @c ====================================================================
2069 @c XEmacs Devel
2070 @c ====================================================================
2071 @node XEmacs Devel, Variables Index, User Manual, Top
2072 @comment  node-name,  next,  previous,  up
2073 @chapter XEmacs Development
2074
2075 Here is some specific information on how to setup Patcher for XEmacs
2076 developers. This assumes you're a committer to the mercurial
2077 repository of the 21.5 branch.
2078
2079 The way I do it, I have a directory named
2080 @code{/usr/local/src/xemacs-21.5} which is a clone of the Debian
2081 Mercurial repository. Let's call it the @emph{local trunk}. I have set
2082 the proper @code{default} and @code{default-push} options in
2083 @code{/usr/local/src/xemacs-21.5/.hg/hgrc} so that I can push, pull,
2084 fetch or whatever without any argument on the command line. I also
2085 have set the @code{username} option to my XEmacs identity (that's
2086 mainly for the commit log messages).
2087
2088 When I work on a new feature, I do it in a directory named
2089 @code{/usr/local/src/xemacs-21.5-new-feature}, in which I commit
2090 regularly and occasionally merge with the main repository to keep up
2091 to date. When I'm satisfied with the feature, it's time to integrate
2092 it, but I don't want to import my whole personal history; so I just
2093 apply the final diff to my local trunk (which @emph{must} be up to
2094 date), commit locally with Patcher and then push it up by hand.
2095
2096 Under those conditions, the Patcher setup is quite simple:
2097
2098 @itemize @bullet
2099 @item
2100 Set the @code{commit-privilege} option to @code{t}.
2101 @item
2102 Use the @code{mercurial} or @code{mercurial-ws} built-in theme.
2103 @item
2104 Use the @code{fake} mail method, because messages are now sent to
2105 @code{xemacs-patches} automatically.
2106 @item
2107 Put @code{subject} in the @code{:log-message-items} project options.
2108 This will serve as the summary line, and then you can put whatever
2109 longer description you want on the lines below it.
2110 @end itemize
2111
2112 That's it. Patcher generates the ChangeLog entries and performs the
2113 local commit. I just finish by pushing by hand. Maybe Patcher could
2114 also do that for me one day...
2115
2116
2117
2118 @c ====================================================================
2119 @c Variables Index
2120 @c ====================================================================
2121 @node Variables Index, Functions Index, XEmacs Devel, Top
2122 @comment  node-name,  next,  previous,  up
2123 @unnumbered Variables Index
2124 @printindex vr
2125
2126
2127 @c ====================================================================
2128 @c Functions Index
2129 @c ====================================================================
2130 @node Functions Index,  Keystrokes Index, Variables Index, Top
2131 @comment  node-name,  next,  previous,  up
2132 @unnumbered Functions Index
2133 @printindex fn
2134
2135
2136 @c ====================================================================
2137 @c Keystrokes Index
2138 @c ====================================================================
2139 @node Keystrokes Index,  , Functions Index, Top
2140 @comment  node-name,  next,  previous,  up
2141 @unnumbered Keystrokes Index
2142 @printindex ky
2143
2144
2145 @bye
2146
2147 @c Don't add stuff under this line !!
2148 @c patcher.texi ends here