[英]How do I apply a diff or patch file?
when using the rugged git library how can I apply that diff to my dest branch as a commit?. 当使用坚固的git库时,如何将该差异作为提交应用到我的dest分支?
# @param src [Rugged::Object] - the rugged object or string to compare from
# @param dst [Rugged::Object] - the rugged object or string to compare to, defaults to parent
# @return [Rugged::Diff] a rugged diff object between src and dst
def create_diff(src, dst = nil)
src = repo.lookup(find_ref(src))
dst ||= repo.lookup(src.parents.first)
dst = find_ref(dst)
src.diff(dst)
end
# @param sha_or_ref [String] - the name or sha of the ref
# @return [String] the oid of the sha or ref
def find_ref(sha_or_ref)
case sha_or_ref
when Rugged::Object
sha_or_ref.oid
else
repo.rev_parse_oid(sha_or_ref)
end
end
Is there not an easy way to apply a patch or diff? 有没有简单的方法来应用补丁或差异? Seems silly that I would need to loop through each change in the diff and either add/rm the file.
似乎很愚蠢,我需要遍历diff的每个更改并添加/ rm文件。
Considering the: 考虑到:
You would have to wait for that feature to be ported in rugged. 您将不得不等待该功能坚固耐用地移植。
The last official release v0.24.0 does not include 0.24.4. 最新的正式版本v0.24.0不包含0.24.4。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.