Merge lp:~ian-clatworthy/bzr/user-ref-topics into lp:bzr

Proposed by Ian Clatworthy
Status: Merged
Approved by: Martin Pool
Approved revision: not available
Merged at revision: not available
Proposed branch: lp:~ian-clatworthy/bzr/user-ref-topics
Merge into: lp:bzr
Diff against target: 542 lines (+125/-94)
15 files modified
NEWS (+8/-1)
bzrlib/bugtracker.py (+19/-16)
bzrlib/bzrdir.py (+2/-2)
bzrlib/commands.py (+3/-2)
bzrlib/conflicts.py (+1/-1)
bzrlib/doc_generate/autodoc_rstx.py (+44/-32)
bzrlib/help_topics/__init__.py (+24/-19)
bzrlib/help_topics/en/authentication.txt (+2/-4)
bzrlib/help_topics/en/configuration.txt (+1/-1)
bzrlib/help_topics/en/conflict-types.txt (+2/-2)
bzrlib/help_topics/en/content-filters.txt (+2/-2)
bzrlib/help_topics/en/log-formats.txt (+1/-1)
bzrlib/help_topics/en/rules.txt (+9/-6)
bzrlib/hooks.py (+1/-1)
doc/en/user-guide/hooks.txt (+6/-4)
To merge this branch: bzr merge lp:~ian-clatworthy/bzr/user-ref-topics
Reviewer Review Type Date Requested Status
Martin Pool Needs Fixing
Review via email: mp+16750@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Ian Clatworthy (ian-clatworthy) wrote :

This branch formats the User Reference as a set of topics. Improving the formatting of the User Reference in this way was recently discussed and agreed to on the bzr-doc mailing list. The formatting and cross-linking of numerous topics has also been improved.

As a side effect of this change, each help topic is now available as http://doc.bazaar.canonical.com/test/en/user-reference/xxx-help.html. The old "conflicts" help topic has been renamed to "conflict-types" so that the conflicts command and it don't map to exactly the same URL.

Revision history for this message
Martin Pool (mbp) wrote :

The change of 'conflicts' name is good but should be in NEWS; perhaps the reformatting should be too.

Thanks

review: Needs Fixing
Revision history for this message
Ian Clatworthy (ian-clatworthy) wrote :

> The change of 'conflicts' name is good but should be in NEWS; perhaps the
> reformatting should be too.

