Class: Svn::Revision
- Includes:
- Comparable
- Defined in:
- lib/svn/revisions.rb
Defined Under Namespace
Modules: C
Instance Attribute Summary collapse
-
#num ⇒ Object
readonly
Returns the value of attribute num.
-
#repo ⇒ Object
readonly
Returns the value of attribute repo.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #author ⇒ Object
-
#diff(path, options = {}) ⇒ Object
diffs
path
with another revision. -
#initialize(ptr, repo, pool) ⇒ Revision
constructor
A new instance of Revision.
- #message ⇒ Object (also: #log)
- #timestamp ⇒ Object
- #to_i ⇒ Object
- #to_s ⇒ Object
Methods inherited from Root
Constructor Details
#initialize(ptr, repo, pool) ⇒ Revision
Returns a new instance of Revision.
18 19 20 21 22 23 |
# File 'lib/svn/revisions.rb', line 18 def initialize( ptr, repo, pool ) super( ptr ) @repo = repo @pool = pool @num = revnum end |
Instance Attribute Details
#num ⇒ Object (readonly)
Returns the value of attribute num.
15 16 17 |
# File 'lib/svn/revisions.rb', line 15 def num @num end |
#repo ⇒ Object (readonly)
Returns the value of attribute repo.
16 17 18 |
# File 'lib/svn/revisions.rb', line 16 def repo @repo end |
Instance Method Details
#<=>(other) ⇒ Object
29 30 31 |
# File 'lib/svn/revisions.rb', line 29 def <=>( other ) to_i <=> other.to_i end |
#author ⇒ Object
88 89 90 |
# File 'lib/svn/revisions.rb', line 88 def prop( AUTHOR_PROP_NAME ) end |
#diff(path, options = {}) ⇒ Object
diffs path
with another revision. if no revision is specified, the previous revision is used.
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/svn/revisions.rb', line 98 def diff( path, ={} ) raise Svn::Error, "cannot diff directory #{path}@#{to_s}" if dir? path other = [:with] if [:with].is_a? Root other = repo.revision([:with]) if [:with].is_a? Numeric other ||= repo.revision(to_i - 1) return other.diff( path, :with => self ) if other < self content = "" begin content = file_content_stream( path ).to_counted_string rescue Svn::Error => err raise if [:raise_errors] end other_content = "" begin other_content= other.file_content_stream( path ).to_counted_string rescue Svn::Error => err raise if [:raise_errors] end Diff.string_diff( content, other_content ).unified( :original_header => "#{path}@#{to_s}", :modified_header => "#{path}@#{other}" ) end |
#message ⇒ Object Also known as: log
83 84 85 |
# File 'lib/svn/revisions.rb', line 83 def prop( LOG_PROP_NAME ) end |
#timestamp ⇒ Object
92 93 94 |
# File 'lib/svn/revisions.rb', line 92 def Time.parse( prop( TIMESTAMP_PROP_NAME ) ) end |
#to_i ⇒ Object
25 26 27 |
# File 'lib/svn/revisions.rb', line 25 def to_i @num end |
#to_s ⇒ Object
127 128 129 |
# File 'lib/svn/revisions.rb', line 127 def to_s "r#{to_i}" end |