|
|
@ -2,16 +2,20 @@ require 'fileutils'
|
|
|
|
include FileUtils
|
|
|
|
include FileUtils
|
|
|
|
|
|
|
|
|
|
|
|
conflicts = `find ~/Dropbox -name "*conflicted*"`.split("\n")
|
|
|
|
conflicts = `find ~/Dropbox -name "*conflicted*"`.split("\n")
|
|
|
|
same, diff = conflicts.select { |conflict|
|
|
|
|
diffs = conflicts.each.with_object({}) { |conflict, diffs|
|
|
|
|
actual = conflict.sub(/ \(.*'s conflicted copy \d{4}-\d{2}-\d{2}\)/, '')
|
|
|
|
actual = conflict.sub(/ \(.*'s conflicted copy \d{4}-\d{2}-\d{2}\)/, '')
|
|
|
|
diff = `diff "#{actual}" "#{conflict}"`
|
|
|
|
diffs[conflict] = `diff "#{actual}" "#{conflict}"`
|
|
|
|
diff.empty?
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
same.each do |conflict|
|
|
|
|
same, diff = diffs.partition {|_,diff| diff.empty? }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
same.each do |conflict, _|
|
|
|
|
rm conflict
|
|
|
|
rm conflict
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
puts diff.map { |conflict|
|
|
|
|
puts diff.map { |conflict, diff|
|
|
|
|
[conflict, diff].join("\n")
|
|
|
|
[conflict, diff].join("\n")
|
|
|
|
}.join("\n")
|
|
|
|
}.join("\n")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# require 'pry'
|
|
|
|
|
|
|
|
# binding.pry
|
|
|
|