You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by David James <ja...@gmail.com> on 2005/06/15 20:34:02 UTC

[PATCH] Simplify svnshell.rb example script and add documentation

This patch simplifies the svnshell.rb example script and adds documentation.

svnshell.rb:
  (SvnShell): Added lots of documentation. Got rid of the 'in_rev_mode'
    variable. We now test for txn.nil? instead. Switched style of 'case'
    statements so that when/else statements are indented.
  (SvnShell.initialize): Refactor some of the code into a get_youngest_rev
     method for getting the youngest revision of the repository
  (SvnShell.run): Check for cmd.nil? so that we skip entirely empty lines
  (SvnShell.dispatch): Capitalize first letter of error messages. Added a
    list of valid commands to the 'Unknown command' message.
  (SvnShell.do_cat): Renamed new_path variable to normalized_path.
  (SvnShell.do_cd): Renamed new_path variable to normalized_path.
  (SvnShell.do_ls): Output error message when directory entry is not
found for an existing file. Keep printing 'ls' output after
encountering file that does not exist (like the UNIX ls). Renamed
new_path variable to normalized_path.
  (SvnShell.do_settxn): Got rid of unnecessary new_root variable.
  (SvnShell.path_to_parts): Added 'return' statement to emphasize that the
    return value of this function is important
  (SvnShell.parse_path): Renamed to normalize_path. Added 'return' statement
    to emphasize that the return value of this function is important
  (SvnShell.path_landing): Renamed to find_landing_path. Simplified function
    by reimplementing it in a tail-recursive manner. Instead of modifying
    @path, we now return the value.


Cheers,

David

-- 
David James -- http://www.cs.toronto.edu/~james

Re: [PATCH] Simplify svnshell.rb example script (v2)

Posted by David James <ja...@gmail.com>.
On 6/16/05, Kouhei Sutou <ko...@cozmixng.org> wrote:
> > This patch simplifies the svnshell.rb example script and adds documentation.
> Could you split the patch into simplifying script patch and
> adding documentation patch?
Sure. It probably makes sense to do the 'simplifying script' patch
first since the changes to the script will affect the documentation.

I have removed all of the documentation and whitespace changes from my
patch. The new version is attached. Once you have decided which of my
changes to include, I will submit a new patch to add documentation.

* tools/examples/svnshell.rb:
 (SvnShell): Got rid of the 'in_rev_mode' variable. We now test for 
   txn.nil? instead.
 (SvnShell.initialize): Refactor some of the code into a 
   get_youngest_rev method for getting the youngest revision of the
   repository
 (SvnShell.run): Check for cmd.nil? so that we skip entirely empty
   commands
 (SvnShell.dispatch): Capitalize first letter of error messages. Added
   a list of valid commands to the 'Unknown command' message.
 (SvnShell.do_cat): Renamed new_path variable to normalized_path.
 (SvnShell.do_cd): Renamed new_path variable to normalized_path.
 (SvnShell.do_ls): Output error message when directory entry is not
   found for an existing file. Keep printing 'ls' output after
   encountering file that does not exist (like the UNIX ls). Renamed
   new_path variable to normalized_path.
 (SvnShell.do_settxn): Got rid of unnecessary new_root variable.
 (SvnShell.parse_path): Renamed to normalize_path.
 (SvnShell.parent_dir): Created new helper function for finding the
   parent directory of a specified path
 (SvnShell.path_landing): Renamed to find_landing_path. Simplified 
   function by reimplementing it in a tail-recursive manner. Instead
   of modifying @path, we now return the value.

Cheers,

David

-- 
David James -- http://www.cs.toronto.edu/~james

Re: [PATCH] Simplify svnshell.rb example script and add documentation

Posted by Kouhei Sutou <ko...@cozmixng.org>.
Hi,

In <df...@mail.gmail.com>
  "[PATCH] Simplify svnshell.rb example script and add documentation" on Wed, 15 Jun 2005 16:34:02 -0400,
  David James <ja...@gmail.com> wrote:

> This patch simplifies the svnshell.rb example script and adds documentation.

Could you split the patch into simplifying script patch and
adding documentation patch?

--
kou

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org