Done.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'NEWS'
2--- NEWS 2010-01-04 05:40:01 +0000
3+++ NEWS 2010-01-04 08:49:20 +0000
4@@ -79,7 +79,14 @@
5
6 * There is a System Administrator's Guide in ``doc/en/admin-guide``,
7 including discussions of installation, relevant plugins, security and
8- backup.
9+ backup. (Neil Martinsen-Burrell)
10+
11+* The ``conflicts`` help topic has been renamed to ``conflict-types``.
12+ (Ian Clatworthy)
13+
14+* The User Reference is now presented as a series of topics.
15+ Many of the included topics have link and format tweaks applied.
16+ (Ian Clatworthy)
17
18 API Changes
19 ***********
20
21=== modified file 'bzrlib/bugtracker.py'
22--- bzrlib/bugtracker.py 2009-06-10 03:31:01 +0000
23+++ bzrlib/bugtracker.py 2010-01-04 08:49:20 +0000
24@@ -39,12 +39,12 @@
25
26 _bugs_help = \
27 """When making a commit, metadata about bugs fixed by that change can be
28-recorded by using the --fixes option. For each bug marked as fixed, an
29+recorded by using the ``--fixes`` option. For each bug marked as fixed, an
30 entry is included in the 'bugs' revision property stating '<url> <status>'.
31 (The only ``status`` value currently supported is ``fixed.``)
32
33-The --fixes option allows you to specify a bug tracker and a bug identifier
34-rather than a full URL. This looks like
35+The ``--fixes`` option allows you to specify a bug tracker and a bug identifier
36+rather than a full URL. This looks like::
37
38 bzr commit --fixes <tracker>:<id>
39
40@@ -56,10 +56,13 @@
41 use this feature, you just need to know the tracker identifier to use.
42 These are the bugtrackers that are built in:
43
44- URL | Abbreviation | Example
45- https://bugs.launchpad.net/ | lp | lp:12345
46- http://bugs.debian.org/ | deb | deb:12345
47- http://bugzilla.gnome.org/ | gnome | gnome:12345
48+ ============================ ============ ============
49+ URL Abbreviation Example
50+ ============================ ============ ============
51+ https://bugs.launchpad.net/ lp lp:12345
52+ http://bugs.debian.org/ deb deb:12345
53+ http://bugzilla.gnome.org/ gnome gnome:12345
54+ ============================ ============ ============
55
56 For the bug trackers not listed above configuration is required.
57 Support for generating the URLs for any project using Bugzilla or Trac
58@@ -82,11 +85,11 @@
59
60 Use ``bzr commit --fixes lp:2`` to record that this commit fixes bug 2.
61
62-bugzilla_<tracker_abbreviation>_url
63------------------------------------
64+bugzilla_<tracker>_url
65+----------------------
66
67 If present, the location of the Bugzilla bug tracker referred to by
68-<tracker_abbreviation>. This option can then be used together with ``bzr commit
69+<tracker>. This option can then be used together with ``bzr commit
70 --fixes`` to mark bugs in that tracker as being fixed by that commit. For
71 example::
72
73@@ -95,11 +98,11 @@
74 would allow ``bzr commit --fixes squid:1234`` to mark Squid's bug 1234 as
75 fixed.
76
77-trac_<tracker_abbrevation>_url
78-------------------------------
79+trac_<tracker>_url
80+------------------
81
82 If present, the location of the Trac instance referred to by
83-<tracker_abbreviation>. This option can then be used together with ``bzr commit
84+<tracker>. This option can then be used together with ``bzr commit
85 --fixes`` to mark bugs in that tracker as being fixed by that commit. For
86 example::
87
88@@ -108,11 +111,11 @@
89 would allow ``bzr commit --fixes twisted:1234`` to mark Twisted's bug 1234 as
90 fixed.
91
92-bugtracker_<tracker_abbrevation>_url
93-------------------------------------
94+bugtracker_<tracker>_url
95+------------------------
96
97 If present, the location of a generic bug tracker instance referred to by
98-<tracker_abbreviation>. The location must contain an ``{id}`` placeholder,
99+<tracker>. The location must contain an ``{id}`` placeholder,
100 which will be replaced by a specific bug ID. This option can then be used
101 together with ``bzr commit --fixes`` to mark bugs in that tracker as being
102 fixed by that commit. For example::
103
104=== modified file 'bzrlib/bzrdir.py'
105--- bzrlib/bzrdir.py 2009-12-02 17:56:06 +0000
106+++ bzrlib/bzrdir.py 2010-01-04 08:49:20 +0000
107@@ -3513,7 +3513,7 @@
108 experimental_pairs.append((key, help))
109 else:
110 output += wrapped(key, help, info)
111- output += "\nSee ``bzr help formats`` for more about storage formats."
112+ output += "\nSee :doc:`formats-help` for more about storage formats."
113 other_output = ""
114 if len(experimental_pairs) > 0:
115 other_output += "Experimental formats are shown below.\n\n"
116@@ -3532,7 +3532,7 @@
117 other_output += \
118 "\nNo deprecated formats are available.\n\n"
119 other_output += \
120- "\nSee ``bzr help formats`` for more about storage formats."
121+ "\nSee :doc:`formats-help` for more about storage formats."
122
123 if topic == 'other-formats':
124 return other_output
125
126=== modified file 'bzrlib/commands.py'
127--- bzrlib/commands.py 2009-12-09 05:47:32 +0000
128+++ bzrlib/commands.py 2010-01-04 08:49:20 +0000
129@@ -511,8 +511,9 @@
130 # so don't create a real link
131 see_also_links.append(item)
132 else:
133- # Use a reST link for this entry
134- see_also_links.append("`%s`_" % (item,))
135+ # Use a Sphinx link for this entry
136+ link_text = ":doc:`%s <%s-help>`" % (item, item)
137+ see_also_links.append(link_text)
138 see_also = see_also_links
139 result += ':See also: '
140 result += ', '.join(see_also) + '\n'
141
142=== modified file 'bzrlib/conflicts.py'
143--- bzrlib/conflicts.py 2009-11-23 03:15:33 +0000
144+++ bzrlib/conflicts.py 2010-01-04 08:49:20 +0000
145@@ -58,7 +58,7 @@
146 Option('text',
147 help='List paths of files with text conflicts.'),
148 ]
149- _see_also = ['resolve']
150+ _see_also = ['resolve', 'conflict-types']
151
152 def run(self, text=False):
153 from bzrlib.workingtree import WorkingTree
154
155=== modified file 'bzrlib/doc_generate/autodoc_rstx.py'
156--- bzrlib/doc_generate/autodoc_rstx.py 2009-09-09 14:35:26 +0000
157+++ bzrlib/doc_generate/autodoc_rstx.py 2010-01-04 08:49:20 +0000
158@@ -14,7 +14,7 @@
159 # along with this program; if not, write to the Free Software
160 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
161
162-"""Generate ReStructuredText source for the User Reference Manual.
163+"""Generate reStructuredText source for the User Reference Manual.
164 Loosely based on the manpage generator autodoc_man.py.
165
166 Written by the Bazaar community.
167@@ -36,7 +36,7 @@
168 # ought to be prefixed with their section name as well so
169 # there's zero risk of clashing with a standard sphinx
170 # topic (like search.html).
171-FILE_PER_TOPIC = False
172+FILE_PER_TOPIC = True
173
174
175 def get_filename(options):
176@@ -74,8 +74,7 @@
177 output_dir=topic_dir))
178 result.append(_get_section(registry, SECT_LIST, "Lists",
179 output_dir=topic_dir))
180- result.append(_get_commands_section(registry))
181- #result.append(_get_section(registry, SECT_PLUGIN, "Standard Plug-ins"))
182+ result.append(_get_commands_section(registry, output_dir=topic_dir))
183 return "\n".join(result)
184
185
186@@ -86,8 +85,9 @@
187 If output_dir is not None, topics are dumped into text files there
188 during processing, as well as being included in the return result.
189 """
190- topics = sorted(registry.get_topics_for_section(section))
191 lines = [title, hdg_level1 * len(title), ""]
192+ if FILE_PER_TOPIC:
193+ lines.extend([".. toctree::", " :maxdepth: 1", ""])
194
195 # docutils treats section heading as implicit link target.
196 # But in some cases topic and heading are different, e.g.:
197@@ -102,56 +102,68 @@
198 # .. _topic: `heading`_
199 links_glue = []
200
201+ topics = sorted(registry.get_topics_for_section(section))
202 for topic in topics:
203 help = registry.get_detail(topic)
204- heading,text = help.split("\n", 1)
205- lines.append(heading)
206+ heading, text = help.split("\n", 1)
207 if not text.startswith(hdg_level2):
208- lines.append(hdg_level2 * len(heading))
209- lines.append(text)
210- lines.append('')
211+ underline = hdg_level2 * len(heading)
212+ help = "%s\n%s\n\n%s\n\n" % (heading, underline, text)
213+ else:
214+ help = "%s\n%s\n\n" % (heading, text)
215+ if FILE_PER_TOPIC:
216+ topic_id = _dump_text(output_dir, topic, help)
217+ lines.append(" %s" % topic_id)
218+ else:
219+ lines.append(help)
220+
221 # check that topic match heading
222 if topic != heading.lower():
223 links_glue.append((topic, heading))
224- # dump the text if requested
225- if output_dir is not None:
226- out_file = bzrlib.osutils.pathjoin(output_dir, topic + ".txt")
227- _dump_text(out_file, help)
228
229 # provide links glue for topics that don't match headings
230- lines.extend([".. _%s: `%s`_" % i for i in links_glue])
231- lines.append('')
232+ #lines.append('')
233+ #lines.extend([".. _%s: `%s`_" % i for i in links_glue])
234+ #lines.append('')
235
236 return "\n" + "\n".join(lines) + "\n"
237
238
239-def _dump_text(filename, text):
240- """Dump text to filename."""
241- if not FILE_PER_TOPIC:
242- return
243- f = open(filename, "w")
244- f.writelines(text)
245- f.close()
246-
247-
248 def _get_commands_section(registry, title="Commands", hdg_level1="#",
249- hdg_level2="="):
250+ hdg_level2="=", output_dir=None):
251 """Build the commands reference section of the manual."""
252 lines = [title, hdg_level1 * len(title), ""]
253+ if FILE_PER_TOPIC:
254+ lines.extend([".. toctree::", " :maxdepth: 1", ""])
255+
256 cmds = sorted(bzrlib.commands.builtin_command_names())
257 for cmd_name in cmds:
258 cmd_object = bzrlib.commands.get_cmd_object(cmd_name)
259 if cmd_object.hidden:
260 continue
261 heading = cmd_name
262+ underline = hdg_level2 * len(heading)
263 text = cmd_object.get_help_text(plain=False, see_also_as_links=True)
264- lines.append(heading)
265- lines.append(hdg_level2 * len(heading))
266- lines.append(text)
267- lines.append('')
268+ help = "%s\n%s\n\n%s\n\n" % (heading, underline, text)
269+ if FILE_PER_TOPIC:
270+ topic_id = _dump_text(output_dir, cmd_name, help)
271+ lines.append(" %s" % topic_id)
272+ else:
273+ lines.append(help)
274+
275 return "\n" + "\n".join(lines) + "\n"
276
277
278+def _dump_text(output_dir, topic, text):
279+ """Dump text for a topic to a file."""
280+ topic_id = "%s-%s" % (topic, "help")
281+ filename = bzrlib.osutils.pathjoin(output_dir, topic_id + ".txt")
282+ f = open(filename, "w")
283+ f.writelines(text)
284+ f.close()
285+ return topic_id
286+
287+
288 ##
289 # TEMPLATES
290
291@@ -194,8 +206,8 @@
292
293 The following web sites provide further information on Bazaar:
294
295-:Home page: http://www.bazaar-vcs.org/
296-:Official docs: http://doc.bazaar-vcs.org/
297+:Home page: http://bazaar.canonical.com/
298+:Official docs: http://doc.bazaar.canonical.com/
299 :Launchpad: https://launchpad.net/bzr/
300 """
301
302
303=== modified file 'bzrlib/help_topics/__init__.py'
304--- bzrlib/help_topics/__init__.py 2009-12-07 18:50:45 +0000
305+++ bzrlib/help_topics/__init__.py 2010-01-04 08:49:20 +0000
306@@ -306,7 +306,7 @@
307 """Global Options
308
309 These options may be used with any command, and may appear in front of any
310-command. (e.g. "bzr --profile help").
311+command. (e.g. ``bzr --profile help``).
312
313 --version Print the version number. Must be supplied before the command.
314 --no-aliases Do not process command aliases when running this command.
315@@ -325,9 +325,11 @@
316 will be a pickle.
317 --coverage Generate line coverage report in the specified directory.
318
319-See doc/developers/profiling.txt for more information on profiling.
320+See http://doc.bazaar.canonical.com/developers/profiling.html for more
321+information on profiling.
322+
323 A number of debug flags are also available to assist troubleshooting and
324-development. See `bzr help debug-flags`.
325+development. See :doc:`debug-flags-help`.
326 """
327
328 _standard_options = \
329@@ -647,7 +649,7 @@
330 differences.
331 """
332
333-_branches_out_of_sync = """Branches out of sync
334+_branches_out_of_sync = """Branches Out of Sync
335
336 When reconfiguring a checkout, tree or branch into a lightweight checkout,
337 a local branch must be destroyed. (For checkouts, this is the local branch
338@@ -682,18 +684,20 @@
339 project owner to upgrade.
340
341
342-Note: Some of the older formats have two variants:
343-a plain one and a rich-root one. The latter include an additional
344-field about the root of the tree. There is no performance cost
345-for using a rich-root format but you cannot easily merge changes
346-from a rich-root format into a plain format. As a consequence,
347-moving a project to a rich-root format takes some co-ordination
348-in that all contributors need to upgrade their repositories
349-around the same time. 2a and all future formats will be
350-implicitly rich-root.
351-
352-See ``bzr help current-formats`` for the complete list of
353-currently supported formats. See ``bzr help other-formats`` for
354+.. note::
355+
356+ Some of the older formats have two variants:
357+ a plain one and a rich-root one. The latter include an additional
358+ field about the root of the tree. There is no performance cost
359+ for using a rich-root format but you cannot easily merge changes
360+ from a rich-root format into a plain format. As a consequence,
361+ moving a project to a rich-root format takes some co-ordination
362+ in that all contributors need to upgrade their repositories
363+ around the same time. 2a and all future formats will be
364+ implicitly rich-root.
365+
366+See :doc:`current-formats-help` for the complete list of
367+currently supported formats. See :doc:`other-formats-help` for
368 descriptions of any available experimental and deprecated formats.
369 """
370
371@@ -742,14 +746,12 @@
372 'Information on configuring authentication')
373 topic_registry.register('configuration', _load_from_file,
374 'Details on the configuration settings available')
375-topic_registry.register('conflicts', _load_from_file,
376+topic_registry.register('conflict-types', _load_from_file,
377 'Types of conflicts and what to do about them')
378 topic_registry.register('debug-flags', _load_from_file,
379 'Options to show or record debug information')
380 topic_registry.register('log-formats', _load_from_file,
381 'Details on the logging formats available')
382-topic_registry.register('diverged-branches', _load_from_file,
383- 'How to fix diverged branches')
384
385
386 # Register concept topics.
387@@ -763,6 +765,9 @@
388 topic_registry.register('content-filters', _load_from_file,
389 'Conversion of content into/from working trees',
390 SECT_CONCEPT)
391+topic_registry.register('diverged-branches', _load_from_file,
392+ 'How to fix diverged branches',
393+ SECT_CONCEPT)
394 topic_registry.register('eol', _load_from_file,
395 'Information on end-of-line handling',
396 SECT_CONCEPT)
397
398=== modified file 'bzrlib/help_topics/en/authentication.txt'
399--- bzrlib/help_topics/en/authentication.txt 2008-05-09 16:40:21 +0000
400+++ bzrlib/help_topics/en/authentication.txt 2010-01-04 08:49:20 +0000
401@@ -110,10 +110,8 @@
402 File format
403 -----------
404
405-The general rules for `configuration files`_ apply except for the variable
406-policies.
407-
408-.. _configuration files: #configuration-settings
409+The general rules for :doc:`configuration files <configuration-help>`
410+apply except for the variable policies.
411
412 Each section describes an authentication definition.
413
414
415=== modified file 'bzrlib/help_topics/en/configuration.txt'
416--- bzrlib/help_topics/en/configuration.txt 2009-12-15 20:32:34 +0000
417+++ bzrlib/help_topics/en/configuration.txt 2010-01-04 08:49:20 +0000
418@@ -272,7 +272,7 @@
419 variable policies which don't apply.
420
421 For more information on the possible uses of the authentication configuration
422-file see `Authentication Settings`_.
423+file see :doc:`authentication-help`.
424
425
426 Common variable options
427
428=== renamed file 'bzrlib/help_topics/en/conflicts.txt' => 'bzrlib/help_topics/en/conflict-types.txt'
429--- bzrlib/help_topics/en/conflicts.txt 2009-11-25 16:42:55 +0000
430+++ bzrlib/help_topics/en/conflict-types.txt 2010-01-04 08:49:20 +0000
431@@ -1,5 +1,5 @@
432-Conflicts Types
433-===============
434+Conflict Types
435+==============
436
437 Some operations, like merge, revert and pull, modify the contents of your
438 working tree. These modifications are programmatically generated, and so they
439
440=== modified file 'bzrlib/help_topics/en/content-filters.txt'
441--- bzrlib/help_topics/en/content-filters.txt 2009-02-25 06:41:51 +0000
442+++ bzrlib/help_topics/en/content-filters.txt 2010-01-04 08:49:20 +0000
443@@ -65,8 +65,8 @@
444 Note: ``bzr commit`` does not implicitly apply write converters after
445 comitting files. If this makes sense for a given plugin providing
446 a content filter, the plugin can usually achieve this effect by using a
447-``start_commit`` or ``post_commit`` hook say. See ``bzr help hooks`` and
448-`Using hooks`_ in the Bazaar User Guide for more information on hooks.
449+``start_commit`` or ``post_commit`` hook say. See :doc:`hooks-help`
450+for more information on hooks.
451
452
453 Refreshing your working tree
454
455=== modified file 'bzrlib/help_topics/en/log-formats.txt'
456--- bzrlib/help_topics/en/log-formats.txt 2009-02-09 08:19:18 +0000
457+++ bzrlib/help_topics/en/log-formats.txt 2010-01-04 08:49:20 +0000
458@@ -1,4 +1,4 @@
459-Log formats
460+Log Formats
461 ===========
462
463 A log format controls how information about each revision is displayed.
464
465=== modified file 'bzrlib/help_topics/en/rules.txt'
466--- bzrlib/help_topics/en/rules.txt 2009-04-26 03:04:30 +0000
467+++ bzrlib/help_topics/en/rules.txt 2010-01-04 08:49:20 +0000
468@@ -16,8 +16,9 @@
469
470 Preferences like these are useful for commands and plugins wishing to
471 provide custom behaviour for selected files. For more information on
472-end of line conversion see ``bzr help eol``. Keyword support is provided
473-by the bzr-keywords plugin (http://launchpad.net/bzr-keywords).
474+end of line conversion see :doc:`eol-help`.
475+Keyword support is provided by the `keywords plugin
476+<http://doc.bazaar.canonical.com/plugins/en/keywords-plugin.html>`_.
477
478 Files
479 -----
480@@ -31,7 +32,9 @@
481 Patterns are ordered and searching stops as soon as one matches.
482 As a consequence, more explicit patterns should be placed towards
483 the top of the file. Rule patterns use exactly the same conventions
484-as ignore patterns. See ``bzr help patterns`` for details.
485-
486-Note: Patterns containing square brackets or spaces should be
487-surrounded in quotes to ensure they are correctly parsed.
488+as ignore patterns. See :doc:`patterns-help` for details.
489+
490+.. note::
491+
492+ Patterns containing square brackets or spaces should be
493+ surrounded in quotes to ensure they are correctly parsed.
494
495=== modified file 'bzrlib/hooks.py'
496--- bzrlib/hooks.py 2009-09-01 12:29:54 +0000
497+++ bzrlib/hooks.py 2010-01-04 08:49:20 +0000
498@@ -277,7 +277,7 @@
499
500 See `Using hooks`_ in the User Guide for examples.
501
502-.. _Using hooks: ../user-guide/index.html#using-hooks
503+.. _Using hooks: ../user-guide/hooks.html
504
505 The class that contains each hook is given before the hooks it supplies. For
506 instance, BranchHooks as the class is the hooks class for
507
508=== modified file 'doc/en/user-guide/hooks.txt'
509--- doc/en/user-guide/hooks.txt 2008-10-29 06:10:45 +0000
510+++ doc/en/user-guide/hooks.txt 2010-01-04 08:49:20 +0000
511@@ -8,18 +8,18 @@
512 perform actions before or after certain Bazaar operations. The operations
513 include ``commit``, ``push``, ``pull``, and ``uncommit``.
514 For a complete list of hooks and their parameters, see `Hooks
515-<../user-reference/bzr_man.html#hooks>`_ in the User Reference.
516+<../user-reference/hooks-help.html>`_ in the User Reference.
517
518 Most hooks are run on the client, but a few are run on the server. (Also
519-see the `bzr-push-and-update`_ plugin that handles one special case of
520+see the `push-and-update plugin`_ that handles one special case of
521 server-side operations.)
522
523-.. _bzr-push-and-update: https://launchpad.net/bzr-push-and-update/
524+.. _push-and-update plugin: http://doc.bazaar.canonical.com/plugins/en/push-and-update-plugin.html
525
526 Using hooks
527 -----------
528
529-To use a hook, you should `write a plugin <#writing-a-plugin>`_. Instead of
530+To use a hook, you should `write a plugin`_. Instead of
531 creating a new command, this plugin will define and install the hook. Here's
532 an example::
533
534@@ -33,6 +33,8 @@
535 branch.Branch.hooks.install_named_hook('post_push', post_push_hook,
536 'My post_push hook')
537
538+.. _write a plugin: http://doc.bazaar.canonical.com/plugins/en/plugin-development.html
539+
540 To use this example, create a file named ``push_hook.py``, and stick it in
541 ``plugins`` subdirectory of your configuration directory. (If you have never
542 installed any plugins, you may need to create the ``plugins`` directory).