forked from django-docs-ja/django-docs-ja
/
diffgen.sh
executable file
·40 lines (30 loc) · 1.07 KB
/
diffgen.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
# checks revision in docs directory, updates entire local copy if needed,
# and generates the diff.
REPOS_PATH=http://code.djangoproject.com/svn/django/trunk/
LOCAL_PATH=/Users/ymasuda/work/django/src/trunk/
DOCJP_DIR=/Users/ymasuda/work/django/doc-jp/
# move clean up finished diffs to done directory
if [ ! -d $DOCJP_DIR/done ]; then
mkdir $DOCJP_DIR/done;
fi
rm *.diff~
for i in $DOCJP_DIR/*.diff; do
if [ "`head -n1 $i`" = "done." ]; then
mv $i $DOCJP_DIR/zz_diff_done/
fi
done
# find revision number.
LOCAL_REV=`svn info $LOCAL_PATH| awk "/Revision:/ { print \\$NF}"`
REPOS_REV=`svn info $REPOS_PATH| awk "/Revision:/ { print \\$NF}"`
# show current revision number, both for local copy and repository.
echo $LOCAL_REV in local copy, $REPOS_REV in repository.
if [ $LOCAL_REV -lt $REPOS_REV ]; then
# remote repository has upadted.
pushd $LOCAL_PATH; svn update;
svn diff $LOCAL_PATH/docs -r$LOCAL_REV:$REPOS_REV > $DOCJP_DIR/to_$REPOS_REV.diff
echo Local copy updated to $REPOS_REV.
popd
else
echo 'Local copy is up to date.'
fi