顯示具有 svn 標籤的文章。 顯示所有文章
顯示具有 svn 標籤的文章。 顯示所有文章

星期四, 5月 03, 2012

svn篩選更動的部份並提交

人懶得打字,就要寫個script來輔助篩選...

一般來說都是先用 svn status 看改了些什麼,然後才下 svn commit 提交。可是如果檔案很多,大概就看不完也打不完,下面這個 script 就是先利用 awk 篩掉 ? 的部份,這些是未納入版本控制的檔案,就不顯示,有需要,要記得要先用 svn add 加入。然後篩選完,就順便組出 dialog 指令需要的格式,最後再用 dialog 來顯示出可勾選的對話視窗。

#!/bin/bash

FILES=$(svn status | awk '$1 !~ /^?/{printf("%s %s off ", $2, $1);}')
CMD="dialog --separate-output --stdout --checklist Modified/Add/Delete 24 80 20 \
    $FILES"
SELECTED=$($CMD)

if [ "$SELECTED" == "" ]; then
    echo "Select nothing."
else
    echo "svn commit $SELECTED"
fi

星期二, 4月 24, 2012

git-svn無法dcommit

之前都忘記要 git svn dcommit,今天才想到要提交到伺服器,打指令時就出現 "File or directory 'xxx' is out of date;" 的錯誤訊息,試著先 git svn fetch 再 git svn rebase,git svn rebase 也是告訴我錯誤,但他多了一個提示,說可以試著刪掉 .git/rebase-apply 目錄,再 rebase 一次。為了以防萬一,我先把 .git/rebase-apply 備份起來,刪掉,再做 rebase,這次告訴我說有衝突,於是我解決掉該檔案的衝突,用 git add 加回去之後,再用 git rebase --continue 繼續合併的作業,最後就可以用 git svn dcommit 了。

星期三, 7月 14, 2010

ChangeLog and svn2cl

目前大部分的開放原始碼專案都是遵從 GNU 的Changelog 格式,基本上寫起來不難,只是有點煩。

所以有的開發工具,例如 monodevelop (Version Control Screencast),甚至把你 commit 的格式也固定下來,讓你省掉許多功夫。

好吧,其實只是我今天突然想到以前有用過 cvs2log 這個 perl script,還不錯用,可以直接把 cvs 裡的 log 轉出來成 Changelog,所以,就想到 svn 應該有類似的工具,之前好像有用過,但我忘了。於是我就用 svn2log 去找,嘿,當然有這工具,可是這工具的網站已經連不上了。我只好退而求其次,用 apt-cache 找找,但也沒找到,只是有 subversion-tools 這個 package。裝起來試試看吧,裏面有不少東西,有一個小程式叫作 svn2cl,試了一下,果然這就是我要的東西。

要使用 svn2cl 來產生 Changelog 的話,在你 commit 時,log 就不需要加什麼格式了,就儘可能地在一行之內把 log 寫完,然後不要一次修改很多檔案,這樣產生出來的 Changelog 就會很不錯了。svn2cl 有相當多選項,甚至可以產生 html、只產生某段期間的 log...等,有時間再來研究看看。

星期五, 1月 08, 2010

viewvc 出現 ImportError: DLL load failed

環境:
  • Apache 2.0.x
  • mod_python 3.3.1
  • python 2.5.4
  • Subversion 1.5.6
  • svn-python 1.5.6
  • viewvc 1.0.7


查了好久,原本以為是 PATH 問題,手動在 viewvc 的 mod_python.py 裡加上 sys.path.append( r"c:\program files\subversion\bin" ) 也沒有用。

後來才爬到這篇文:#6739 (trac svn-python mismatch with apache 2.2 under windows),說是要把 subversion 的 dll 複製到 Apache 的執行目錄下。
查了 Apache 的執行路徑,發現真的有重複的 dll:
  • libapr.dll
  • libapriconv.dll
  • libaprutil.dll
  • libeay32.dll
  • ssleay32.dll
,於是備份之後,再把 subversion 下的這些 dll 複製過來,重新啟動 Apache 就解決了。

星期四, 12月 03, 2009

svndiff

想不到 svn 要用 --diff-cmd 才能指定用哪個 diff,因為不想每次打 svn diff --diff-cmd 這麼長的指令,就寫成了 script。既然要寫成 script,那乾脆再簡化,如果不帶參數,就自動帶出所有有更動/衝突的檔案,讓我來挑選哪些要比對。


#!/bin/sh
# Dependencies: zentiy subversion awk meld
if [ -z $1 ]; then
FILES=`svn status | awk '/^[MC]/{print $2;}' | zenity --list --width=600 --height=400 --separator=\ --checklist --title "The files which modified/conflict" --text 'Please select files' --column '' --column 'Files'`
else
FILES=$@
fi
for FILE in $FILES; do
svn diff --diff-cmd /usr/bin/meld $FILE
done
exit 0