
https://svn.lrde.epita.fr/svn/lrdetools/trunk Index: ChangeLog from Nicolas Pouillard <ertai@lrde.epita.fr> Improve svn list. * vcs/lib/vcs/list.rb: New. * vcs/NEWS: Explain this feature. NEWS | 11 +++++++++++ lib/vcs/list.rb | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) Index: vcs/NEWS --- vcs/NEWS (revision 246) +++ vcs/NEWS (working copy) @@ -46,6 +46,17 @@ For this just add this "sign: false" to .vcs configuration file. However it's better to keep this option set. + * Commands: + - svn list: + - Now support category listing: + - list all junk files in foo: + svn list --junk foo + - list all precious, and unmasked files: + svn list --precious --unmask + - Action support (--do switch): + - svn list --junk --do rm + - svn list --precious --do wc + New in 0.3 2005-09-16: * The help command now show all commands including vcs ones. Index: vcs/lib/vcs/list.rb --- vcs/lib/vcs/list.rb (revision 0) +++ vcs/lib/vcs/list.rb (revision 0) @@ -0,0 +1,55 @@ +# Author:: Nicolas Pouillard <ertai@lrde.epita.fr>. +# Copyright:: Copyright (c) 2005 LRDE. All rights reserved. +# License:: Gnu General Public License. +# Revision:: $Id$ + +require 'vcs/svn' + +class Svn + + specific_options << '--do ACTION' + Vcs.categories.each do |name| + specific_options << "--#{name}" + end + + def list! ( files=[], options={}, &block ) + if options.has_key?(:do) or block \ + or Vcs.categories.any? { |cat| options.has_key?(cat) } + + action = options[:do] + options.delete(:do) + categories = [] + Vcs.categories.each do |cat| + if options.has_key? cat + categories << cat + options.delete(cat) + end + end + path_list = PathList.new + if categories.empty? + list_(files, options).output.read.each do |line| + path_list << line.chomp.to_path + end + else + files << '.' if files.empty? + files.each do |file| + file.to_path.find do |path| + Find.prune if path.to_s =~ /(\/|^)\.svn$/ + next if path.to_s == '.' + path_list << path if categories.include? Vcs.classify(path) + end + end + end + if action + system "#{action} #{path_list}" + elsif block + block[path_list] + else + puts path_list + end + else + list_!(files, options) + end + end + +end # class Svn Property changes on: vcs/lib/vcs/list.rb ___________________________________________________________________ Name: svn:keywords + Id