[arch-projects] [ABS] [PATCH v3 6/7] vcs prototypes: consistent coding style

Linus Arver linusarver at gmail.com
Wed Nov 9 00:56:48 EST 2011


Some vcs prototypes do

    cd repo && update

while others do it like

    cd repo
    update

to update an existing repo. It makes sense to have them all do it the
first way (there's nothing wrong with it, and it has better form).

We also check for the (hidden) version control directory in the
if-statement for consisteny.

Signed-off-by: Linus Arver <linusarver at gmail.com>
---
 prototypes/PKGBUILD-bzr.proto   |    2 +-
 prototypes/PKGBUILD-cvs.proto   |    3 +--
 prototypes/PKGBUILD-darcs.proto |    3 +--
 prototypes/PKGBUILD-git.proto   |    2 +-
 prototypes/PKGBUILD-hg.proto    |    5 ++---
 prototypes/PKGBUILD-svn.proto   |    2 +-
 6 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/prototypes/PKGBUILD-bzr.proto b/prototypes/PKGBUILD-bzr.proto
index 3f6d2e9..887d97b 100644
--- a/prototypes/PKGBUILD-bzr.proto
+++ b/prototypes/PKGBUILD-bzr.proto
@@ -34,7 +34,7 @@ build() {
   cd "$srcdir"
   msg "Connecting to $_bzrtrunk ..."
 
-  if [[ -d "$_bzrmod" ]]; then
+  if [[ -d "$_bzrmod/.bzr" ]]; then
     cd "$_bzrmod" && bzr --no-plugins pull "$_bzrtrunk" -r "$pkgver"
     msg "The local files are updated."
     cd ..
diff --git a/prototypes/PKGBUILD-cvs.proto b/prototypes/PKGBUILD-cvs.proto
index 0ddd91d..1d37621 100644
--- a/prototypes/PKGBUILD-cvs.proto
+++ b/prototypes/PKGBUILD-cvs.proto
@@ -35,8 +35,7 @@ build() {
   msg "Connecting to $_cvsmod ..."
 
   if [[ -d "$_cvsmod/CVS" ]]; then
-    cd "$_cvsmod"
-    cvs -z3 update -d
+    cd "$_cvsmod" && cvs -z3 update -d
     msg "The local files are updated."
     cd ..
   else
diff --git a/prototypes/PKGBUILD-darcs.proto b/prototypes/PKGBUILD-darcs.proto
index 1103588..5da47e1 100644
--- a/prototypes/PKGBUILD-darcs.proto
+++ b/prototypes/PKGBUILD-darcs.proto
@@ -35,8 +35,7 @@ build() {
   msg "Connecting to $_darcstrunk ..."
 
   if [[ -d "$_darcsmod/_darcs" ]]; then
-    cd "$_darcsmod"
-    darcs pull -a "$_darcstrunk/$_darcsmod"
+    cd "$_darcsmod" && darcs pull -a "$_darcstrunk/$_darcsmod"
     msg "The local files are updated."
     cd ..
   else
diff --git a/prototypes/PKGBUILD-git.proto b/prototypes/PKGBUILD-git.proto
index a2f2f40..b8f5de7 100644
--- a/prototypes/PKGBUILD-git.proto
+++ b/prototypes/PKGBUILD-git.proto
@@ -34,7 +34,7 @@ build() {
   cd "$srcdir"
   msg "Connecting to $_gitroot ..."
 
-  if [[ -d "$_gitname" ]]; then
+  if [[ -d "$_gitname/.git" ]]; then
     cd "$_gitname"
     git clean -dxf
     git reset --hard
diff --git a/prototypes/PKGBUILD-hg.proto b/prototypes/PKGBUILD-hg.proto
index b6610fa..27883f6 100644
--- a/prototypes/PKGBUILD-hg.proto
+++ b/prototypes/PKGBUILD-hg.proto
@@ -34,9 +34,8 @@ build() {
   cd "$srcdir"
   msg "Connecting to $_hgroot ..."
 
-  if [[ -d "$_hgrepo" ]]; then
-    cd "$_hgrepo"
-    hg pull -u
+  if [[ -d "$_hgrepo/.hg" ]]; then
+    cd "$_hgrepo" && hg pull -u
     msg "The local files are updated."
     cd ..
   else
diff --git a/prototypes/PKGBUILD-svn.proto b/prototypes/PKGBUILD-svn.proto
index 4a4f6cb..9cb3426 100644
--- a/prototypes/PKGBUILD-svn.proto
+++ b/prototypes/PKGBUILD-svn.proto
@@ -35,7 +35,7 @@ build() {
   msg "Connecting to $_svntrunk ..."
 
   if [[ -d "$_svnmod/.svn" ]]; then
-    (cd "$_svnmod" && svn up -r "$pkgver")
+    cd "$_svnmod" && svn up -r "$pkgver"
     msg "The local files are updated."
     cd ..
   else
-- 
1.7.7.2



More information about the arch-projects mailing list