한다고 가정 나는 다음과 같은 문장이 있습니다루비에서 3 문장에 델타를 사용하는 방법?
내가 좋아하는 몇 가지 압축 된 형태로-S2 S1과 S3-S1의 델타를 저장할 수 있도록하려면s1 = "The red dog jumped over the hill, followed by the crazy clown."
s2 = "The green fox jumped over the hill, followed by the crazy clown."
s3 = "The red dog jumped over the hill, followed by the dumb dolphin."
: s2_d_s1 = - "빨간 개"+ "녹색 여우 "
그런 다음 델타를 가져 와서 임의의 순서대로 적용 할 수 있습니다. s2_d_s1 또는 s3_d_s1을 먼저 적용 할 수 있습니다. 다음은 동일합니다 :
apply_delta(apply_delta(s1, s2_d_s1), s3_d_s1) ==
apply_delta(apply_delta(s1, s3_d_s1), s2_d_s1)
apply_delta(s1, s2_d_s1) == "The green fox jumped over the hill, followed by the crazy clown."
Ruby에서 어떻게합니까? 그것을 할 도서관이 있습니까?
는 (실제 내용은 문장보다 더 복잡 될 것입니다. 그것은 문서입니다.) 나는 화석을 시도했지만 (문장의 크기를 변경 최초의 델타를 적용 처리하는 방법을 알아낼 수 없습니다 문장을 변경크기 : 두 번째 델타 적용) :
s1 = "The red dog jumped over the hill, followed by the crazy clown."
s2 = "The green fox jumped over the hill, followed by the crazy clown."
s3 = "The red dog jumped over the hill, followed by the dumb dolphin."
s2_d_s1 = Fossilize.create(s1, s2)
s3_d_s1 = Fossilize.create(s1, s3)
Fossilize.apply(Fossilize.apply(s1, s2_d_s1), s3_d_s1)
DeltaApplicationError: Output was -1, but I expected 63!
from /Users/me/.rvm/gems/ruby-2.2.1/gems/fossilize-1.1.1/lib/fossilize.rb:107:in `apply'
from (irb):14
from /Users/me/.rvm/rubies/ruby-2.2.1/bin/irb:11:in `<main>'
[ruby-git] (https://github.com/schacon/ruby-git) 도움이 될까요? –
힘내는 deltas뿐만 아니라 파일의 전체 상태를 추적하므로 원하는 내용이 아닙니까? git이 diffs를 유지한다는 것은 일반적인 오해입니다. –