summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-01-23 04:17:26 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-01-23 04:17:26 +0000
commite173f7e72dff82dfe55656a0ea0b7cf25f0c45de (patch)
tree2c66d4fa051a65bd8f41712b108e480b037212c4
parentabd2762aede80ad9fd5cb984d66690bd74804567 (diff)
downloadredmine-e173f7e72dff82dfe55656a0ea0b7cf25f0c45de.tar.gz
redmine-e173f7e72dff82dfe55656a0ea0b7cf25f0c45de.zip
scm: darcs: fix Darcs adapter recognizes new files as modified files above Darcs 2.4 (#7415).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4749 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--lib/redmine/scm/adapters/darcs_adapter.rb31
1 files changed, 30 insertions, 1 deletions
diff --git a/lib/redmine/scm/adapters/darcs_adapter.rb b/lib/redmine/scm/adapters/darcs_adapter.rb
index 1b78f77a8..69805a360 100644
--- a/lib/redmine/scm/adapters/darcs_adapter.rb
+++ b/lib/redmine/scm/adapters/darcs_adapter.rb
@@ -167,9 +167,38 @@ module Redmine
})
})
end
+
+ def get_paths_for_patch(hash)
+ paths = get_paths_for_patch_raw(hash)
+ if self.class.client_version_above?([2, 4])
+ orig_paths = paths
+ paths = []
+ add_paths = []
+ add_paths_name = []
+ mod_paths = []
+ other_paths = []
+ orig_paths.each do |path|
+ if path[:action] == 'A'
+ add_paths << path
+ add_paths_name << path[:path]
+ elsif path[:action] == 'M'
+ mod_paths << path
+ else
+ other_paths << path
+ end
+ end
+ add_paths_name.each do |add_path|
+ mod_paths.delete_if { |m| m[:path] == add_path }
+ end
+ paths.concat add_paths
+ paths.concat mod_paths
+ paths.concat other_paths
+ end
+ paths
+ end
# Retrieve changed paths for a single patch
- def get_paths_for_patch(hash)
+ def get_paths_for_patch_raw(hash)
cmd = "#{DARCS_BIN} annotate --repodir #{shell_quote @url} --summary --xml-output"
cmd << " --match #{shell_quote("hash #{hash}")} "
paths = []