summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2014-05-14 09:36:11 +0000
committerDaniel Jasper <djasper@google.com>2014-05-14 09:36:11 +0000
commit7747c87a662ce86981b066f22b33ed65bab37ce7 (patch)
treeab43481f9613649966ff7f137044beec61273c7f
parent65e68675f101657b69a404432c2116bc9cc23b22 (diff)
downloadclang-7747c87a662ce86981b066f22b33ed65bab37ce7.tar.gz
clang-7747c87a662ce86981b066f22b33ed65bab37ce7.tar.bz2
clang-7747c87a662ce86981b066f22b33ed65bab37ce7.tar.xz
clang-format: Add clang-format-diff usage examples for SVN.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208766 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--docs/ClangFormat.rst6
-rwxr-xr-xtools/clang-format/clang-format-diff.py3
2 files changed, 8 insertions, 1 deletions
diff --git a/docs/ClangFormat.rst b/docs/ClangFormat.rst
index 3f8499b8ce..86c5ec5e58 100644
--- a/docs/ClangFormat.rst
+++ b/docs/ClangFormat.rst
@@ -177,5 +177,11 @@ So to reformat all the lines in the latest :program:`git` commit, just do:
git diff -U0 HEAD^ | clang-format-diff.py -i -p1
+In an SVN client, you can do:
+
+.. code-block:: console
+
+ svn diff --diff-cmd=diff -x-U0 | clang-format-diff.py -i
+
The :option:`-U0` will create a diff without context lines (the script would format
those as well).
diff --git a/tools/clang-format/clang-format-diff.py b/tools/clang-format/clang-format-diff.py
index 376257b638..d6d0d44a06 100755
--- a/tools/clang-format/clang-format-diff.py
+++ b/tools/clang-format/clang-format-diff.py
@@ -15,9 +15,10 @@ ClangFormat Diff Reformatter
This script reads input from a unified diff and reformats all the changed
lines. This is useful to reformat all the lines touched by a specific patch.
-Example usage for git users:
+Example usage for git/svn users:
git diff -U0 HEAD^ | clang-format-diff.py -p1 -i
+ svn diff --diff-cmd=diff -x-U0 | clang-format-diff.py -i
"""