[Treepkg-commits] r249 - trunk/treepkg

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Mar 12 12:04:35 CET 2010


Author: aheinecke
Date: 2010-03-12 12:04:31 +0100 (Fri, 12 Mar 2010)
New Revision: 249

Modified:
   trunk/treepkg/git.py
Log:
Changed command calls to use cwd and fixed line length


Modified: trunk/treepkg/git.py
===================================================================
--- trunk/treepkg/git.py	2010-03-12 09:49:35 UTC (rev 248)
+++ trunk/treepkg/git.py	2010-03-12 11:04:31 UTC (rev 249)
@@ -25,23 +25,28 @@
     """Clones the repository at url into the localdir"""
     run.call(cmdexpand("git clone $url $localdir", **locals()))        
     if branch:
-        run.call(cmdexpand("/bin/bash -c \"cd $localdir && git checkout --track -b local $branch\"",
-                            **locals()))
+        run.call(cmdexpand("git checkout --track -b local $branch", 
+                            **locals()), cwd=localdir)
     else:
-        run.call(cmdexpand("/bin/bash -c \"cd $localdir && git checkout --track -b local master\"",
-                            **locals()))
+        run.call(cmdexpand("git checkout --track -b local master"),
+                            cwd=localdir)
 
 def update(localdir, revision=None):
     """Runs git pull on the localdir."""
-    run.call(cmdexpand("/bin/bash -c \"cd $localdir && git pull -q\"", **locals()))
+    run.call(cmdexpand("git pull -q"), cwd=localdir)
 
 def export(src, dest):
     """Exports the local branch from src to dest"""
-    run.call(cmdexpand("/bin/bash -c \"cd $src && git checkout-index -a -f --prefix=$dest\"", **locals()))
+    run.call(cmdexpand("git checkout-index -a -f --prefix=$dest", **locals()),
+             cwd=src)
 
 def last_changed_revision(git_working_copy):
-    """return the last changed revision of a Git branch as a incrementing Number"""
-    output = run.capture_output(cmdexpand("/bin/bash -c \"cd $git_working_copy && git rev-list local | nl | tail -n 1 | awk \'{print $$1}\'\"", **locals()))
+    """Return the last changed revision of a Git branch 
+       as an incrementing Number"""
+    output = run.capture_output(cmdexpand("/bin/bash -c \
+                                \"git rev-list local | nl | tail -n 1 | \
+                                  awk \'{print $$1}\'\""
+                                , **locals()), cwd=git_working_copy)
     if output is None:
         raise GitError("Cannot determine last changed revision for %r"
                               % git_working_copy)



More information about the Treepkg-commits mailing list