# HG changeset patch # User Bryan O'Sullivan # Date 1236664538 25200 # Node ID 27043f385f3fbcc4e2907c261c5f1481f12573bd # Parent 8a9c66da6fcb2e891261272f545c27833e67e39d Get autogeneration of examples more or less working. diff -r 8a9c66da6fcb -r 27043f385f3f en/00book.xml --- a/en/00book.xml Mon Mar 09 21:40:12 2009 -0700 +++ b/en/00book.xml Mon Mar 09 22:55:38 2009 -0700 @@ -30,6 +30,11 @@ %SHORTCUTS; + + + + +%AUTOSNIPPETS; ]> diff -r 8a9c66da6fcb -r 27043f385f3f en/Makefile --- a/en/Makefile Mon Mar 09 21:40:12 2009 -0700 +++ b/en/Makefile Mon Mar 09 22:55:38 2009 -0700 @@ -1,12 +1,5 @@ # This makefile requires GNU make. -sources := \ - 00book.tex \ - 99book.bib \ - 99defs.tex \ - app*.tex \ - ch*.tex - image-sources := \ feature-branches.dot \ filelog.svg \ diff -r 8a9c66da6fcb -r 27043f385f3f en/ch02-tour-basic.xml --- a/en/ch02-tour-basic.xml Mon Mar 09 21:40:12 2009 -0700 +++ b/en/ch02-tour-basic.xml Mon Mar 09 22:55:38 2009 -0700 @@ -104,7 +104,7 @@ that it prints isn't so important; it's whether it prints anything at all that we care about. - + &interaction.tour.version; Built-in help @@ -118,7 +118,7 @@ help on a specific command (as below), it prints more detailed information. - + &interaction.tour.help; For a more impressive level of detail (which you won't usually need) run hg help , because it creates an identical copy of an existing repository. - + &interaction.tour.clone; If our clone succeeded, we should now have a local directory called hello. This directory will contain some files. - + &interaction.tour.ls; These files have the same contents and history in our repository as they do in the repository we cloned. @@ -186,7 +186,7 @@ class="directory">.hg. This is where Mercurial keeps all of its metadata for the repository. - + &interaction.tour.ls-a; The contents of the .hg directory and its @@ -216,7 +216,7 @@ role="hg-cmd">hg log command gives us a view of history. - + &interaction.tour.log; By default, this command prints a brief paragraph of output for each change to the project that was recorded. In Mercurial @@ -324,7 +324,7 @@ either a revision number or a long-form changeset identifier, and you can provide as many revisions as you want. - + &interaction.tour.log-r; If you want to see the history of several revisions without having to list each one, you can use range @@ -332,7 +332,7 @@ want all revisions between abc and def, inclusive. - + &interaction.tour.log.range; Mercurial also honours the order in which you specify revisions, so hg log -r 2:4 @@ -353,7 +353,7 @@ role="hg-opt-global">--verbose) option gives you this extra detail. - + &interaction.tour.log-v; If you want to see both the description and content of a change, add the (or @@ -363,7 +363,7 @@ see section for an overview). - + &interaction.tour.log-vp; @@ -424,7 +424,7 @@ than cloning over the network, and cloning a local repository uses less disk space in most cases, too. - + &interaction.tour.reclone; As an aside, it's often good practice to keep a pristine copy of a remote repository around, @@ -446,13 +446,13 @@ sed; simply use your preferred text editor to do the same thing.) - + &interaction.tour.sed; Mercurial's hg status command will tell us what Mercurial knows about the files in the repository. - + &interaction.tour.status; The hg status command prints no output for some files, but a line starting with @@ -475,7 +475,7 @@ do this, we use the hg diff command. - + &interaction.tour.diff; @@ -598,7 +598,7 @@ printed by hg log after we've finished committing. - + &interaction.tour.commit; The editor that the hg commit command drops us into will contain an @@ -665,7 +665,7 @@ log, but it only displays the newest revision in the repository. - + &interaction.tour.tip; We refer to the newest revision in the repository as the tip revision, @@ -691,7 +691,7 @@ call our temporary repository hello-pull. - + &interaction.tour.clone-pull; We'll use the hg pull command to bring changes from would pull into the repository, without actually pulling the changes in. - + &interaction.tour.incoming; (Of course, someone could cause more changesets to appear in the repository that we @@ -718,7 +718,7 @@ pull command, and telling it which repository to pull from. - + &interaction.tour.pull; As you can see from the before-and-after output of hg update command to do this. - + &interaction.tour.update; It might seem a bit strange that hg pull doesn't update the working directory @@ -771,7 +771,7 @@ the hg parents command. - + &interaction.tour.parents; If you look back at figure , @@ -787,7 +787,7 @@ give a revision number or changeset ID to the hg update command. - + &interaction.tour.older; If you omit an explicit revision, hg update will update to the tip @@ -805,19 +805,19 @@ pull above, we'll create a temporary repository to push our changes into. - + &interaction.tour.clone-push; The hg outgoing command tells us what changes would be pushed into another repository. - + &interaction.tour.outgoing; And the hg push command does the actual push. - + &interaction.tour.push; As with hg pull, the - + &interaction.tour.push.nothing; Sharing changes over a network @@ -843,14 +843,14 @@ connection; simply pass in a URL instead of a local path. - + &interaction.tour.outgoing.net; In this example, we can see what changes we could push to the remote repository, but the repository is understandably not set up to let anonymous users push to it. - + &interaction.tour.push.net; diff -r 8a9c66da6fcb -r 27043f385f3f en/examples/auto-snippets.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/en/examples/auto-snippets.xml Mon Mar 09 22:55:38 2009 -0700 @@ -0,0 +1,218 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 8a9c66da6fcb -r 27043f385f3f en/examples/run-example --- a/en/examples/run-example Mon Mar 09 21:40:12 2009 -0700 +++ b/en/examples/run-example Mon Mar 09 22:55:38 2009 -0700 @@ -65,6 +65,8 @@ timeout = 10 + entities = dict.fromkeys(l.rstrip() for l in open('auto-snippets.xml')) + def __init__(self, name, verbose, keep_change): self.name = name self.verbose = verbose @@ -240,6 +242,11 @@ err |= self.rename_output(ofp_basename, ignore) if out: ofp_basename = '%s.%s' % (self.name, out) + norm = os.path.normpath(ofp_basename) + example.entities[ + '' + % (norm, norm)] = 1 read_hint = ofp_basename + ' ' ofp = open(result_name(ofp_basename + '.tmp'), 'w') @@ -348,11 +355,16 @@ sys.exit(exit) def main(path='.'): + if os.path.realpath(path).split(os.sep)[-1] != 'examples': + print >> sys.stderr, 'Not being run from the examples directory!' + sys.exit(1) + opts, args = getopt.getopt(sys.argv[1:], '?ahv', ['all', 'help', 'keep', 'verbose']) verbose = False run_all = False keep_change = False + for o, a in opts: if o in ('-h', '-?', '--help'): print_help(0) @@ -397,6 +409,11 @@ print >> open(os.path.join(path, '.run'), 'w'), time.asctime() else: print_help(1, msg='no test names given, and --all not provided') + + fp = open('auto-snippets.xml', 'w') + for key in sorted(example.entities.iterkeys()): + print >> fp, key + fp.close() return errs if __name__ == '__main__':