2009-07-17 svn tagging and branching
svn 是一種使用之前會討厭,
但使用過以後你已經不能缺少的開發環節 (情況和測試驅動開發(TDD)一樣)
在"使用過" 並愛上的青況之下,
你很容易便會提起興趣學習進階的 branch 和 tag 的功能了
但如果沒有, 直接跳過就好了
對於使用者來說, tag 和 branch 建立之後, 你會發現 svn 好像複製了 trunk 的檔案到另一個地方
所以你的在 trunk 的 commit 不會對tag 和 branch 的資料做成影響, 相反如是
如果你瀏覽你的 repo, 你便可以發現你的 code 都在 trunk 資料夾之下(如果正常的設定之下)
上一層便可以看到 tags 和 branches 資料夾, 甚至是 releases 資料夾
但tagging 並不會對你的檔案系統和硬碟做成壓力
因為它只會建立連結到 tags, 而不會建立另一組的檔案
另一面說, 就是 svn 提供一個快速的 tag 和 branch, 令你樂於使用, 就好像 commit 一樣
從底層技術的層面來說, tagging 和 branching 是一樣的
唯一的不同是我們, 或者開開發團隊使用的方法和習慣
簡單說, branching 是分作一個階段的除蟲, 可以是一個新加的一個功能, 一些大型的功能上, 或者結構上的修改
相反, tagging 便隨意得多
我會建立日期 tag, 在我將我的code 上傳到共用開發機做相容性測試之前
以確保我可以快速拿回前天的上傳, 令共用的開發機不會因為我今日的 code 而影響到其他人的測試, 開發
當然, 你也可以因應你的需要而建立不同的 tag
最後提示一下, 假如你轉到 branches 或 tag 工作的話
記得要轉回trunk, 否則你的 commit 到會轉到 tag 或 branch 旗下了
Svn is a thing that you will hate it before use,
but cannot live without after first trial. ( same as test driven development here.)
With such environment, you will got the interest to use and learn tagging and branching.
But if not, just skip this blog post.
Tagging is cheap in CPU time and hardisk space.
It just create links to tagged versions of files, which do not create some extra files copies.
In return, svn provide a speedy tagging and branching, which will not block the development process, just like commits.
Tag and branch act like copying your trunk to another folder (although it is not real in file system, stated above),
so you have separate versions of code and their commit will not affect each other.
If you browse the repo of your head, most probably you will find your code live in trunk folder.
Moving up a level, you will find tags and branches folder, an in some config, even a releases folder.
In real backend, tagging is the same as branching, techically.
But like we do commit in trunk, we do tagging in tags folder and branch in branches folder.
So the only difference is how we, or the team, is using it as common practises.
In simple, branching is for bug fix of releases, new major function added, which is usually a huge change in structure or functionality.
But tagging is more "relax".
I will tag codes with datetime, before deploy to staging server, so I can always revert to previous deploy status on staging server.
But last to remind, if you have encountered so case you want to switch to branches or tag version,
remember to switch back to trunk or you will commit to branches instead of normal working trunk version.
Enjoy svn!
Project filmcritics.org.hk 香港電影評論學會
Requirement gathering
Functional design
Drupal core
site XHTML, JS, CSS
theme 使用theme 自己的 *.tpl.php, build a custom hook_theme() on a theme
一個module 需要輸出html 的話, 會使用 hook_theme()
但如果一個theme 都需要輸出特定的html, 或者需要使用 *.tpl.php的話
因為Drupal 6 新增了 theme registry,
以前 Drupal 5 的theme 內的theme() 函數都不會自動加到theme registry
要在 template.php 內:
/*
template.php
*/
function [theme_name]_theme(){
return array(
'taxonomy' => array(
'template' => 'taxonomy',
'arguments' => array('taxonomy'=>NULL),
),
);
}
便可以在theme_name 資料夾內使用taxonomy.tpl.php:
/*
taxonomy.tpl.php
*/
<ul class="links inline">
<?php foreach ($taxonomy as $term) { ?>
<?php
$href = "taxonomy/term/".$term->vid."/".$term->tid;
$text = $term->name;
?>
<li><?php print l($text,$href) ?></li>
<?php } ?>
</ul>
完全分離logic 和 html 輸出
也方便的將 html 的建立, 維護部份分工到另一個人身上
2009-04-14 本站順利升級到 Druapl 6.10, successfully upgraded to Drupal 6.10
終於都抽了時間將我這個站升到 Drupal 6.10
也是為了展示給客戶吧, haha
因為我的站的結構比較簡單,
幾乎是無痛升級
linux 的 untar, wget, cp 等等的命令都練得很熟了
只有我這個custom theme 需要一點點的代碼升級
都只是一個半個小時的工作而已
太順利了!
1. 將5.x 之下的全部模組, core 都升到最新版
2. backup
3. disable第三方模組
4. 覆蓋 Drupal6.10, upgrade.php
5. 一個一個將第三方模組升級
Finally, dug some time to upgrade this site to Drupal 6.10,
have to demonstrate to my clients, haha
because my site's structure is relatively simple,
the upgrade is almost plainless.
tar, cp, wget commands just got enough practise
only my theme need some coding changes,
but just a piece of cake.
1. upgrade all 5.x modules and core to latest version.
2. backup
3. disable all third parties modules
4. overwrite Drupal6.10, upgrade.php
5. upgrade modules one by one