On May 31, 2012 1:30 PM, <julianf...@apache.org> wrote: >... > +++ subversion/trunk/tools/dev/mergegraph/save_as_sh.py Thu May 31 17:30:17 2012 >... > +def command(out, cmd, *args): > + """Write the shell command CMD with the arguments ARGS to the file-like > + object OUT."""
Please review my earlier comments about standard docstring formatting in Python. More specifically, PEP 8. (Google it) >... > +def write_recipe(graph, out): > + """Write out a sequence of svn commands that will execute the branching > + and merging shown in GRAPH. Write to the file-like object OUT.""" > + revs = {} # keyed by revnum > + > + def node_branch(node_name): > + """Extract branch name from a node name. > + ### TODO: multi-char names.""" > + return node_name[:1] > + > + def node_url(node_name): > + """Extract the URL (in command-line repo-relative URL syntax) from a > + node name.""" > + return '^/' + node_branch(node_name) > + > + def node_rev(node_name): > + """Extract revnum (as an integer) from a node name. > + ### TODO: multi-char names.""" > + return int(node_name[1:]) + 1 > + > + def add(node_name, action, *args): > + """Add the tuple (ACTION, (ARGS)) to the list REVS[REVNUM].""" > + revnum = node_rev(node_name) > + if not revnum in revs: > + revs[revnum] = [] > + revs[revnum].append((action, args)) There is no need to embed these functions. It makes write_recipe() less clear to have this clutter in here. >... > + raise 'unknown action: %s' % action This form of exception is deprecated. Please raise an instance of Exception (or of a subclass). >... Cheers, -g