Mercurial > treepkg > treepkg
annotate treepkg/subversion.py @ 45:3e610233ccfe
use cmdexpand when calling subprocesses
author | Bernhard Herzog <bh@intevation.de> |
---|---|
date | Tue, 20 Mar 2007 17:27:46 +0100 |
parents | f78a02e79c84 |
children | 570ac81865be |
rev | line source |
---|---|
0 | 1 # Copyright (C) 2007 by Intevation GmbH |
2 # Authors: | |
3 # Bernhard Herzog <bh@intevation.de> | |
4 # | |
5 # This program is free software under the GPL (>=v2) | |
6 # Read the file COPYING coming with the software for details. | |
7 | |
8 """Collection of subversion utility functions""" | |
9 | |
10 import os | |
11 | |
12 import run | |
45
3e610233ccfe
use cmdexpand when calling subprocesses
Bernhard Herzog <bh@intevation.de>
parents:
0
diff
changeset
|
13 from cmdexpand import cmdexpand |
0 | 14 from util import extract_value_for_key |
15 | |
16 | |
17 def checkout(url, localdir): | |
18 """Runs svn to checkout the repository at url into the localdir""" | |
45
3e610233ccfe
use cmdexpand when calling subprocesses
Bernhard Herzog <bh@intevation.de>
parents:
0
diff
changeset
|
19 run.call(cmdexpand("svn checkout -q $url $localdir", **locals())) |
0 | 20 |
21 def update(localdir): | |
22 """Runs svn update on the localdir""" | |
45
3e610233ccfe
use cmdexpand when calling subprocesses
Bernhard Herzog <bh@intevation.de>
parents:
0
diff
changeset
|
23 run.call(cmdexpand("svn update -q $localdir", **locals())) |
0 | 24 |
25 def export(src, dest): | |
26 """Runs svn export src dest""" | |
45
3e610233ccfe
use cmdexpand when calling subprocesses
Bernhard Herzog <bh@intevation.de>
parents:
0
diff
changeset
|
27 run.call(cmdexpand("svn export -q $src $dest", **locals())) |
0 | 28 |
29 def last_changed_revision(svn_working_copy): | |
30 """return the last changed revision of an SVN working copy as an int""" | |
31 # Make sure we run svn under the C locale to avoid localized | |
32 # messages | |
33 env = os.environ.copy() | |
34 env["LANG"] = "C" | |
35 | |
45
3e610233ccfe
use cmdexpand when calling subprocesses
Bernhard Herzog <bh@intevation.de>
parents:
0
diff
changeset
|
36 output = run.capture_output(cmdexpand("svn info $svn_working_copy", |
3e610233ccfe
use cmdexpand when calling subprocesses
Bernhard Herzog <bh@intevation.de>
parents:
0
diff
changeset
|
37 **locals()), |
3e610233ccfe
use cmdexpand when calling subprocesses
Bernhard Herzog <bh@intevation.de>
parents:
0
diff
changeset
|
38 env=env) |
0 | 39 return int(extract_value_for_key(output.splitlines(), |
40 "Last Changed Rev:")) |