-sub update_svn($$$) {
- my $name = shift;
- my $src = shift;
- my $relocate = shift;
-
- if ( !$relocate && -d "./feeds/$name/.svn" ) {
- system("(cd \"./feeds/$name\"; svn up)") == 0 or return 1;
- } else {
- system("rm -rf \"./feeds/$name\"");
- system("svn co $src \"./feeds/$name\"") == 0 or return 1;
- }
-
- return 0;
-}
-
-sub update_cpy($$$) {
- my $name = shift;
- my $src = shift;
- my $relocate = shift;
-
- $relocate && system("rm -rf \"./feeds/$name\"");
- system("mkdir -p ./feeds/$name");
- system("cp -Rf $src ./feeds");
-
- return 0;
-}
-
-sub update_link($$$) {
- my $name = shift;
- my $src = abs_path(shift);
- my $relocate = shift; # no-op
-
- system("rm -f ./feeds/$name; ln -s $src ./feeds/$name");
+my %update_method = (
+ 'src-svn' => {
+ 'init' => "svn checkout '%s' '%s'",
+ 'update' => "svn update",
+ 'controldir' => ".svn"},
+ 'src-cpy' => {
+ 'init' => "cp -Rf '%s' '%s'",
+ 'update' => ""},
+ 'src-link' => {
+ 'init' => "ln -s '%s' '%s'",
+ 'update' => ""},
+ 'src-git' => {
+ 'init' => "git clone --depth 1 '%s' '%s'",
+ 'init_branch' => "git clone --depth 1 --branch '%s' '%s' '%s'",
+ 'update' => "git pull",
+ 'controldir' => ".git"},
+ 'src-bzr' => {
+ 'init' => "bzr checkout --lightweight '%s' '%s'",
+ 'update' => "bzr update",
+ 'controldir' => ".bzr"},
+ 'src-hg' => {
+ 'init' => "hg clone '%s' '%s'",
+ 'update' => "hg pull --update",
+ 'controldir' => ".hg"},
+ 'src-darcs' => {
+ 'init' => "darcs get '%s' '%s'",
+ 'update' => "darcs pull -a",
+ 'controldir' => "_darcs"},
+);