创建/ a / b补丁的简单方法?

时间:2017-04-21 21:03:42

标签: linux command-line-interface diff patch openwrt

OpenWRT等一些奇怪的东西需要格式化补丁:

diff -urN a/src/util.c b/src/util.c
--- a/src/util.c        2017-04-21 23:22:06.895516111 +0300
+++ b/src/util.c        2017-04-21 23:22:19.595595344 +0300

现在要创建这样的补丁,我必须做下一步行动:

mkdir -p a/src
mkdir -p b/src
cd src/
cp util.c ../a/src/
cp util.c.orig ../b/src/util.c
cd ..
diff -urN a/ b/ > 001-watchdog.patch

有没有办法避免这样做?

1 个答案:

答案 0 :(得分:1)

可能最简单的方法是使用<?xml version="1.0" encoding="UTF-8"?> <xliff xmlns="urn:oasis:names:tc:xliff:document:1.2"> <file original="TargetMerged/Localizable.strings"> <trans-unit>1</trans-unit> <trans-unit>2</trans-unit> <trans-unit>3</trans-unit> <trans-unit>4</trans-unit> <trans-unit>5</trans-unit> <trans-unit>6</trans-unit> </file> <file original="TargetNotInteresting1/Localizable.strings"> <trans-unit>7</trans-unit> <trans-unit>8</trans-unit> </file> <file original="TargetNotInteresting2/Localizable.strings"> <trans-unit>9</trans-unit> <trans-unit>10</trans-unit> </file> </xliff>