[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r1344825 - in /subversion/trunk/tools/dev/mergegraph: mergegraph.py save_as_sh.py

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: Thu, 31 May 2012 21:16:55 +0100 (BST)

Greg Stein wrote:

>On May 31, 2012 1:30 PM, <julianfoad_at_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)

OK, r1344888 for 'most
importantly, the """ that ends a multiline docstring should be
on a line by itself [...]'.  Anything further will have to wait till another day.

>> +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.

OK.  1344885.

>> +        raise 'unknown action: %s' % action
> This form of exception is deprecated. Please raise an instance of Exception (or of a subclass).

Agreed.  1344885.

- Julian
Received on 2012-05-31 22:17:30 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.