Mercurial > treepkg
changeset 323:ef983263b875
Changed command calls to use cwd and fixed line length
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Fri, 12 Mar 2010 11:04:31 +0000 (2010-03-12) |
parents | 278abafc2d86 |
children | 77d0f8a4e838 |
files | treepkg/git.py |
diffstat | 1 files changed, 13 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/treepkg/git.py Fri Mar 12 09:49:35 2010 +0000 +++ b/treepkg/git.py Fri Mar 12 11:04:31 2010 +0000 @@ -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)