summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAustin Ziegler <austin@zieglers.ca>2020-06-22 22:57:30 -0400
committerGitHub <noreply@github.com>2020-06-22 22:57:30 -0400
commit8e8c721af5501f9213394d4ac1178b29f44a05d3 (patch)
treeea663c49d6a5c96c385d7427d3804750cbf353c5
parenta770e33feda0bcc1fac68f3268c62dfb7bef4fe2 (diff)
parent8d493fed05f4ebc5ad8d550254e79da034e6a575 (diff)
downloaddiff-lcs-8e8c721af5501f9213394d4ac1178b29f44a05d3.tar.gz
Merge pull request #54 from halostatue/hoe-3-18-support
Various updates for v 1.4
-rw-r--r--.travis.yml16
-rw-r--r--Gemfile3
-rw-r--r--History.md304
-rw-r--r--Rakefile21
-rw-r--r--diff-lcs.gemspec25
-rw-r--r--lib/diff/lcs.rb243
6 files changed, 304 insertions, 308 deletions
diff --git a/.travis.yml b/.travis.yml
index 49720ac..103bc09 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,20 +1,18 @@
---
language: ruby
rvm:
- - 2.6.0
- - 2.5.3
- - 2.4.5
- - 2.3.8
- - jruby-9.2.5.0
- - jruby-9.1.17.0
- - jruby-9.0.5.0
- - jruby-head
+ - 2.8.0-dev
+ - 2.7.1
+ - 2.6.6
+ - 2.5.8
+ - 2.4.10
+ - jruby-9.2.11.1
- ruby-head
- truffleruby
matrix:
allow_failures:
- - rvm: jruby-head
- rvm: ruby-head
+ - rvm: 2.8.0-dev
fast_finish: true
gemfile:
- Gemfile
diff --git a/Gemfile b/Gemfile
index ccc6276..eba7804 100644
--- a/Gemfile
+++ b/Gemfile
@@ -10,8 +10,7 @@ if RUBY_VERSION < '1.9'
gem 'rdoc', '< 4'
elsif RUBY_VERSION >= '2.0'
if RUBY_ENGINE == 'ruby'
- gem 'coveralls', '~> 0.7'
- gem 'simplecov', '~> 0.7'
+ gem 'simplecov', '~> 0.18'
end
end
diff --git a/History.md b/History.md
index fb0e99c..81a02d2 100644
--- a/History.md
+++ b/History.md
@@ -1,213 +1,217 @@
-## 1.4 / 2019-MM-DD
-
-* Ruby versions lower than 2.3 are soft-deprecated and will not be run as
- part of the CI process any longer.
-* Akinora MUSHA (knu) added the ability for Diff::LCS::Change objects to be
- implicitly treated arrays. Originally provided as pull request [#47][],
- but it introduced a number of test failures as documented in [#48][], and
- remediation of Diff::LCS itself was introduced in [#49][].
-* Resolved [#5][] with some tests comparing output from `system` calls to
- `bin/ldiff` with some pre-generated output. Resolved [#6][] with these
- tests.
-* Resolved a previously undetected `bin/ldiff` issue with `--context` output
- not matching `diff --context` output.
-* Resolved an issue with later versions of Ruby not working with an `OptParse`
- specification of `Numeric`; this has been changed to `Integer`.
+# History
+
+## 1.4 / 2020-06-23
+
+- Ruby versions lower than 2.4 are soft-deprecated and will not be run as
+ part of the CI process any longer.
+- Akinora MUSHA (knu) added the ability for Diff::LCS::Change objects to be
+ implicitly treated arrays. Originally provided as pull request [#47][],
+ but it introduced a number of test failures as documented in [#48][], and
+ remediation of Diff::LCS itself was introduced in [#49][].
+- Resolved [#5][] with some tests comparing output from `system` calls to
+ `bin/ldiff` with some pre-generated output. Resolved [#6][] with these
+ tests.
+- Resolved a previously undetected `bin/ldiff` issue with `--context` output
+ not matching `diff --context` output.
+- Resolved an issue with later versions of Ruby not working with an `OptParse`
+ specification of `Numeric`; this has been changed to `Integer`.
+- Brandon Fish added truffleruby in [#52][].
+- Fixed two missing classes as reported in [#53][].
## 1.3 / 2017-01-18
-* Bugs fixed:
+- Bugs fixed:
- * Fixed an error for bin/ldiff --version. Fixes issue [#21][].
- * Force Diff::LCS::Change and Diff::LCS::ContextChange to only perform
- equality comparisons against themselves. Provided by Kevin Mook in
- pull request [#29][].
- * Fix tab expansion in htmldiff, provided by Mark Friedgan in
- pull request [#25][].
- * Silence Ruby 2.4 Fixnum deprecation warnings. Fixxues issue [#38][] and
- [pull request#36][].
- * Ensure that test dependencies are loaded properly. Fixes issue [#33][]
- and pull request [#34][].
- * Fix issue [#1][] with incorrect intuition of patch direction. Tentative
- fix, but the previous failure cases pass now.
+ - Fixed an error for bin/ldiff --version. Fixes issue [#21][].
+ - Force Diff::LCS::Change and Diff::LCS::ContextChange to only perform
+ equality comparisons against themselves. Provided by Kevin Mook in
+ pull request [#29][].
+ - Fix tab expansion in htmldiff, provided by Mark Friedgan in
+ pull request [#25][].
+ - Silence Ruby 2.4 Fixnum deprecation warnings. Fixxues issue [#38][] and
+ [pull request#36][].
+ - Ensure that test dependencies are loaded properly. Fixes issue [#33][]
+ and pull request [#34][].
+ - Fix issue [#1][] with incorrect intuition of patch direction. Tentative
+ fix, but the previous failure cases pass now.
-* Tooling changes:
+- Tooling changes:
- * Added SimpleCov and Coveralls support.
- * Change the homepage (temporarily) to the GitHub repo.
- * Updated testing and gem infrastructure.
- * Modernized the specs.
+ - Added SimpleCov and Coveralls support.
+ - Change the homepage (temporarily) to the GitHub repo.
+ - Updated testing and gem infrastructure.
+ - Modernized the specs.
-* Cleaned up documentation.
+- Cleaned up documentation.
-* Added a Code of Conduct.
+- Added a Code of Conduct.
## 1.2.5 / 2013-11-08
-* Bugs fixed:
+- Bugs fixed:
- * Comparing arrays flattened them too far, especially with
- Diff::LCS.sdiff. Fixed by Josh Bronson in pull request [#23][].
+ - Comparing arrays flattened them too far, especially with
+ Diff::LCS.sdiff. Fixed by Josh Bronson in pull request [#23][].
## 1.2.4 / 2013-04-20
-* Bugs fixed:
+- Bugs fixed:
- * A bug was introduced after 1.1.3 when pruning common sequences at the
- start of comparison. Paul Kunysch (@pck) fixed this in
- pull request [#18][]. Thanks!
+ - A bug was introduced after 1.1.3 when pruning common sequences at the
+ start of comparison. Paul Kunysch (@pck) fixed this in
+ pull request [#18][]. Thanks!
- * The Rubinius (1.9 mode) bug in [rubinius/rubinius#2268][] has been
- fixed by the Rubinius team two days after it was filed. Thanks for
- fixing this so quickly!
+ - The Rubinius (1.9 mode) bug in [rubinius/rubinius#2268][] has been
+ fixed by the Rubinius team two days after it was filed. Thanks for
+ fixing this so quickly!
-* Switching to Raggi's hoe-gemspec2 for gemspec generation.
+- Switching to Raggi's hoe-gemspec2 for gemspec generation.
## 1.2.3 / 2013-04-11
-* Bugs Fixed:
+- Bugs Fixed:
- * The new encoding detection for diff output generation (added in 1.2.2)
- introduced a bug if the left side of the comparison was the empty set.
- Originally found in [rspec/rspec-expectations#238][] and
- [rspec/rspec-expectations#239][]. Jon Rowe developed a reasonable
- heuristic (left side, right side, empty string literal) to avoid this
- bug.
- * There is a known issue with Rubinius in 1.9 mode reported in
- [rubinius/rubinius#2268][] and demonstrated in the Travis CI builds.
- For all other tested platforms, diff-lcs is considered stable. As soon
- as a suitably small test-case can be created for the Rubinius team to
- examine, this will be added to the Rubinius issue around this.
+ - The new encoding detection for diff output generation (added in 1.2.2)
+ introduced a bug if the left side of the comparison was the empty set.
+ Originally found in [rspec/rspec-expectations#238][] and
+ [rspec/rspec-expectations#239][]. Jon Rowe developed a reasonable
+ heuristic (left side, right side, empty string literal) to avoid this
+ bug.
+ - There is a known issue with Rubinius in 1.9 mode reported in
+ [rubinius/rubinius#2268][] and demonstrated in the Travis CI builds.
+ For all other tested platforms, diff-lcs is considered stable. As soon
+ as a suitably small test-case can be created for the Rubinius team to
+ examine, this will be added to the Rubinius issue around this.
## 1.2.2 / 2013-03-30
-* Bugs Fixed:
+- Bugs Fixed:
- * Diff::LCS::Hunk could not properly generate a difference for comparison
- sets that are not US-ASCII-compatible because of the use of literal
- regular expressions and strings. Jon Rowe found this in
- [rspec/rspec-expectations#219][] and provided a first pass
- implementation in pull request [#15][]. I've reworked it because of
- test failures in Rubinius when running in Ruby 1.9 mode. This coerces
- the added values to the encoding of the old dataset (as determined by
- the first piece of the old dataset).
- * Adding Travis CI testing for Ruby 2.0.
+ - Diff::LCS::Hunk could not properly generate a difference for comparison
+ sets that are not US-ASCII-compatible because of the use of literal
+ regular expressions and strings. Jon Rowe found this in
+ [rspec/rspec-expectations#219][] and provided a first pass
+ implementation in pull request [#15][]. I've reworked it because of
+ test failures in Rubinius when running in Ruby 1.9 mode. This coerces
+ the added values to the encoding of the old dataset (as determined by
+ the first piece of the old dataset).
+ - Adding Travis CI testing for Ruby 2.0.
## 1.2.1 / 2013-02-09
-* Bugs Fixed:
+- Bugs Fixed:
- * As seen in [rspec/rspec-expectations#200][], the release of
- Diff::LCS 1.2 introduced an unnecessary public API change to
- Diff::LCS::Hunk (see the change at
- [rspec/rspec-expectations@3d6fc82c][] for details). The new method name
- (and behaviour) is more correct, but I should not have renamed the
- function or should have at least provided an alias. This release
- restores Diff::LCS::Hunk#unshift as an alias to #merge. Note that the
- old #unshift behaviour was incorrect and will not be restored.
+ - As seen in [rspec/rspec-expectations#200][], the release of
+ Diff::LCS 1.2 introduced an unnecessary public API change to
+ Diff::LCS::Hunk (see the change at
+ [rspec/rspec-expectations@3d6fc82c][] for details). The new method name
+ (and behaviour) is more correct, but I should not have renamed the
+ function or should have at least provided an alias. This release
+ restores Diff::LCS::Hunk#unshift as an alias to #merge. Note that the
+ old #unshift behaviour was incorrect and will not be restored.
## 1.2.0 / 2013-01-21
-* Minor Enhancements:
-
- * Added special case handling for Diff::LCS.patch so that it handles
- patches that are empty or contain no changes.
- * Added two new methods (#patch\_me and #unpatch\_me) to the includable
- module.
-
-* Bugs Fixed:
-
- * Fixed issue [#1][] patch direction detection.
- * Resolved issue [#2][] by handling `string[string.size, 1]` properly (it
- returns `""` not `nil`).
- * Michael Granger (ged) fixed an implementation error in
- Diff::LCS::Change and added specs in pull request [#8][]. Thanks!
- * Made the code auto-testable.
- * Vít Ondruch (voxik) provided the latest version of the GPL2 license
- file in pull request [#10][]. Thanks!
- * Fixed a documentation issue with the includable versions of #patch! and
- #unpatch! where they implied that they would replace the original
- value. Given that Diff::LCS.patch always returns a copy, the
- documentation was incorrect and has been corrected. To provide the
- behaviour that was originally documented, two new methods were added to
- provide this behaviour. Found by scooter-dangle in issue [#12][].
- Thanks!
-
-* Code Style Changes:
-
- * Removed trailing spaces.
- * Calling class methods using `.` instead of `::`.
- * Vít Ondruch (voxik) removed unnecessary shebangs in pull request [#9][].
- Thanks!
- * Kenichi Kamiya (kachick) removed some warnings of an unused variable in
- lucky pull request [#13][]. Thanks!
- * Embarked on a major refactoring to make the files a little more
- manageable and understand the code on a deeper level.
- * Adding to http://travis-ci.org.
+- Minor Enhancements:
+
+ - Added special case handling for Diff::LCS.patch so that it handles
+ patches that are empty or contain no changes.
+ - Added two new methods (#patch_me and #unpatch_me) to the includable
+ module.
+
+- Bugs Fixed:
+
+ - Fixed issue [#1][] patch direction detection.
+ - Resolved issue [#2][] by handling `string[string.size, 1]` properly (it
+ returns `""` not `nil`).
+ - Michael Granger (ged) fixed an implementation error in
+ Diff::LCS::Change and added specs in pull request [#8][]. Thanks!
+ - Made the code auto-testable.
+ - Vít Ondruch (voxik) provided the latest version of the GPL2 license
+ file in pull request [#10][]. Thanks!
+ - Fixed a documentation issue with the includable versions of #patch! and
+ #unpatch! where they implied that they would replace the original
+ value. Given that Diff::LCS.patch always returns a copy, the
+ documentation was incorrect and has been corrected. To provide the
+ behaviour that was originally documented, two new methods were added to
+ provide this behaviour. Found by scooter-dangle in issue [#12][].
+ Thanks!
+
+- Code Style Changes:
+
+ - Removed trailing spaces.
+ - Calling class methods using `.` instead of `::`.
+ - Vít Ondruch (voxik) removed unnecessary shebangs in pull request [#9][].
+ Thanks!
+ - Kenichi Kamiya (kachick) removed some warnings of an unused variable in
+ lucky pull request [#13][]. Thanks!
+ - Embarked on a major refactoring to make the files a little more
+ manageable and understand the code on a deeper level.
+ - Adding to http://travis-ci.org.
## 1.1.3 / 2011-08-27
-* Converted to 'hoe' for release.
-* Converted tests to RSpec 2.
-* Extracted the body of htmldiff into a class available from
- diff/lcs/htmldiff.
-* Migrated development and issue tracking to GitHub.
-* Bugs fixed:
+- Converted to 'hoe' for release.
+- Converted tests to RSpec 2.
+- Extracted the body of htmldiff into a class available from
+ diff/lcs/htmldiff.
+- Migrated development and issue tracking to GitHub.
+- Bugs fixed:
- * Eliminated the explicit use of RubyGems in both bin/htmldiff and
- bin/ldiff. Resolves issue [#4][].
- * Eliminated Ruby warnings. Resolves issue [#3][].
+ - Eliminated the explicit use of RubyGems in both bin/htmldiff and
+ bin/ldiff. Resolves issue [#4][].
+ - Eliminated Ruby warnings. Resolves issue [#3][].
## 1.1.2 / 2004-10-20
-* Fixed a problem reported by Mauricio Fernandez in htmldiff.
+- Fixed a problem reported by Mauricio Fernandez in htmldiff.
## 1.1.1 / 2004-09-25
-* Fixed bug #891 (Set returned from patch command does not contain last equal
- part).
-* Fixed a problem with callback initialisation code (it assumed that all
- callbacks passed as classes can be initialised; now, it rescues
- NoMethodError in the event of private :new being called).
-* Modified the non-initialisable callbacks to have a private #new method.
-* Moved ldiff core code to Diff::LCS::Ldiff (diff/lcs/ldiff.rb).
+- Fixed bug #891 (Set returned from patch command does not contain last equal
+ part).
+- Fixed a problem with callback initialisation code (it assumed that all
+ callbacks passed as classes can be initialised; now, it rescues
+ NoMethodError in the event of private :new being called).
+- Modified the non-initialisable callbacks to have a private #new method.
+- Moved ldiff core code to Diff::LCS::Ldiff (diff/lcs/ldiff.rb).
## 1.1.0 / -
-* Eliminated the need for Diff::LCS::Event and removed it.
-* Added a contextual diff callback, Diff::LCS::ContextDiffCallback.
-* Implemented patching/unpatching for standard Diff callback output formats
- with both #diff and #sdiff.
-* Extensive documentation changes.
+- Eliminated the need for Diff::LCS::Event and removed it.
+- Added a contextual diff callback, Diff::LCS::ContextDiffCallback.
+- Implemented patching/unpatching for standard Diff callback output formats
+ with both #diff and #sdiff.
+- Extensive documentation changes.
## 1.0.4
-* Fixed a problem with bin/ldiff output, especially for unified format.
- Newlines that should have been present weren't.
-* Changed the .tar.gz installer to generate Windows batch files if ones do
- not exist already. Removed the existing batch files as they didn't work.
+- Fixed a problem with bin/ldiff output, especially for unified format.
+ Newlines that should have been present weren't.
+- Changed the .tar.gz installer to generate Windows batch files if ones do
+ not exist already. Removed the existing batch files as they didn't work.
## 1.0.3
-* Fixed a problem with #traverse\_sequences where the first difference from
- the left sequence might not be appropriately captured.
+- Fixed a problem with #traverse_sequences where the first difference from
+ the left sequence might not be appropriately captured.
## 1.0.2
-* Fixed an issue with ldiff not working because actions were changed from
- symbols to strings.
+- Fixed an issue with ldiff not working because actions were changed from
+ symbols to strings.
## 1.0.1
-* Minor modifications to the gemspec, the README.
-* Renamed the diff program to ldiff (as well as the companion batch file) so
- as to not collide with the standard diff program.
-* Fixed issues with RubyGems. Requires RubyGems > 0.6.1 or >= 0.6.1 with the
- latest CVS version.
+- Minor modifications to the gemspec, the README.
+- Renamed the diff program to ldiff (as well as the companion batch file) so
+ as to not collide with the standard diff program.
+- Fixed issues with RubyGems. Requires RubyGems > 0.6.1 or >= 0.6.1 with the
+ latest CVS version.
## 1.0
-* Initial release based mostly on Perl's Algorithm::Diff.
+- Initial release based mostly on Perl's Algorithm::Diff.
[rubinius/rubinius#2268]: https://github.com/rubinius/rubinius/issues/2268
[rspec/rspec-expectations#239]: https://github.com/rspec/rspec-expectations/issues/239
@@ -239,3 +243,5 @@
[#47]: https://github.com/halostatue/diff-lcs/pull/47
[#48]: https://github.com/halostatue/diff-lcs/issues/48
[#49]: https://github.com/halostatue/diff-lcs/pull/49
+[#52]: https://github.com/halostatue/diff-lcs/pull/52
+[#53]: https://github.com/halostatue/diff-lcs/issues/53
diff --git a/Rakefile b/Rakefile
index 24edf0c..f712d45 100644
--- a/Rakefile
+++ b/Rakefile
@@ -26,23 +26,22 @@ _spec = Hoe.spec 'diff-lcs' do
extra_dev_deps << ['hoe-rubygems', '~> 1.0']
extra_dev_deps << ['hoe-travis', '~> 1.2']
extra_dev_deps << ['rspec', '>= 2.0', '< 4']
- extra_dev_deps << ['rake', '>= 10.0', '< 12']
+ extra_dev_deps << ['rake', '>= 10.0', '< 14']
extra_dev_deps << ['rdoc', '>= 0']
end
-task :test => :spec
+require "rspec/core/rake_task"
+
+desc "Run all specifications"
+RSpec::Core::RakeTask.new(:spec) do |t|
+ rspec_dirs = %w(spec lib)
+ t.rspec_opts = []
+ t.rspec_opts << "-I#{rspec_dirs.join(":")}" unless rspec_dirs.empty?
+end
+task :default => :spec
if RUBY_VERSION >= '2.0' && RUBY_ENGINE == 'ruby'
namespace :spec do
- task :coveralls do
- if ENV['CI'] or ENV['TRAVIS']
- ENV['COVERALLS'] = 'yes'
- Rake::Task['spec'].execute
- else
- Rake::Task['spec:coverage'].execute
- end
- end
-
desc "Runs test coverage. Only works Ruby 2.0+ and assumes 'simplecov' is installed."
task :coverage do
ENV['COVERAGE'] = 'yes'
diff --git a/diff-lcs.gemspec b/diff-lcs.gemspec
index f4e9284..17b7f24 100644
--- a/diff-lcs.gemspec
+++ b/diff-lcs.gemspec
@@ -6,19 +6,20 @@ Gem::Specification.new do |s|
s.version = "1.4"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
+ s.metadata = { "bug_tracker_uri" => "https://github.com/halostatue/diff-lcs/issues", "homepage_uri" => "https://github.com/halostatue/diff-lcs", "source_code_uri" => "https://github.com/halostatue/diff-lcs" } if s.respond_to? :metadata=
s.require_paths = ["lib".freeze]
s.authors = ["Austin Ziegler".freeze]
- s.date = "2019-01-28"
+ s.date = "2020-06-22"
s.description = "Diff::LCS computes the difference between two Enumerable sequences using the\nMcIlroy-Hunt longest common subsequence (LCS) algorithm. It includes utilities\nto create a simple HTML diff output format and a standard diff-like tool.\n\nThis is release 1.4, providing a simple extension that allows for\nDiff::LCS::Change objects to be treated implicitly as arrays. Ruby versions\nbelow 2.3 are soft-deprecated.\n\nThis means that older versions are no longer part of the CI test suite. If any\nchanges have been introduced that break those versions, bug reports and patches\nwill be accepted, but it will be up to the reporter to verify any fixes prior\nto release. A future release will completely break compatibility.".freeze
s.email = ["halostatue@gmail.com".freeze]
s.executables = ["htmldiff".freeze, "ldiff".freeze]
s.extra_rdoc_files = ["Code-of-Conduct.md".freeze, "Contributing.md".freeze, "History.md".freeze, "License.md".freeze, "Manifest.txt".freeze, "README.rdoc".freeze, "docs/COPYING.txt".freeze, "docs/artistic.txt".freeze]
- s.files = [".rspec".freeze, "Code-of-Conduct.md".freeze, "Contributing.md".freeze, "History.md".freeze, "License.md".freeze, "Manifest.txt".freeze, "README.rdoc".freeze, "Rakefile".freeze, "autotest/discover.rb".freeze, "bin/htmldiff".freeze, "bin/ldiff".freeze, "docs/COPYING.txt".freeze, "docs/artistic.txt".freeze, "lib/diff-lcs.rb".freeze, "lib/diff/lcs.rb".freeze, "lib/diff/lcs/array.rb".freeze, "lib/diff/lcs/backports.rb".freeze, "lib/diff/lcs/block.rb".freeze, "lib/diff/lcs/callbacks.rb".freeze, "lib/diff/lcs/change.rb".freeze, "lib/diff/lcs/htmldiff.rb".freeze, "lib/diff/lcs/hunk.rb".freeze, "lib/diff/lcs/internals.rb".freeze, "lib/diff/lcs/ldiff.rb".freeze, "lib/diff/lcs/string.rb".freeze, "spec/change_spec.rb".freeze, "spec/diff_spec.rb".freeze, "spec/fixtures/ds1.csv".freeze, "spec/fixtures/ds2.csv".freeze, "spec/hunk_spec.rb".freeze, "spec/issues_spec.rb".freeze, "spec/lcs_spec.rb".freeze, "spec/ldiff_spec.rb".freeze, "spec/patch_spec.rb".freeze, "spec/sdiff_spec.rb".freeze, "spec/spec_helper.rb".freeze, "spec/traverse_balanced_spec.rb".freeze, "spec/traverse_sequences_spec.rb".freeze]
+ s.files = [".rspec".freeze, "Code-of-Conduct.md".freeze, "Contributing.md".freeze, "History.md".freeze, "License.md".freeze, "Manifest.txt".freeze, "README.rdoc".freeze, "Rakefile".freeze, "autotest/discover.rb".freeze, "bin/htmldiff".freeze, "bin/ldiff".freeze, "docs/COPYING.txt".freeze, "docs/artistic.txt".freeze, "lib/diff-lcs.rb".freeze, "lib/diff/lcs.rb".freeze, "lib/diff/lcs/array.rb".freeze, "lib/diff/lcs/backports.rb".freeze, "lib/diff/lcs/block.rb".freeze, "lib/diff/lcs/callbacks.rb".freeze, "lib/diff/lcs/change.rb".freeze, "lib/diff/lcs/htmldiff.rb".freeze, "lib/diff/lcs/hunk.rb".freeze, "lib/diff/lcs/internals.rb".freeze, "lib/diff/lcs/ldiff.rb".freeze, "lib/diff/lcs/string.rb".freeze, "spec/change_spec.rb".freeze, "spec/diff_spec.rb".freeze, "spec/fixtures/aX".freeze, "spec/fixtures/bXaX".freeze, "spec/fixtures/ds1.csv".freeze, "spec/fixtures/ds2.csv".freeze, "spec/fixtures/ldiff/output.diff".freeze, "spec/fixtures/ldiff/output.diff-c".freeze, "spec/fixtures/ldiff/output.diff-e".freeze, "spec/fixtures/ldiff/output.diff-f".freeze, "spec/fixtures/ldiff/output.diff-u".freeze, "spec/hunk_spec.rb".freeze, "spec/issues_spec.rb".freeze, "spec/lcs_spec.rb".freeze, "spec/ldiff_spec.rb".freeze, "spec/patch_spec.rb".freeze, "spec/sdiff_spec.rb".freeze, "spec/spec_helper.rb".freeze, "spec/traverse_balanced_spec.rb".freeze, "spec/traverse_sequences_spec.rb".freeze]
s.homepage = "https://github.com/halostatue/diff-lcs".freeze
s.licenses = ["MIT".freeze, "Artistic-2.0".freeze, "GPL-2.0+".freeze]
s.rdoc_options = ["--main".freeze, "README.rdoc".freeze]
s.required_ruby_version = Gem::Requirement.new(">= 1.8".freeze)
- s.rubygems_version = "2.7.7".freeze
+ s.rubygems_version = "3.0.3".freeze
s.summary = "Diff::LCS computes the difference between two Enumerable sequences using the McIlroy-Hunt longest common subsequence (LCS) algorithm".freeze
if s.respond_to? :specification_version then
@@ -30,20 +31,20 @@ Gem::Specification.new do |s|
s.add_development_dependency(%q<hoe-git>.freeze, ["~> 1.6"])
s.add_development_dependency(%q<hoe-rubygems>.freeze, ["~> 1.0"])
s.add_development_dependency(%q<hoe-travis>.freeze, ["~> 1.2"])
- s.add_development_dependency(%q<rspec>.freeze, ["< 4", ">= 2.0"])
- s.add_development_dependency(%q<rake>.freeze, ["< 12", ">= 10.0"])
+ s.add_development_dependency(%q<rspec>.freeze, [">= 2.0", "< 4"])
+ s.add_development_dependency(%q<rake>.freeze, [">= 10.0", "< 14"])
s.add_development_dependency(%q<rdoc>.freeze, [">= 0"])
- s.add_development_dependency(%q<hoe>.freeze, ["~> 3.17"])
+ s.add_development_dependency(%q<hoe>.freeze, ["~> 3.22"])
else
s.add_dependency(%q<hoe-doofus>.freeze, ["~> 1.0"])
s.add_dependency(%q<hoe-gemspec2>.freeze, ["~> 1.1"])
s.add_dependency(%q<hoe-git>.freeze, ["~> 1.6"])
s.add_dependency(%q<hoe-rubygems>.freeze, ["~> 1.0"])
s.add_dependency(%q<hoe-travis>.freeze, ["~> 1.2"])
- s.add_dependency(%q<rspec>.freeze, ["< 4", ">= 2.0"])
- s.add_dependency(%q<rake>.freeze, ["< 12", ">= 10.0"])
+ s.add_dependency(%q<rspec>.freeze, [">= 2.0", "< 4"])
+ s.add_dependency(%q<rake>.freeze, [">= 10.0", "< 14"])
s.add_dependency(%q<rdoc>.freeze, [">= 0"])
- s.add_dependency(%q<hoe>.freeze, ["~> 3.17"])
+ s.add_dependency(%q<hoe>.freeze, ["~> 3.22"])
end
else
s.add_dependency(%q<hoe-doofus>.freeze, ["~> 1.0"])
@@ -51,9 +52,9 @@ Gem::Specification.new do |s|
s.add_dependency(%q<hoe-git>.freeze, ["~> 1.6"])
s.add_dependency(%q<hoe-rubygems>.freeze, ["~> 1.0"])
s.add_dependency(%q<hoe-travis>.freeze, ["~> 1.2"])
- s.add_dependency(%q<rspec>.freeze, ["< 4", ">= 2.0"])
- s.add_dependency(%q<rake>.freeze, ["< 12", ">= 10.0"])
+ s.add_dependency(%q<rspec>.freeze, [">= 2.0", "< 4"])
+ s.add_dependency(%q<rake>.freeze, [">= 10.0", "< 14"])
s.add_dependency(%q<rdoc>.freeze, [">= 0"])
- s.add_dependency(%q<hoe>.freeze, ["~> 3.17"])
+ s.add_dependency(%q<hoe>.freeze, ["~> 3.22"])
end
end
diff --git a/lib/diff/lcs.rb b/lib/diff/lcs.rb
index 773b4db..c4d1cc8 100644
--- a/lib/diff/lcs.rb
+++ b/lib/diff/lcs.rb
@@ -4,22 +4,21 @@ module Diff; end unless defined? Diff # rubocop:disable Style/Documentation
# == How Diff Works (by Mark-Jason Dominus)
#
-# I once read an article written by the authors of +diff+; they said that
-# they hard worked very hard on the algorithm until they found the right
-# one.
+# I once read an article written by the authors of +diff+; they said that they
+# hard worked very hard on the algorithm until they found the right one.
#
-# I think what they ended up using (and I hope someone will correct me,
-# because I am not very confident about this) was the `longest common
-# subsequence' method. In the LCS problem, you have two sequences of items:
+# I think what they ended up using (and I hope someone will correct me, because
+# I am not very confident about this) was the `longest common subsequence'
+# method. In the LCS problem, you have two sequences of items:
#
# a b c d f g h j q z
# a b c d e f g i j k r x y z
#
# and you want to find the longest sequence of items that is present in both
# original sequences in the same order. That is, you want to find a new
-# sequence *S* which can be obtained from the first sequence by deleting
-# some items, and from the second sequence by deleting other items. You also
-# want *S* to be as long as possible. In this case *S* is:
+# sequence *S* which can be obtained from the first sequence by deleting some
+# items, and from the second sequence by deleting other items. You also want
+# *S* to be as long as possible. In this case *S* is:
#
# a b c d f g j z
#
@@ -31,9 +30,9 @@ module Diff; end unless defined? Diff # rubocop:disable Style/Documentation
# This module solves the LCS problem. It also includes a canned function to
# generate +diff+-like output.
#
-# It might seem from the example above that the LCS of two sequences is
-# always pretty obvious, but that's not always the case, especially when the
-# two sequences have many repeated elements. For example, consider
+# It might seem from the example above that the LCS of two sequences is always
+# pretty obvious, but that's not always the case, especially when the two
+# sequences have many repeated elements. For example, consider
#
# a x b y c z p d q
# a b c a x b y c z
@@ -44,8 +43,8 @@ module Diff; end unless defined? Diff # rubocop:disable Style/Documentation
# a x b y c z p d q
# a b c a b y c z
#
-# This finds the common subsequence +a b c z+. But actually, the LCS is +a x
-# b y c z+:
+# This finds the common subsequence +a b c z+. But actually, the LCS is +a x b
+# y c z+:
#
# a x b y c z p d q
# a b c a x b y c z
@@ -58,15 +57,14 @@ require 'diff/lcs/internals'
module Diff::LCS # rubocop:disable Style/Documentation
# Returns an Array containing the longest common subsequence(s) between
- # +self+ and +other+. See Diff::LCS#LCS.
+ # +self+ and +other+. See Diff::LCS#lcs.
#
# lcs = seq1.lcs(seq2)
def lcs(other, &block) #:yields self[i] if there are matched subsequences:
Diff::LCS.lcs(self, other, &block)
end
- # Returns the difference set between +self+ and +other+. See
- # Diff::LCS#diff.
+ # Returns the difference set between +self+ and +other+. See Diff::LCS#diff.
def diff(other, callbacks = nil, &block)
Diff::LCS.diff(self, other, callbacks, &block)
end
@@ -80,29 +78,27 @@ module Diff::LCS # rubocop:disable Style/Documentation
# Traverses the discovered longest common subsequences between +self+ and
# +other+. See Diff::LCS#traverse_sequences.
def traverse_sequences(other, callbacks = nil, &block)
- traverse_sequences(self, other, callbacks ||
- Diff::LCS.YieldingCallbacks, &block)
+ traverse_sequences(self, other, callbacks || Diff::LCS::SequenceCallbacks, &block)
end
# Traverses the discovered longest common subsequences between +self+ and
# +other+ using the alternate, balanced algorithm. See
# Diff::LCS#traverse_balanced.
def traverse_balanced(other, callbacks = nil, &block)
- traverse_balanced(self, other, callbacks ||
- Diff::LCS.YieldingCallbacks, &block)
+ traverse_balanced(self, other, callbacks || Diff::LCS::BalancedCallbacks, &block)
end
- # Attempts to patch +self+ with the provided +patchset+. A new sequence
- # based on +self+ and the +patchset+ will be created. See Diff::LCS#patch.
- # Attempts to autodiscover the direction of the patch.
+ # Attempts to patch +self+ with the provided +patchset+. A new sequence based
+ # on +self+ and the +patchset+ will be created. See Diff::LCS#patch. Attempts
+ # to autodiscover the direction of the patch.
def patch(patchset)
Diff::LCS.patch(self, patchset)
end
alias unpatch patch
- # Attempts to patch +self+ with the provided +patchset+. A new sequence
- # based on +self+ and the +patchset+ will be created. See Diff::LCS#patch.
- # Does no patch direction autodiscovery.
+ # Attempts to patch +self+ with the provided +patchset+. A new sequence based
+ # on +self+ and the +patchset+ will be created. See Diff::LCS#patch. Does no
+ # patch direction autodiscovery.
def patch!(patchset)
Diff::LCS.patch!(self, patchset)
end
@@ -115,8 +111,8 @@ module Diff::LCS # rubocop:disable Style/Documentation
end
# Attempts to patch +self+ with the provided +patchset+, using #patch!. If
- # the sequence this is used on supports #replace, the value of +self+ will
- # be replaced. See Diff::LCS#patch. Does no patch direction autodiscovery.
+ # the sequence this is used on supports #replace, the value of +self+ will be
+ # replaced. See Diff::LCS#patch. Does no patch direction autodiscovery.
def patch_me(patchset)
if respond_to? :replace
replace(patch!(patchset))
@@ -125,10 +121,9 @@ module Diff::LCS # rubocop:disable Style/Documentation
end
end
- # Attempts to unpatch +self+ with the provided +patchset+, using
- # #unpatch!. If the sequence this is used on supports #replace, the value
- # of +self+ will be replaced. See Diff::LCS#unpatch. Does no patch direction
- # autodiscovery.
+ # Attempts to unpatch +self+ with the provided +patchset+, using #unpatch!.
+ # If the sequence this is used on supports #replace, the value of +self+ will
+ # be replaced. See Diff::LCS#unpatch. Does no patch direction autodiscovery.
def unpatch_me(patchset)
if respond_to? :replace
replace(unpatch!(patchset))
@@ -155,14 +150,14 @@ class << Diff::LCS
alias LCS lcs
# #diff computes the smallest set of additions and deletions necessary to
- # turn the first sequence into the second, and returns a description of
- # these changes.
+ # turn the first sequence into the second, and returns a description of these
+ # changes.
#
# See Diff::LCS::DiffCallbacks for the default behaviour. An alternate
# behaviour may be implemented with Diff::LCS::ContextDiffCallbacks. If a
# Class argument is provided for +callbacks+, #diff will attempt to
- # initialise it. If the +callbacks+ object (possibly initialised) responds
- # to #finish, it will be called.
+ # initialise it. If the +callbacks+ object (possibly initialised) responds to
+ # #finish, it will be called.
def diff(seq1, seq2, callbacks = nil, &block) # :yields diff changes:
diff_traversal(:diff, seq1, seq2, callbacks || Diff::LCS::DiffCallbacks, &block)
end
@@ -179,8 +174,8 @@ class << Diff::LCS
# See Diff::LCS::SDiffCallbacks for the default behaviour. An alternate
# behaviour may be implemented with Diff::LCS::ContextDiffCallbacks. If a
# Class argument is provided for +callbacks+, #diff will attempt to
- # initialise it. If the +callbacks+ object (possibly initialised) responds
- # to #finish, it will be called.
+ # initialise it. If the +callbacks+ object (possibly initialised) responds to
+ # #finish, it will be called.
#
# Each element of a returned array is a Diff::LCS::ContextChange object,
# which can be implicitly converted to an array.
@@ -199,11 +194,11 @@ class << Diff::LCS
diff_traversal(:sdiff, seq1, seq2, callbacks || Diff::LCS::SDiffCallbacks, &block)
end
- # #traverse_sequences is the most general facility provided by this
- # module; #diff and #lcs are implemented as calls to it.
+ # #traverse_sequences is the most general facility provided by this module;
+ # #diff and #lcs are implemented as calls to it.
#
- # The arguments to #traverse_sequences are the two sequences to traverse,
- # and a callback object, like this:
+ # The arguments to #traverse_sequences are the two sequences to traverse, and
+ # a callback object, like this:
#
# traverse_sequences(seq1, seq2, Diff::LCS::ContextDiffCallbacks.new)
#
@@ -231,55 +226,54 @@ class << Diff::LCS
# ^
# b---+
#
- # If there are two arrows (+a+ and +b+) pointing to elements of sequences
- # +A+ and +B+, the arrows will initially point to the first elements of
- # their respective sequences. #traverse_sequences will advance the arrows
- # through the sequences one element at a time, calling a method on the
- # user-specified callback object before each advance. It will advance the
- # arrows in such a way that if there are elements <tt>A[i]</tt> and
- # <tt>B[j]</tt> which are both equal and part of the longest common
- # subsequence, there will be some moment during the execution of
- # #traverse_sequences when arrow +a+ is pointing to <tt>A[i]</tt> and
- # arrow +b+ is pointing to <tt>B[j]</tt>. When this happens,
- # #traverse_sequences will call <tt>callbacks#match</tt> and then it will
- # advance both arrows.
- #
- # Otherwise, one of the arrows is pointing to an element of its sequence
- # that is not part of the longest common subsequence. #traverse_sequences
- # will advance that arrow and will call <tt>callbacks#discard_a</tt> or
- # <tt>callbacks#discard_b</tt>, depending on which arrow it advanced. If
- # both arrows point to elements that are not part of the longest common
- # subsequence, then #traverse_sequences will advance one of them and call
- # the appropriate callback, but it is not specified which it will call.
- #
- # The methods for <tt>callbacks#match</tt>, <tt>callbacks#discard_a</tt>,
- # and <tt>callbacks#discard_b</tt> are invoked with an event comprising
- # the action ("=", "+", or "-", respectively), the indicies +i+ and +j+,
- # and the elements <tt>A[i]</tt> and <tt>B[j]</tt>. Return values are
- # discarded by #traverse_sequences.
+ # If there are two arrows (+a+ and +b+) pointing to elements of sequences +A+
+ # and +B+, the arrows will initially point to the first elements of their
+ # respective sequences. #traverse_sequences will advance the arrows through
+ # the sequences one element at a time, calling a method on the user-specified
+ # callback object before each advance. It will advance the arrows in such a
+ # way that if there are elements <tt>A[i]</tt> and <tt>B[j]</tt> which are
+ # both equal and part of the longest common subsequence, there will be some
+ # moment during the execution of #traverse_sequences when arrow +a+ is
+ # pointing to <tt>A[i]</tt> and arrow +b+ is pointing to <tt>B[j]</tt>. When
+ # this happens, #traverse_sequences will call <tt>callbacks#match</tt> and
+ # then it will advance both arrows.
+ #
+ # Otherwise, one of the arrows is pointing to an element of its sequence that
+ # is not part of the longest common subsequence. #traverse_sequences will
+ # advance that arrow and will call <tt>callbacks#discard_a</tt> or
+ # <tt>callbacks#discard_b</tt>, depending on which arrow it advanced. If both
+ # arrows point to elements that are not part of the longest common
+ # subsequence, then #traverse_sequences will advance one of them and call the
+ # appropriate callback, but it is not specified which it will call.
+ #
+ # The methods for <tt>callbacks#match</tt>, <tt>callbacks#discard_a</tt>, and
+ # <tt>callbacks#discard_b</tt> are invoked with an event comprising the
+ # action ("=", "+", or "-", respectively), the indicies +i+ and +j+, and the
+ # elements <tt>A[i]</tt> and <tt>B[j]</tt>. Return values are discarded by
+ # #traverse_sequences.
#
# === End of Sequences
#
# If arrow +a+ reaches the end of its sequence before arrow +b+ does,
- # #traverse_sequence will try to call <tt>callbacks#finished_a</tt> with
- # the last index and element of +A+ (<tt>A[-1]</tt>) and the current index
- # and element of +B+ (<tt>B[j]</tt>). If <tt>callbacks#finished_a</tt>
- # does not exist, then <tt>callbacks#discard_b</tt> will be called on each
- # element of +B+ until the end of the sequence is reached (the call will
- # be done with <tt>A[-1]</tt> and <tt>B[j]</tt> for each element).
+ # #traverse_sequence will try to call <tt>callbacks#finished_a</tt> with the
+ # last index and element of +A+ (<tt>A[-1]</tt>) and the current index and
+ # element of +B+ (<tt>B[j]</tt>). If <tt>callbacks#finished_a</tt> does not
+ # exist, then <tt>callbacks#discard_b</tt> will be called on each element of
+ # +B+ until the end of the sequence is reached (the call will be done with
+ # <tt>A[-1]</tt> and <tt>B[j]</tt> for each element).
#
# If +b+ reaches the end of +B+ before +a+ reaches the end of +A+,
# <tt>callbacks#finished_b</tt> will be called with the current index and
# element of +A+ (<tt>A[i]</tt>) and the last index and element of +B+
- # (<tt>A[-1]</tt>). Again, if <tt>callbacks#finished_b</tt> does not exist
- # on the callback object, then <tt>callbacks#discard_a</tt> will be called
- # on each element of +A+ until the end of the sequence is reached
- # (<tt>A[i]</tt> and <tt>B[-1]</tt>).
+ # (<tt>A[-1]</tt>). Again, if <tt>callbacks#finished_b</tt> does not exist on
+ # the callback object, then <tt>callbacks#discard_a</tt> will be called on
+ # each element of +A+ until the end of the sequence is reached (<tt>A[i]</tt>
+ # and <tt>B[-1]</tt>).
#
# There is a chance that one additional <tt>callbacks#discard_a</tt> or
- # <tt>callbacks#discard_b</tt> will be called after the end of the
- # sequence is reached, if +a+ has not yet reached the end of +A+ or +b+
- # has not yet reached the end of +B+.
+ # <tt>callbacks#discard_b</tt> will be called after the end of the sequence
+ # is reached, if +a+ has not yet reached the end of +A+ or +b+ has not yet
+ # reached the end of +B+.
def traverse_sequences(seq1, seq2, callbacks = Diff::LCS::SequenceCallbacks) #:yields change events:
callbacks ||= Diff::LCS::SequenceCallbacks
matches = Diff::LCS::Internals.lcs(seq1, seq2)
@@ -323,8 +317,8 @@ class << Diff::LCS
end
ai += 1
- # The last entry (if any) processed was a match. +ai+ and +bj+ point
- # just past the last matching lines in their sequences.
+ # The last entry (if any) processed was a match. +ai+ and +bj+ point just
+ # past the last matching lines in their sequences.
while (ai < a_size) or (bj < b_size)
# last A?
if ai == a_size and bj < b_size
@@ -391,13 +385,13 @@ class << Diff::LCS
end
# #traverse_balanced is an alternative to #traverse_sequences. It uses a
- # different algorithm to iterate through the entries in the computed
- # longest common subsequence. Instead of viewing the changes as insertions
- # or deletions from one of the sequences, #traverse_balanced will report
+ # different algorithm to iterate through the entries in the computed longest
+ # common subsequence. Instead of viewing the changes as insertions or
+ # deletions from one of the sequences, #traverse_balanced will report
# <em>changes</em> between the sequences.
#
- # The arguments to #traverse_balanced are the two sequences to traverse
- # and a callback object, like this:
+ # The arguments to #traverse_balanced are the two sequences to traverse and a
+ # callback object, like this:
#
# traverse_balanced(seq1, seq2, Diff::LCS::ContextDiffCallbacks.new)
#
@@ -433,24 +427,23 @@ class << Diff::LCS
#
# === Matches
#
- # If there are two arrows (+a+ and +b+) pointing to elements of sequences
- # +A+ and +B+, the arrows will initially point to the first elements of
- # their respective sequences. #traverse_sequences will advance the arrows
- # through the sequences one element at a time, calling a method on the
- # user-specified callback object before each advance. It will advance the
- # arrows in such a way that if there are elements <tt>A[i]</tt> and
- # <tt>B[j]</tt> which are both equal and part of the longest common
- # subsequence, there will be some moment during the execution of
- # #traverse_sequences when arrow +a+ is pointing to <tt>A[i]</tt> and
- # arrow +b+ is pointing to <tt>B[j]</tt>. When this happens,
- # #traverse_sequences will call <tt>callbacks#match</tt> and then it will
- # advance both arrows.
+ # If there are two arrows (+a+ and +b+) pointing to elements of sequences +A+
+ # and +B+, the arrows will initially point to the first elements of their
+ # respective sequences. #traverse_sequences will advance the arrows through
+ # the sequences one element at a time, calling a method on the user-specified
+ # callback object before each advance. It will advance the arrows in such a
+ # way that if there are elements <tt>A[i]</tt> and <tt>B[j]</tt> which are
+ # both equal and part of the longest common subsequence, there will be some
+ # moment during the execution of #traverse_sequences when arrow +a+ is
+ # pointing to <tt>A[i]</tt> and arrow +b+ is pointing to <tt>B[j]</tt>. When
+ # this happens, #traverse_sequences will call <tt>callbacks#match</tt> and
+ # then it will advance both arrows.
#
# === Discards
#
- # Otherwise, one of the arrows is pointing to an element of its sequence
- # that is not part of the longest common subsequence. #traverse_sequences
- # will advance that arrow and will call <tt>callbacks#discard_a</tt> or
+ # Otherwise, one of the arrows is pointing to an element of its sequence that
+ # is not part of the longest common subsequence. #traverse_sequences will
+ # advance that arrow and will call <tt>callbacks#discard_a</tt> or
# <tt>callbacks#discard_b</tt>, depending on which arrow it advanced.
#
# === Changes
@@ -464,14 +457,14 @@ class << Diff::LCS
#
# The methods for <tt>callbacks#match</tt>, <tt>callbacks#discard_a</tt>,
# <tt>callbacks#discard_b</tt>, and <tt>callbacks#change</tt> are invoked
- # with an event comprising the action ("=", "+", "-", or "!",
- # respectively), the indicies +i+ and +j+, and the elements
- # <tt>A[i]</tt> and <tt>B[j]</tt>. Return values are discarded by
- # #traverse_balanced.
+ # with an event comprising the action ("=", "+", "-", or "!", respectively),
+ # the indicies +i+ and +j+, and the elements <tt>A[i]</tt> and <tt>B[j]</tt>.
+ # Return values are discarded by #traverse_balanced.
#
# === Context
- # Note that +i+ and +j+ may not be the same index position, even if +a+
- # and +b+ are considered to be pointing to matching or changed elements.
+ #
+ # Note that +i+ and +j+ may not be the same index position, even if +a+ and
+ # +b+ are considered to be pointing to matching or changed elements.
def traverse_balanced(seq1, seq2, callbacks = Diff::LCS::BalancedCallbacks)
matches = Diff::LCS::Internals.lcs(seq1, seq2)
a_size = seq1.size
@@ -592,23 +585,23 @@ class << Diff::LCS
#
# patch(s1, diff(s1, s2)) -> s2
#
- # A +patchset+ can be considered to apply backward (<tt>:unpatch</tt>) if
- # the following expression is true:
+ # A +patchset+ can be considered to apply backward (<tt>:unpatch</tt>) if the
+ # following expression is true:
#
# patch(s2, diff(s1, s2)) -> s1
#
- # If the +patchset+ contains no changes, the +src+ value will be returned
- # as either <tt>src.dup</tt> or +src+. A +patchset+ can be deemed as
- # having no changes if the following predicate returns true:
+ # If the +patchset+ contains no changes, the +src+ value will be returned as
+ # either <tt>src.dup</tt> or +src+. A +patchset+ can be deemed as having no
+ # changes if the following predicate returns true:
#
# patchset.empty? or
# patchset.flatten(1).all? { |change| change.unchanged? }
#
# === Patchsets
#
- # A +patchset+ is always an enumerable sequence of changes, hunks of
- # changes, or a mix of the two. A hunk of changes is an enumerable
- # sequence of changes:
+ # A +patchset+ is always an enumerable sequence of changes, hunks of changes,
+ # or a mix of the two. A hunk of changes is an enumerable sequence of
+ # changes:
#
# [ # patchset
# # change
@@ -617,9 +610,9 @@ class << Diff::LCS
# ]
# ]
#
- # The +patch+ method accepts <tt>patchset</tt>s that are enumerable
- # sequences containing either Diff::LCS::Change objects (or a subclass) or
- # the array representations of those objects. Prior to application, array
+ # The +patch+ method accepts <tt>patchset</tt>s that are enumerable sequences
+ # containing either Diff::LCS::Change objects (or a subclass) or the array
+ # representations of those objects. Prior to application, array
# representations of Diff::LCS::Change objects will be reified.
def patch(src, patchset, direction = nil)
# Normalize the patchset.
@@ -723,14 +716,14 @@ class << Diff::LCS
res
end
- # Given a set of patchset, convert the current version to the prior
- # version. Does no auto-discovery.
+ # Given a set of patchset, convert the current version to the prior version.
+ # Does no auto-discovery.
def unpatch!(src, patchset)
patch(src, patchset, :unpatch)
end
- # Given a set of patchset, convert the current version to the next
- # version. Does no auto-discovery.
+ # Given a set of patchset, convert the current version to the next version.
+ # Does no auto-discovery.
def patch!(src, patchset)
patch(src, patchset, :patch)
end