Class: Svn
- Defined in:
- lib/vcs/svn.rb,
lib/vcs/diff.rb,
lib/vcs/list.rb,
lib/vcs/ignore.rb,
lib/vcs/status.rb,
lib/vcs/revision.rb
Overview
- Author
-
Nicolas Pouillard <[email protected]>.
- Copyright
-
Copyright © 2004, 2005 LRDE. All rights reserved.
- License
-
GNU General Public License (GPL).
- Revision
-
$Id: header 98 2004-09-29 12:07:43Z ertai $
Defined Under Namespace
Classes: Failure
Constant Summary
Constants inherited from Vcs
Vcs::Form, Vcs::IForm, Vcs::LogEntry, Vcs::MAIL, Vcs::Message, Vcs::NEWS, Vcs::Version
Instance Method Summary collapse
-
#diffw!(files_orig = [], options = {}) ⇒ Object
A diff only for your eyes.
-
#ignore!(files = [], options = {}) ⇒ Object
Add an ignore entry in the given path.
-
#initialize(aCmd = 'svn') ⇒ Svn
constructor
A new instance of Svn.
- #list!(files = [], options = {}, &block) ⇒ Object
- #revision!(*args) ⇒ Object
- #standard_option?(option_name) ⇒ Boolean
- #status(*args, &block) ⇒ Object
Methods inherited from Vcs
#add!, #back!, #check_diffstat, #check_env, #check_gnu_diff, #color_status!, #commit_failed, #committed?, #committing?, #concat_changelog!, #concat_changelog_failed, #delete!, #diffstat!, #diffw_base, #edit!, #edit_conflicts!, #edit_form!, #editing?, editor, env, full_email, fullname, #junk!, #last_changed_date!, #mail!, #mail_conf_checker, method_missing, #mk_changelog_entry!, #mk_form!, #mk_iform!, #mk_log_entry!, #mk_message!, #mk_message_entry!, #mk_yaml_log_entry!, #news!, #news_conf_checker, #news_failed, pager, #paginate!, #resolve_conflicts!, #script, #script!, #sending?, #spawn_status_entries, #status!, #url!
Constructor Details
#initialize(aCmd = 'svn') ⇒ Svn
Returns a new instance of Svn.
11 12 13 14 15 16 17 |
# File 'lib/vcs/svn.rb', line 11 def initialize ( aCmd='svn' ) super @@svn_option_controller ||= OptionController.new(Svn, @@options_specification + Vcs..to_a.join("\n")) self.option_controller = @@svn_option_controller end |
Instance Method Details
#diffw!(files_orig = [], options = {}) ⇒ Object
A diff only for your eyes
36 37 38 39 40 41 |
# File 'lib/vcs/diff.rb', line 36 def diffw! ( files_orig=[], ={} ) files = diffw_base(files_orig, ) return if files.empty? and not files_orig.empty? diff_! files, .merge(:diff_cmd => 'diff', :extensions => '-NPbuw') end |
#ignore!(files = [], options = {}) ⇒ Object
Add an ignore entry in the given path. Automatically determine the rep concerned with svn:ignore. Examples:
$ svn ignore my_subdir/'*.tex'
$ svn ignore ./foo.generated my_subdir/another/a_wrong_file
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/vcs/ignore.rb', line 14 def ignore! ( files=[], ={} ) files.each do |file| dir, base = file.to_path.split logger.info { "Add `#{base}' to svn:ignore of `#{dir}'"} data = propget(['svn:ignore', dir], :strict => true) data.output.open('a') { |f| f.puts base } propset!(['svn:ignore', dir], .merge(:quiet => true, :file => data.output)) data.clean end end |
#list!(files = [], options = {}, &block) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/vcs/list.rb', line 15 def list! ( files=[], ={}, &block ) if .has_key?(:do) or block \ or Vcs.categories.any? { |cat| .has_key?(cat) } action = [:do] .delete(:do) categories = [] Vcs.categories.each do |cat| if .has_key? cat categories << cat .delete(cat) end end inside_versioned = [] outside_versioned = [] if categories.empty? list_(files, ).output.read.each do |line| inside_versioned << line.chomp end else files << '.' if files.empty? files.each do |file| file.to_path.find do |path| if path.directory? if path.dirname.to_s == '.svn' elsif (path/'.svn').exist? inside_versioned << path else outside_versioned << path end Find.prune else inside_versioned << path end end end end path_list = PathList.new status(inside_versioned) do |se| path_list << se.file if categories.include? se.category end outside_versioned.each do |path| path_list << path if categories.include? Vcs.classify(path) end if action system "#{action} #{path_list}" elsif block block[path_list] else puts path_list end else list_!(files, ) end end |
#revision!(*args) ⇒ Object
12 13 14 |
# File 'lib/vcs/revision.rb', line 12 def revision! ( *args ) puts info(*args).read[/^Revision:\s+(\d+)/, 1] end |
#standard_option?(option_name) ⇒ Boolean
73 74 75 |
# File 'lib/vcs/svn.rb', line 73 def standard_option? ( option_name ) @@standard_options.include? option_name.to_sym end |
#status(*args, &block) ⇒ Object
93 94 95 96 |
# File 'lib/vcs/status.rb', line 93 def status ( *args, &block ) return status_(*args) if block.nil? spawn_status_entries(status_(*args), &block) end |