diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-04-03 16:50:53 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-04-03 16:50:53 +0000 |
commit | 14a2b7e9b5765de3145c63e22affee06f20e33fc (patch) | |
tree | d5b0c37014afec29837acf2fa64b780d2aa0fbe4 /lib | |
parent | f6ce427a00650e92f414dc3682e56348d549d7ea (diff) | |
download | redmine-14a2b7e9b5765de3145c63e22affee06f20e33fc.tar.gz redmine-14a2b7e9b5765de3145c63e22affee06f20e33fc.zip |
Verify rev and rev_to params format in RepositoriesController. And turn revision arguments into integers in SubversionAdapter.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1324 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib')
-rw-r--r-- | lib/redmine/scm/adapters/subversion_adapter.rb | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/redmine/scm/adapters/subversion_adapter.rb b/lib/redmine/scm/adapters/subversion_adapter.rb index 1e0320e2c..efbd3ba8e 100644 --- a/lib/redmine/scm/adapters/subversion_adapter.rb +++ b/lib/redmine/scm/adapters/subversion_adapter.rb @@ -62,7 +62,7 @@ module Redmine # or nil if the given path doesn't exist in the repository
def entries(path=nil, identifier=nil)
path ||= ''
- identifier = 'HEAD' unless identifier and identifier > 0
+ identifier = (identifier and identifier.to_i > 0) ? identifier.to_i : "HEAD"
entries = Entries.new
cmd = "#{SVN_BIN} list --xml #{target(path)}@#{identifier}"
cmd << credentials_string
@@ -94,8 +94,8 @@ module Redmine def revisions(path=nil, identifier_from=nil, identifier_to=nil, options={})
path ||= ''
- identifier_from = 'HEAD' unless identifier_from and identifier_from.to_i > 0
- identifier_to = 1 unless identifier_to and identifier_to.to_i > 0
+ identifier_from = (identifier_from and identifier_from.to_i > 0) ? identifier_from.to_i : "HEAD"
+ identifier_to = (identifier_to and identifier_to.to_i > 0) ? identifier_to.to_i : 1
revisions = Revisions.new
cmd = "#{SVN_BIN} log --xml -r #{identifier_from}:#{identifier_to}"
cmd << credentials_string
@@ -131,11 +131,9 @@ module Redmine def diff(path, identifier_from, identifier_to=nil, type="inline")
path ||= ''
- if identifier_to and identifier_to.to_i > 0
- identifier_to = identifier_to.to_i
- else
- identifier_to = identifier_from.to_i - 1
- end
+ identifier_from = (identifier_from and identifier_from.to_i > 0) ? identifier_from.to_i : ''
+ identifier_to = (identifier_to and identifier_to.to_i > 0) ? identifier_to.to_i : (identifier_from.to_i - 1)
+
cmd = "#{SVN_BIN} diff -r "
cmd << "#{identifier_to}:"
cmd << "#{identifier_from}"
|